Kill symbolization functionality in llvm-dwarfdump. We have llvm-symbolizer for that.

llvm-svn: 209152
This commit is contained in:
Alexey Samsonov 2014-05-19 18:45:32 +00:00
parent 76e1bf53b4
commit e321879709
7 changed files with 66 additions and 145 deletions

View File

@ -1,28 +0,0 @@
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-inl-test.elf-x86-64 --address=0x710 \
RUN: --inlining --functions | FileCheck %s -check-prefix DEEP_STACK
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-inl-test.elf-x86-64 --address=0x7d1 \
RUN: --inlining | FileCheck %s -check-prefix SHORTER_STACK
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-inl-test.elf-x86-64 --address=0x785 \
RUN: --inlining | FileCheck %s -check-prefix SHORT_STACK
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-inl-test.elf-x86-64 --address=0x737 \
RUN: --functions | FileCheck %s -check-prefix INL_FUNC_NAME
DEEP_STACK: inlined_h
DEEP_STACK-NEXT: dwarfdump-inl-test.h:2
DEEP_STACK-NEXT: inlined_g
DEEP_STACK-NEXT: dwarfdump-inl-test.h:7
DEEP_STACK-NEXT: inlined_f
DEEP_STACK-NEXT: dwarfdump-inl-test.cc:3
DEEP_STACK-NEXT: main
DEEP_STACK-NEXT: dwarfdump-inl-test.cc:8
SHORTER_STACK: dwarfdump-inl-test.h:7
SHORTER_STACK-NEXT: dwarfdump-inl-test.cc:3
SHORTER_STACK-NEXT: dwarfdump-inl-test.cc:8
SHORT_STACK: dwarfdump-inl-test.cc:3
SHORT_STACK-NEXT: dwarfdump-inl-test.cc:8
INL_FUNC_NAME: inlined_g
INL_FUNC_NAME-NEXT: dwarfdump-inl-test.h:7

View File

@ -0,0 +1,10 @@
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test4.elf-x86-64 | FileCheck %s
CHECK: .debug_ranges contents:
CHECK-NEXT: 00000000 000000000000062c 0000000000000637
CHECK-NEXT: 00000000 0000000000000637 000000000000063d
CHECK-NEXT: 00000000 <End of list>
CHECK-NEXT: 00000030 0000000000000640 000000000000064b
CHECK-NEXT: 00000030 0000000000000637 000000000000063d
CHECK-NEXT: 00000030 <End of list>

View File

@ -1,56 +0,0 @@
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test.elf-x86-64 \
RUN: --address=0x400559 --functions | FileCheck %s -check-prefix MAIN
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test.elf-x86-64 \
RUN: --address=0x400528 --functions | FileCheck %s -check-prefix FUNCTION
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test.elf-x86-64 \
RUN: --address=0x400586 --functions | FileCheck %s -check-prefix CTOR_WITH_SPEC
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test2.elf-x86-64 \
RUN: --address=0x4004e8 --functions | FileCheck %s -check-prefix MANY_CU_1
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test2.elf-x86-64 \
RUN: --address=0x4004f4 --functions | FileCheck %s -check-prefix MANY_CU_2
RUN: llvm-dwarfdump "%p/Inputs/dwarfdump-test3.elf-x86-64 space" \
RUN: --address=0x640 --functions | FileCheck %s -check-prefix ABS_ORIGIN_1
RUN: llvm-dwarfdump "%p/Inputs/dwarfdump-test3.elf-x86-64 space" \
RUN: --address=0x633 --functions | FileCheck %s -check-prefix INCLUDE_TEST_1
RUN: llvm-dwarfdump "%p/Inputs/dwarfdump-test3.elf-x86-64 space" \
RUN: --address=0x62d --functions | FileCheck %s -check-prefix INCLUDE_TEST_2
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test4.elf-x86-64 \
RUN: --address=0x62c --functions \
RUN: | FileCheck %s -check-prefix MANY_SEQ_IN_LINE_TABLE
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test4.elf-x86-64 \
RUN: | FileCheck %s -check-prefix DEBUG_RANGES
MAIN: main
MAIN-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16
FUNCTION: _Z1fii
FUNCTION-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:11
CTOR_WITH_SPEC: DummyClass
CTOR_WITH_SPEC-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:4
MANY_CU_1: a
MANY_CU_1-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test2-helper.cc:2
MANY_CU_2: main
MANY_CU_2-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test2-main.cc:4
ABS_ORIGIN_1: C
ABS_ORIGIN_1-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test3.cc:3
INCLUDE_TEST_1: _Z3do1v
INCLUDE_TEST_1-NEXT: /tmp/include{{[/\\]}}dwarfdump-test3-decl.h:7
INCLUDE_TEST_2: _Z3do2v
INCLUDE_TEST_2-NEXT: /tmp/dbginfo{{[/\\]}}include{{[/\\]}}dwarfdump-test3-decl2.h:1
MANY_SEQ_IN_LINE_TABLE: _Z1cv
MANY_SEQ_IN_LINE_TABLE-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test4-part1.cc:2
DEBUG_RANGES: .debug_ranges contents:
DEBUG_RANGES-NEXT: 00000000 000000000000062c 0000000000000637
DEBUG_RANGES-NEXT: 00000000 0000000000000637 000000000000063d
DEBUG_RANGES-NEXT: 00000000 <End of list>
DEBUG_RANGES-NEXT: 00000030 0000000000000640 000000000000064b
DEBUG_RANGES-NEXT: 00000030 0000000000000637 000000000000063d
DEBUG_RANGES-NEXT: 00000030 <End of list>

