[Lldb-commits] [PATCH] D19557: Use absolute module path when possible if sent in svr4 packets

Francis Ricci via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 26 13:35:06 PDT 2016

fjricci created this revision.
fjricci added reviewers: ovyalov, ADodds, jasonmolenda, clayborg.
fjricci added subscribers: sas, lldb-commits.

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.



Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4863,14 +4863,7 @@
         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,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19557.55083.patch
Type: text/x-patch
Size: 863 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160426/48cb1293/attachment.bin>

More information about the lldb-commits mailing list