[llvm-branch-commits] [lldb] r270140 - Use absolute module path when possible if sent in svr4 packets

Francis Ricci via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu May 19 14:11:37 PDT 2016

Author: fjricci
Date: Thu May 19 16:11:37 2016
New Revision: 270140

URL: http://llvm.org/viewvc/llvm-project?rev=270140&view=rev
Use absolute module path when possible if sent in svr4 packets

If the remote uses svr4 packets to communicate library info,
the LoadUnload tests will fail, as lldb only used the basename
for modules, causing problems when two modules have the same basename.

Using absolute path as sent by the remote will ensure that lldb
locates the module from the correct directory when there are overlapping
basenames. When debugging a remote process, LoadModuleAtAddress will still
fall back to using basename and module_search_paths, so we don't
need to worry about using absolute paths in this case.

Reviewers: ADodds, jasonmolenda, clayborg, ovyalov

Subscribers: lldb-commits, sas

Differential Revision: http://reviews.llvm.org/D19557

This is a cherry-pick of r267741


Modified: lldb/branches/release_38/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_38/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=270140&r1=270139&r2=270140&view=diff
--- lldb/branches/release_38/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/branches/release_38/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu May 19 16:11:37 2016
@@ -4835,14 +4835,7 @@ ProcessGDBRemote::LoadModules (LoadedMod
         if (!modInfo.get_link_map (link_map))
             link_map = LLDB_INVALID_ADDRESS;
-        // hack (cleaner way to get file name only?) (win/unix compat?)
-        size_t marker = mod_name.rfind ('/');
-        if (marker == std::string::npos)
-            marker = 0;
-        else
-            marker += 1;
-        FileSpec file (mod_name.c_str()+marker, true);
+        FileSpec file (mod_name.c_str(), true);
         lldb::ModuleSP module_sp = LoadModuleAtAddress (file, link_map, mod_base,

More information about the llvm-branch-commits mailing list