View File

@ -1,12 +1,6 @@
REQUIRES: zlib REQUIRES: zlib
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test-zlib.elf-x86-64 \ RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test-zlib.elf-x86-64 | FileCheck %s
RUN: | FileCheck %s -check-prefix FULLDUMP
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test-zlib.elf-x86-64 \
RUN: --address=0x400559 --functions | FileCheck %s -check-prefix MAIN
FULLDUMP: .debug_abbrev contents CHECK: .debug_abbrev contents
FULLDUMP: .debug_info contents CHECK: .debug_info contents
MAIN: main
MAIN-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test-zlib.cc:16

View File

@ -0,0 +1,7 @@
REQUIRES: zlib
RUN: echo "%p/Inputs/dwarfdump-test-zlib.elf-x86-64 0x400559" > %t.input
RUN: llvm-symbolizer < %t.input | FileCheck %s
CHECK: main
CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test-zlib.cc:16

View File

@ -1,10 +1,18 @@
RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x400559" > %t.input RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x400559" > %t.input
RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64.debuglink 0x400559" >> %t.input RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64.debuglink 0x400559" >> %t.input
RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x400436" >> %t.input RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x400436" >> %t.input
RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x400528" >> %t.input
RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x400586" >> %t.input
RUN: echo "%p/Inputs/dwarfdump-test2.elf-x86-64 0x4004e8" >> %t.input
RUN: echo "%p/Inputs/dwarfdump-test2.elf-x86-64 0x4004f4" >> %t.input
RUN: echo "%p/Inputs/dwarfdump-test4.elf-x86-64 0x62c" >> %t.input RUN: echo "%p/Inputs/dwarfdump-test4.elf-x86-64 0x62c" >> %t.input
RUN: echo "%p/Inputs/dwarfdump-inl-test.elf-x86-64 0x710" >> %t.input RUN: echo "%p/Inputs/dwarfdump-inl-test.elf-x86-64 0x710" >> %t.input
RUN: echo "%p/Inputs/dwarfdump-inl-test.elf-x86-64 0x7d1" >> %t.input
RUN: echo "%p/Inputs/dwarfdump-inl-test.elf-x86-64 0x785" >> %t.input
RUN: echo "%p/Inputs/dwarfdump-inl-test.high_pc.elf-x86-64 0x568" >> %t.input RUN: echo "%p/Inputs/dwarfdump-inl-test.high_pc.elf-x86-64 0x568" >> %t.input
RUN: echo "\"%p/Inputs/dwarfdump-test3.elf-x86-64 space\" 0x640" >> %t.input
RUN: echo "\"%p/Inputs/dwarfdump-test3.elf-x86-64 space\" 0x633" >> %t.input RUN: echo "\"%p/Inputs/dwarfdump-test3.elf-x86-64 space\" 0x633" >> %t.input
RUN: echo "\"%p/Inputs/dwarfdump-test3.elf-x86-64 space\" 0x62d" >> %t.input
RUN: echo "%p/Inputs/macho-universal 0x1f84" >> %t.input RUN: echo "%p/Inputs/macho-universal 0x1f84" >> %t.input
RUN: echo "%p/Inputs/macho-universal:i386 0x1f67" >> %t.input RUN: echo "%p/Inputs/macho-universal:i386 0x1f67" >> %t.input
RUN: echo "%p/Inputs/macho-universal:x86_64 0x100000f05" >> %t.input RUN: echo "%p/Inputs/macho-universal:x86_64 0x100000f05" >> %t.input
@ -21,6 +29,18 @@ CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16
CHECK: _start CHECK: _start
CHECK: _Z1fii
CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:11
CHECK: DummyClass
CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:4
CHECK: a
CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test2-helper.cc:2
CHECK: main
CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test2-main.cc:4
CHECK: _Z1cv CHECK: _Z1cv
CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test4-part1.cc:2 CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test4-part1.cc:2
@ -31,7 +51,19 @@ CHECK-NEXT: dwarfdump-inl-test.h:7
CHECK-NEXT: inlined_f CHECK-NEXT: inlined_f
CHECK-NEXT: dwarfdump-inl-test.cc:3 CHECK-NEXT: dwarfdump-inl-test.cc:3
CHECK-NEXT: main CHECK-NEXT: main
CHECK-NEXT: dwarfdump-inl-test.cc: CHECK-NEXT: dwarfdump-inl-test.cc:8
CHECK: inlined_g
CHECK-NEXT: dwarfdump-inl-test.h:7
CHECK-NEXT: inlined_f
CHECK-NEXT: dwarfdump-inl-test.cc:3
CHECK-NEXT: main
CHECK-NEXT: dwarfdump-inl-test.cc:8
CHECK: inlined_f
CHECK-NEXT: dwarfdump-inl-test.cc:3
CHECK-NEXT: main
CHECK-NEXT: dwarfdump-inl-test.cc:8
CHECK: inlined_h CHECK: inlined_h
CHECK-NEXT: dwarfdump-inl-test.h:3 CHECK-NEXT: dwarfdump-inl-test.h:3
@ -40,10 +72,16 @@ CHECK-NEXT: dwarfdump-inl-test.h:7
CHECK-NEXT: inlined_f CHECK-NEXT: inlined_f
CHECK-NEXT: dwarfdump-inl-test.cc:3 CHECK-NEXT: dwarfdump-inl-test.cc:3
CHECK-NEXT: main CHECK-NEXT: main
CHECK-NEXT: dwarfdump-inl-test.cc: CHECK-NEXT: dwarfdump-inl-test.cc:8
CHECK: C
CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test3.cc:3
CHECK: _Z3do1v CHECK: _Z3do1v
CHECK-NEXT: dwarfdump-test3-decl.h:7 CHECK-NEXT: /tmp/include{{[/\\]}}dwarfdump-test3-decl.h:7
CHECK: _Z3do2v
CHECK-NEXT: /tmp/dbginfo{{[/\\]}}include{{[/\\]}}dwarfdump-test3-decl2.h:1
CHECK: main CHECK: main
CHECK: _Z3inci CHECK: _Z3inci

View File

@ -38,19 +38,6 @@ static cl::list<std::string>
InputFilenames(cl::Positional, cl::desc("<input object files>"), InputFilenames(cl::Positional, cl::desc("<input object files>"),
cl::ZeroOrMore); cl::ZeroOrMore);
static cl::opt<unsigned long long>
Address("address", cl::init(-1ULL),
cl::desc("Print line information for a given address"));
static cl::opt<bool>
PrintFunctions("functions", cl::init(false),
cl::desc("Print function names as well as line information "
"for a given address"));
static cl::opt<bool>
PrintInlining("inlining", cl::init(false),
cl::desc("Print all inlined frames for a given address"));
static cl::opt<DIDumpType> static cl::opt<DIDumpType>
DumpType("debug-dump", cl::init(DIDT_All), DumpType("debug-dump", cl::init(DIDT_All),
cl::desc("Dump of debug sections:"), cl::desc("Dump of debug sections:"),
@ -78,12 +65,6 @@ DumpType("debug-dump", cl::init(DIDT_All),
clEnumValN(DIDT_StrOffsetsDwo, "str_offsets.dwo", ".debug_str_offsets.dwo"), clEnumValN(DIDT_StrOffsetsDwo, "str_offsets.dwo", ".debug_str_offsets.dwo"),
clEnumValEnd)); clEnumValEnd));
static void PrintDILineInfo(DILineInfo dli) {
if (PrintFunctions)
outs() << dli.FunctionName << "\n";
outs() << dli.FileName << ':' << dli.Line << ':' << dli.Column << '\n';
}
static void DumpInput(const StringRef &Filename) { static void DumpInput(const StringRef &Filename) {
std::unique_ptr<MemoryBuffer> Buff; std::unique_ptr<MemoryBuffer> Buff;
@ -101,35 +82,10 @@ static void DumpInput(const StringRef &Filename) {
std::unique_ptr<DIContext> DICtx(DIContext::getDWARFContext(Obj.get())); std::unique_ptr<DIContext> DICtx(DIContext::getDWARFContext(Obj.get()));
if (Address == -1ULL) {
outs() << Filename outs() << Filename
<< ":\tfile format " << Obj->getFileFormatName() << "\n\n"; << ":\tfile format " << Obj->getFileFormatName() << "\n\n";
// Dump the complete DWARF structure. // Dump the complete DWARF structure.
DICtx->dump(outs(), DumpType); DICtx->dump(outs(), DumpType);
} else {
// Print line info for the specified address.
DILineInfoSpecifier Spec(
DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath,
PrintFunctions ? DILineInfoSpecifier::FunctionNameKind::LinkageName
: DILineInfoSpecifier::FunctionNameKind::None);
if (PrintInlining) {
DIInliningInfo InliningInfo =
DICtx->getInliningInfoForAddress(Address, Spec);
uint32_t n = InliningInfo.getNumberOfFrames();
if (n == 0) {
// Print one empty debug line info in any case.
PrintDILineInfo(DILineInfo());
} else {
for (uint32_t i = 0; i < n; i++) {
DILineInfo dli = InliningInfo.getFrame(i);
PrintDILineInfo(dli);
}
}
} else {
DILineInfo dli = DICtx->getLineInfoForAddress(Address, Spec);
PrintDILineInfo(dli);
}
}
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {