[PATCH] D76733: New symbolizer option to print files relative to the compilation directory.
Sterling Augustine via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 24 17:30:19 PDT 2020
saugustine updated this revision to Diff 252458.
saugustine added a comment.
Remove short option. It only existed to be parallel to "-s", but conflicts
with options in gnu addr2line.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76733/new/
https://reviews.llvm.org/D76733
Files:
llvm/test/tools/llvm-symbolizer/relativenames.s
llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
Index: llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
===================================================================
--- llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
+++ llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
@@ -77,6 +77,11 @@
static cl::alias ClBasenamesShort("s", cl::desc("Alias for -basenames"),
cl::NotHidden, cl::aliasopt(ClBasenames));
+// -relativenames
+static cl::opt<bool> ClRelativenames("relativenames", cl::init(false),
+ cl::desc("Strip the compilation directory from paths"));
+// Gnu addr2line uses -r for something else. No need for a short option.
+
// -demangle, -C, -no-demangle
static cl::opt<bool>
ClDemangle("demangle", cl::init(true), cl::desc("Demangle function names"));
@@ -310,8 +315,12 @@
Opts.DWPName = ClDwpName;
Opts.DebugFileDirectory = ClDebugFileDirectory;
Opts.PathStyle = DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath;
- if (ClBasenames)
+ // If both --basenames and --relativenames are specified then pick the last
+ // one.
+ if (ClBasenames.getPosition() > ClRelativenames.getPosition())
Opts.PathStyle = DILineInfoSpecifier::FileLineInfoKind::BaseNameOnly;
+ else if (ClRelativenames)
+ Opts.PathStyle = DILineInfoSpecifier::FileLineInfoKind::RelativeFilePath;
for (const auto &hint : ClDsymHint) {
if (sys::path::extension(hint) == ".dSYM") {
Index: llvm/test/tools/llvm-symbolizer/relativenames.s
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-symbolizer/relativenames.s
@@ -0,0 +1,9 @@
+# REQUIRES: x86-registered-target
+
+foo:
+ nop
+
+# RUN: llvm-mc --filetype=obj --triple=x86_64-pc-linux %s -o %t.o -g
+# RUN: llvm-symbolizer 0 --relativenames --obj=%t.o | FileCheck %s -DDIR=%p
+
+# CHECK: [[DIR]]{{\\|/}}relativenames.s:4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76733.252458.patch
Type: text/x-patch
Size: 1872 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200325/4855f03c/attachment.bin>
More information about the llvm-commits
mailing list