Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DebugInfo] Fix /usr/lib/debug llvm-symbolizer lookup with relative p…
…aths Summary: rL189250 added a realpath call, and rL352916 because realpath breaks assumptions with some build systems. However, the /usr/lib/debug case has been clarified, falling back to /usr/lib/debug is currently broken if the obj passed in is a relative path. Adding a call to use absolute paths when falling back to /usr/lib/debug fixes that while still not making any realpath assumptions. This also adds a --fallback-debug-path command line flag for testing (since we probably can't write to /usr/lib/debug from buildbot environments), but was also verified manually: ``` $ rm -f path/to/dwarfdump-test.elf-x86-64 $ strace llvm-symbolizer --obj=relative/path/to/dwarfdump-test.elf-x86-64.debuglink 0x40113f |& grep dwarfdump ``` Lookups went to relative/path/to/dwarfdump-test.elf-x86-64, relative/path/to/.debug/dwarfdump-test.elf-x86-64, and then finally /usr/lib/debug/absolute/path/to/dwarfdump-test.elf-x86-64. Reviewers: dblaikie, samsonov Reviewed By: dblaikie Subscribers: krytarowski, aprantl, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57916 llvm-svn: 353730
- Loading branch information
Showing
4 changed files
with
51 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# REQUIRES: shell | ||
# Ensures that .debuglink can fallback to a separate location. This is normally | ||
# /usr/lib/debug (or /usr/libdata/debug for NetBSD), but can be configured on | ||
# the command line (mainly for testing). | ||
|
||
RUN: rm -rf %t/foo %t/bar | ||
RUN: mkdir -p %t/foo %t/bar/%t/foo | ||
|
||
RUN: cp %p/Inputs/dwarfdump-test.elf-x86-64.debuglink %t/foo | ||
|
||
RUN: llvm-symbolizer --obj=%t/foo/dwarfdump-test.elf-x86-64.debuglink 0x40113f \ | ||
RUN: --fallback-debug-path=%t/bar | FileCheck %s --check-prefix=UNKNOWN | ||
|
||
UNKNOWN: main | ||
UNKNOWN-NEXT: ??:0:0 | ||
|
||
RUN: cp %p/Inputs/dwarfdump-test.elf-x86-64 %t/bar/%t/foo | ||
RUN: llvm-symbolizer --obj=%t/foo/dwarfdump-test.elf-x86-64.debuglink 0x40113f \ | ||
RUN: --fallback-debug-path=%t/bar | FileCheck %s --check-prefix=FOUND | ||
|
||
FOUND: main | ||
FOUND-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters