[llvm] r313463 - llvm-dwarfdump: Add support for -debug-types=<offset>.
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 16 09:58:18 PDT 2017
Author: adrian
Date: Sat Sep 16 09:58:18 2017
New Revision: 313463
URL: http://llvm.org/viewvc/llvm-project?rev=313463&view=rev
Log:
llvm-dwarfdump: Add support for -debug-types=<offset>.
Added:
llvm/trunk/test/tools/llvm-dwarfdump/X86/debug_type_offset.test
Modified:
llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp?rev=313463&r1=313462&r2=313463&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp Sat Sep 16 09:58:18 2017
@@ -270,19 +270,22 @@ void DWARFContext::dump(
dumpDebugInfo(ExplicitDWO, ".debug_info.dwo", DObj->getInfoDWOSection(),
dwo_compile_units());
- if ((DumpType & DIDT_DebugTypes)) {
- if (Explicit || getNumTypeUnits()) {
- OS << "\n.debug_types contents:\n";
- for (const auto &TUS : type_unit_sections())
- for (const auto &TU : TUS)
+ auto dumpDebugType = [&](const char *Name,
+ tu_section_iterator_range TUSections) {
+ OS << '\n' << Name << " contents:\n";
+ DumpOffset = DumpOffsets[DIDT_ID_DebugTypes];
+ for (const auto &TUS : TUSections)
+ for (const auto &TU : TUS)
+ if (DumpOffset)
+ TU->getDIEForOffset(*DumpOffset).dump(OS, 0);
+ else
TU->dump(OS, DumpOpts);
- }
- if (ExplicitDWO || getNumDWOTypeUnits()) {
- OS << "\n.debug_types.dwo contents:\n";
- for (const auto &DWOTUS : dwo_type_unit_sections())
- for (const auto &DWOTU : DWOTUS)
- DWOTU->dump(OS, DumpOpts);
- }
+ };
+ if ((DumpType & DIDT_DebugTypes)) {
+ if (Explicit || getNumTypeUnits())
+ dumpDebugType(".debug_types", type_unit_sections());
+ if (ExplicitDWO || getNumDWOTypeUnits())
+ dumpDebugType(".debug_types.dwo", dwo_type_unit_sections());
}
if (shouldDump(Explicit, ".debug_loc", DIDT_ID_DebugLoc,
Added: llvm/trunk/test/tools/llvm-dwarfdump/X86/debug_type_offset.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwarfdump/X86/debug_type_offset.test?rev=313463&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-dwarfdump/X86/debug_type_offset.test (added)
+++ llvm/trunk/test/tools/llvm-dwarfdump/X86/debug_type_offset.test Sat Sep 16 09:58:18 2017
@@ -0,0 +1,8 @@
+RUN: llvm-mc %S/../../../DebugInfo/Inputs/typeunit-header.s -filetype obj \
+RUN: -triple x86_64-unknown-elf -o - \
+RUN: | llvm-dwarfdump -debug-types=0x00000019 - | FileCheck %s
+CHECK: .debug_types contents:
+:CHECK-NOT: {{:}}
+CHECK: 0x00000019: DW_TAG_structure_type
+CHECK: DW_AT_visibility
+CHECK-NOT: {{:}}
More information about the llvm-commits
mailing list