diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2010-07-02 19:38:10 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2010-07-02 19:38:10 +0000 |
commit | b6c9e103a103b24dc96917497a0bb9450d921a6b (patch) | |
tree | 83eab94a0f763d73e64d74ea47775fd66b133c15 /lldb/source/Host/linux/Host.cpp | |
parent | 5423ebff13b9a6742b8c61578c862a904db9cc1b (diff) | |
download | bcm5719-llvm-b6c9e103a103b24dc96917497a0bb9450d921a6b.tar.gz bcm5719-llvm-b6c9e103a103b24dc96917497a0bb9450d921a6b.zip |
Implement GetProgramFileSpec().
llvm-svn: 107502
Diffstat (limited to 'lldb/source/Host/linux/Host.cpp')
-rw-r--r-- | lldb/source/Host/linux/Host.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp index c4bf53f70a7..5aba06e3469 100644 --- a/lldb/source/Host/linux/Host.cpp +++ b/lldb/source/Host/linux/Host.cpp @@ -402,23 +402,10 @@ Host::GetProgramFileSpec () static FileSpec g_program_filepsec; if (!g_program_filepsec) { -#if 0 - std::string program_fullpath; - program_fullpath.resize (PATH_MAX); - // If DST is NULL, then return the number of bytes needed. - uint32_t len = program_fullpath.size(); - int err = _NSGetExecutablePath ((char *)program_fullpath.data(), &len); - if (err < 0) - { - // The path didn't fit in the buffer provided, increase its size - // and try again - program_fullpath.resize(len); - len = program_fullpath.size(); - err = _NSGetExecutablePath ((char *)program_fullpath.data(), &len); - } - if (err == 0) - g_program_filepsec.SetFile(program_fullpath.data()); -#endif + char exe_path[PATH_MAX]; + ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path)); + if (len >= 0) + g_program_filepsec = FileSpec(exe_path); } return g_program_filepsec; } |