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);
+        }
     }
 }
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);
+        }
     }
 }
 
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to