Skip to content

Commit 7257d28

Browse files
committedFeb 25, 2015
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 llvm-svn: 230476
1 parent 472041f commit 7257d28

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed
 

‎lldb/source/Host/common/Symbols.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Symbols::LocateExecutableSymbolFile (const ModuleSpec &module_spec)
8787
const std::string &filename = files[idx_file];
8888
FileSpec file_spec (filename.c_str(), true);
8989

90-
if (file_spec == module_spec.GetFileSpec())
90+
if (llvm::sys::fs::equivalent (file_spec.GetPath(), module_spec.GetFileSpec().GetPath()))
9191
continue;
9292

9393
if (file_spec.Exists())

‎lldb/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ def noreturn_unwind_tests (self):
4444
thread = process.GetThreadAtIndex(0)
4545
abort_frame_number = 0
4646
for f in thread.frames:
47-
if f.GetFunctionName() == "abort":
47+
# We use endswith() to look for abort() since some C libraries mangle the symbol into
48+
# __GI_abort or similar.
49+
if f.GetFunctionName().endswith("abort"):
4850
break
4951
abort_frame_number = abort_frame_number + 1
5052

0 commit comments

Comments
 (0)
Please sign in to comment.