[Lldb-commits] [lldb] r230476 - Skip symlinks to the original file when searching for debug info

Pavel Labath labath at google.com
Wed Feb 25 02:44:36 PST 2015


Author: labath
Date: Wed Feb 25 04:44:35 2015
New Revision: 230476

URL: http://llvm.org/viewvc/llvm-project?rev=230476&view=rev
Log:
Skip symlinks to the original file when searching for debug info

Summary:
Symbols::LocateExecutableSymbolFile tries to locate the file in containing the debug info in a
splitdebug configuration. It tries to skip over the original file in its search path, but it was
easily fooled by symlinks. This changes the function to use llvm::sys::fs::equivalent, which can
correctly compare symlinks.

As a side effect, I had to fix one test because the address for the "abort" function resolves on
my system to "__GI_abort" now. With the debug info, the libc on my system contains two symbols
associated with the address of the abort function, and lldb prefers __GI_abort, possibly because
the debug info is associated with it. It would be nice at some point to have it prefer the public
symbol name.

Reviewers: emaste, zturner

Subscribers: lldb-commits

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

Modified:
    lldb/trunk/source/Host/common/Symbols.cpp
    lldb/trunk/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py

Modified: lldb/trunk/source/Host/common/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Symbols.cpp?rev=230476&r1=230475&r2=230476&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Symbols.cpp (original)
+++ lldb/trunk/source/Host/common/Symbols.cpp Wed Feb 25 04:44:35 2015
@@ -87,7 +87,7 @@ Symbols::LocateExecutableSymbolFile (con
             const std::string &filename = files[idx_file];
             FileSpec file_spec (filename.c_str(), true);
 
-            if (file_spec == module_spec.GetFileSpec())
+            if (llvm::sys::fs::equivalent (file_spec.GetPath(), module_spec.GetFileSpec().GetPath()))
                 continue;
 
             if (file_spec.Exists())

Modified: lldb/trunk/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py?rev=230476&r1=230475&r2=230476&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py (original)
+++ lldb/trunk/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py Wed Feb 25 04:44:35 2015
@@ -44,7 +44,9 @@ class NoreturnUnwind(TestBase):
         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
 





More information about the lldb-commits mailing list