forked from OSchip/llvm-project
llvm-xray {convert,extract}: Add --demangle
No demangling may be a better default in the future. Add `--demangle` for migration convenience. Reviewed By: Enna1 Differential Revision: https://reviews.llvm.org/D108100
This commit is contained in:
parent
e4ebfb5786
commit
9b96b0865d
|
@ -3,6 +3,7 @@
|
|||
|
||||
# RUN: yaml2obj %S/Inputs/elf64-pic.yaml -o %t.so
|
||||
# RUN: llvm-xray extract %t.so -s | FileCheck %s
|
||||
# RUN: llvm-xray extract %t.so --no-demangle --demangle -s | FileCheck %s
|
||||
|
||||
# CHECK: ---
|
||||
# CHECK-NEXT: - { id: 1, address: 0x420, function: 0x420, kind: function-enter, always-instrument: true, function-name: 'foo()' }
|
||||
|
@ -14,6 +15,7 @@
|
|||
# CHECK-NEXT: ...
|
||||
|
||||
# RUN: llvm-xray extract -s --no-demangle %t.so | FileCheck --check-prefix=MANGLED %s
|
||||
# RUN: llvm-xray extract -s --demangle --no-demangle %t.so | FileCheck --check-prefix=MANGLED %s
|
||||
|
||||
# MANGLED: ---
|
||||
# MANGLED-NEXT: - { id: 1, address: 0x420, function: 0x420, kind: function-enter, always-instrument: true, function-name: _Z3foov }
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; RUN: llvm-xray convert -m %S/Inputs/elf64-sample-o2.bin -y %S/Inputs/naive-log-simple.xray -f yaml -o - 2>&1 | FileCheck %s
|
||||
; RUN: llvm-xray convert -m %S/Inputs/elf64-sample-o2.bin -y %S/Inputs/naive-log-simple.xray -f yaml 2>&1 | FileCheck %s
|
||||
; RUN: llvm-xray convert -m %S/Inputs/elf64-sample-o2.bin -y %S/Inputs/naive-log-simple.xray -f yaml --demangle 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: ---
|
||||
; CHECK-NEXT: header:
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
; RUN: llvm-xray extract %S/Inputs/elf64-pie.bin -s | FileCheck %s
|
||||
|
||||
; CHECK: ---
|
||||
; CHECK-NEXT: - { id: 1, address: 0x299C0, function: 0x299C0, kind: function-enter, always-instrument: true, function-name: {{.*foo.*}} }
|
||||
; CHECK-NEXT: - { id: 1, address: 0x299D0, function: 0x299C0, kind: function-exit, always-instrument: true, function-name: {{.*foo.*}} }
|
||||
; CHECK-NEXT: - { id: 2, address: 0x299E0, function: 0x299E0, kind: function-enter, always-instrument: true, function-name: {{.*bar.*}} }
|
||||
; CHECK-NEXT: - { id: 2, address: 0x299F6, function: 0x299E0, kind: function-exit, always-instrument: true, function-name: {{.*bar.*}} }
|
||||
; CHECK-NEXT: - { id: 1, address: 0x299C0, function: 0x299C0, kind: function-enter, always-instrument: true, function-name: 'foo()' }
|
||||
; CHECK-NEXT: - { id: 1, address: 0x299D0, function: 0x299C0, kind: function-exit, always-instrument: true, function-name: 'foo()' }
|
||||
; CHECK-NEXT: - { id: 2, address: 0x299E0, function: 0x299E0, kind: function-enter, always-instrument: true, function-name: 'bar()' }
|
||||
; CHECK-NEXT: - { id: 2, address: 0x299F6, function: 0x299E0, kind: function-exit, always-instrument: true, function-name: 'bar()' }
|
||||
; CHECK-NEXT: ...
|
||||
|
|
|
@ -63,6 +63,10 @@ static cl::opt<bool>
|
|||
"when symbolizing function ids from the input log"),
|
||||
cl::init(false), cl::sub(Convert));
|
||||
|
||||
static cl::opt<bool> Demangle("demangle",
|
||||
cl::desc("demangle symbols (default)"),
|
||||
cl::sub(Convert));
|
||||
|
||||
static cl::opt<std::string>
|
||||
ConvertInstrMap("instr_map",
|
||||
cl::desc("binary with the instrumentation map, or "
|
||||
|
@ -379,7 +383,7 @@ static CommandRegistration Unused(&Convert, []() -> Error {
|
|||
|
||||
const auto &FunctionAddresses = Map.getFunctionAddresses();
|
||||
symbolize::LLVMSymbolizer::Options SymbolizerOpts;
|
||||
if (NoDemangle)
|
||||
if (Demangle.getPosition() < NoDemangle.getPosition())
|
||||
SymbolizerOpts.Demangle = false;
|
||||
symbolize::LLVMSymbolizer Symbolizer(SymbolizerOpts);
|
||||
llvm::xray::FuncIdConversionHelper FuncIdHelper(ConvertInstrMap, Symbolizer,
|
||||
|
|
|
@ -45,11 +45,12 @@ static cl::opt<bool> ExtractSymbolize("symbolize", cl::value_desc("symbolize"),
|
|||
cl::sub(Extract));
|
||||
static cl::alias ExtractSymbolize2("s", cl::aliasopt(ExtractSymbolize),
|
||||
cl::desc("alias for -symbolize"));
|
||||
static cl::opt<bool> ExtractNoDemangle("no-demangle",
|
||||
cl::value_desc("no-demangle"),
|
||||
cl::init(false),
|
||||
cl::desc("don't demangle symbols"),
|
||||
cl::sub(Extract));
|
||||
static cl::opt<bool> Demangle("demangle",
|
||||
cl::desc("demangle symbols (default)"),
|
||||
cl::sub(Extract));
|
||||
static cl::opt<bool> NoDemangle("no-demangle",
|
||||
cl::desc("don't demangle symbols"),
|
||||
cl::sub(Extract));
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -90,7 +91,7 @@ static CommandRegistration Unused(&Extract, []() -> Error {
|
|||
const auto &FunctionAddresses =
|
||||
InstrumentationMapOrError->getFunctionAddresses();
|
||||
symbolize::LLVMSymbolizer::Options opts;
|
||||
if (ExtractNoDemangle)
|
||||
if (Demangle.getPosition() < NoDemangle.getPosition())
|
||||
opts.Demangle = false;
|
||||
symbolize::LLVMSymbolizer Symbolizer(opts);
|
||||
llvm::xray::FuncIdConversionHelper FuncIdHelper(ExtractInput, Symbolizer,
|
||||
|
|
Loading…
Reference in New Issue