[Lldb-commits] [PATCH] Reorder debug symbol search path on linux

Pavel Labath labath at google.com
Thu Feb 12 09:01:33 PST 2015


Hi vharron,

lldb was failing to locate the split debug symbols for libc. The previous search order was:
- the directory containing the original library
- the current directory
- /usr/lib/debug
This was failing to locate the debug symbols for libc (at least on my machine), because the
.gnu_debuglink for libc (libc.so.6) was "libc-2.19.so". However, libc.so.6 itself is a symlink to
libc-2.19.so, located in the same directory. This meant that under the default search path lldb
would locate the same file, which obviously provides no new information. Moving the module
directory to the last place in the search path allows lldb to correctly locate the debug version
of libc under /usr/lib/debug and indeed makes additional information visible in lldb output.

If the user has a newer version of debug symbols in the library directory than those in
/usr/lib/debug (perhaps because he is working on the library), then those should get picked up
anyway, because the newer library should have a different UUID.

http://reviews.llvm.org/D7595

Files:
  source/Host/common/Symbols.cpp
  test/functionalities/unwind/noreturn/TestNoreturnUnwind.py

Index: source/Host/common/Symbols.cpp
===================================================================
--- source/Host/common/Symbols.cpp
+++ source/Host/common/Symbols.cpp
@@ -40,16 +40,16 @@
 
     FileSpecList debug_file_search_paths (Target::GetDefaultDebugFileSearchPaths());
 
-    // Add module directory.
-    const ConstString &file_dir = module_spec.GetFileSpec().GetDirectory();
-    debug_file_search_paths.AppendIfUnique (FileSpec(file_dir.AsCString("."), true));
-
     // Add current working directory.
     debug_file_search_paths.AppendIfUnique (FileSpec(".", true));
 
     // Add /usr/lib/debug directory.
     debug_file_search_paths.AppendIfUnique (FileSpec("/usr/lib/debug", true));
 
+    // Add module directory.
+    const ConstString &file_dir = module_spec.GetFileSpec().GetDirectory();
+    debug_file_search_paths.AppendIfUnique (FileSpec(file_dir.AsCString("."), true));
+
     std::string uuid_str;
     const UUID &module_uuid = module_spec.GetUUID();
     if (module_uuid.IsValid())
Index: test/functionalities/unwind/noreturn/TestNoreturnUnwind.py
===================================================================
--- test/functionalities/unwind/noreturn/TestNoreturnUnwind.py
+++ test/functionalities/unwind/noreturn/TestNoreturnUnwind.py
@@ -44,7 +44,9 @@
         thread = process.GetThreadAtIndex(0)
         abort_frame_number = 0
         for f in thread.frames:
-            if f.GetFunctionName() == "abort":
+            # We use endswith() to look for abort() since some C libraries mangle the symbol into
+            # __GI_abort or similar.
+            if f.GetFunctionName().endswith("abort"):
                 break
             abort_frame_number = abort_frame_number + 1

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7595.19838.patch
Type: text/x-patch
Size: 1730 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150212/a130700f/attachment.bin>


More information about the lldb-commits mailing list