[Lldb-commits] [PATCH] Patch for pr17880 - main module gets base	address added again to symbols on FreeBSD
    John Wolfe 
    jlw at xinuos.com
       
    Wed Dec 11 14:41:48 PST 2013
    
    
  
Hi emaste,
Insure that the executable path name used in the DYLDRendezvous class can be identically matched to the executable name (if provided, as in FreeBSD) in the inferior's link_map.
http://llvm-reviews.chandlerc.com/D2389
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.1.patch
Type: text/x-patch
Size: 1818 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20131211/8ec7994b/attachment.bin>
    
    
More information about the lldb-commits
mailing list