[Lldb-commits] [PATCH] Patch for pr17880 - main module gets base address added again to symbols on FreeBSD

John Wolfe jlw at xinuos.com
Mon Jan 6 09:25:01 PST 2014


  Delete trailing white space reported by Ed Maste

Hi emaste,

http://llvm-reviews.chandlerc.com/D2389

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D2389?vs=6041&id=6371#toc

Files:
  source/Commands/CommandObjectProcess.cpp
  source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp

Index: source/Commands/CommandObjectProcess.cpp
===================================================================
--- source/Commands/CommandObjectProcess.cpp
+++ source/Commands/CommandObjectProcess.cpp
@@ -211,6 +211,16 @@
         
         if (target_settings_argv0)
         {
+            // On FreeBSD, rtld will convert argv0 of an execve() to an
+            // absolute path with partial resolution of symbolic links and
+            // associate that name with the link_map entry for the executable.
+            // Resolve the executable path now to assure accurate identification
+            // in the DYLDRendezvous class.
+            char real_exe_path[PATH_MAX];
+            FileSpec real_exe_file (target_settings_argv0, true);
+            real_exe_file.GetPath(real_exe_path, PATH_MAX);
+            target->SetArg0(real_exe_path);
+            target_settings_argv0 = target->GetArg0();
             m_options.launch_info.GetArguments().AppendArgument (target_settings_argv0);
             m_options.launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), false);
         }
Index: source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
===================================================================
--- source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
@@ -63,7 +63,12 @@
     {
         Module *exe_mod = m_process->GetTarget().GetExecutableModulePointer();
         if (exe_mod)
+        {
             exe_mod->GetFileSpec().GetPath(m_exe_path, PATH_MAX);
+            // On FreeBSD, rtld has associated a conicalized absolute pathname
+            // for the executable in the process's link_map data. 
+            FileSpec(m_exe_path, true).GetPath(m_exe_path, PATH_MAX);
+        }
     }
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2389.2.patch
Type: text/x-patch
Size: 1817 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140106/a83262e8/attachment.bin>


More information about the lldb-commits mailing list