summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/macosx/Symbols.cpp
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2012-10-30 21:26:30 +0000
committerJason Molenda <jmolenda@apple.com>2012-10-30 21:26:30 +0000
commit055c57b7ceccbad89029c606a3a1fdd5dc29fbf2 (patch)
treee10b1b33ba5f19d8aa23fefa354699ccb900cf4d /lldb/source/Host/macosx/Symbols.cpp
parent1296b5952241fc9d5c09c5f5bf21d69f9fc256b2 (diff)
downloadbcm5719-llvm-055c57b7ceccbad89029c606a3a1fdd5dc29fbf2.tar.gz
bcm5719-llvm-055c57b7ceccbad89029c606a3a1fdd5dc29fbf2.zip
Change the MacOSX Symbols::DownloadObjectAndSymbolFile to look up
"~rc" via getpwnam() instead of doing tilde expansion and doing soft-link dereferencing via realpath() - if we're pointing to a softlink, leave it as-is. <rdar://problem/12597698> llvm-svn: 167052
Diffstat (limited to 'lldb/source/Host/macosx/Symbols.cpp')
-rw-r--r--lldb/source/Host/macosx/Symbols.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/lldb/source/Host/macosx/Symbols.cpp b/lldb/source/Host/macosx/Symbols.cpp
index a8fa1c0dbc3..a358336b4ee 100644
--- a/lldb/source/Host/macosx/Symbols.cpp
+++ b/lldb/source/Host/macosx/Symbols.cpp
@@ -11,6 +11,7 @@
// C Includes
#include <dirent.h>
+#include <pwd.h>
#include "llvm/Support/MachO.h"
// C++ Includes
@@ -696,12 +697,27 @@ Symbols::DownloadObjectAndSymbolFile (ModuleSpec &module_spec, bool force_lookup
if (!g_dsym_for_uuid_exe_exists)
{
- dsym_for_uuid_exe_spec.SetFile("~rc/bin/dsymForUUID", true);
+ dsym_for_uuid_exe_spec.SetFile("/usr/local/bin/dsymForUUID", false);
g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists();
if (!g_dsym_for_uuid_exe_exists)
{
- dsym_for_uuid_exe_spec.SetFile("/usr/local/bin/dsymForUUID", false);
- g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists();
+ int bufsize;
+ if ((bufsize = sysconf(_SC_GETPW_R_SIZE_MAX)) != -1)
+ {
+ char buffer[bufsize];
+ struct passwd pwd;
+ struct passwd *tilde_rc = NULL;
+ // we are a library so we need to use the reentrant version of getpwnam()
+ if (getpwnam_r ("rc", &pwd, buffer, bufsize, &tilde_rc) == 0
+ && tilde_rc
+ && tilde_rc->pw_dir)
+ {
+ std::string dsymforuuid_path(tilde_rc->pw_dir);
+ dsymforuuid_path += "/bin/dsymForUUID";
+ dsym_for_uuid_exe_spec.SetFile(dsymforuuid_path.c_str(), false);
+ g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists();
+ }
+ }
}
}
if (!g_dsym_for_uuid_exe_exists && g_dbgshell_command != NULL)
OpenPOWER on IntegriCloud