forked from OSchip/llvm-project
llvm-dwarfdump: honor the --show-children option when dumping a specific DIE.
llvm-svn: 319271
This commit is contained in:
parent
3f71c0e3ee
commit
5da51f435a
|
@ -488,7 +488,7 @@ void DWARFDie::dump(raw_ostream &OS, unsigned Indent,
|
|||
}
|
||||
|
||||
DWARFDie child = getFirstChild();
|
||||
if (DumpOpts.RecurseDepth > 0 && child) {
|
||||
if (DumpOpts.ShowChildren && DumpOpts.RecurseDepth > 0 && child) {
|
||||
DumpOpts.RecurseDepth--;
|
||||
while (child) {
|
||||
child.dump(OS, Indent + 2, DumpOpts);
|
||||
|
|
|
@ -61,3 +61,9 @@ RUN: | FileCheck %s --check-prefix=MULTI
|
|||
RUN: llvm-dwarfdump %S/../../dsymutil/Inputs/libfat-test.a \
|
||||
RUN: -x -name=.*86.*_var \
|
||||
RUN: | FileCheck %s --check-prefix=MULTI
|
||||
|
||||
Test the -show-children behavior.
|
||||
RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
|
||||
RUN: | llvm-dwarfdump -name="brief.c" - | FileCheck %s -check-prefix=NOCHILDREN
|
||||
NOCHILDREN: DW_AT_name ("brief.c")
|
||||
NOCHILDREN-NOT: DW_TAG
|
||||
|
|
|
@ -536,14 +536,17 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
raw_ostream &OS = OutputFile ? OutputFile->os() : outs();
|
||||
bool OffsetRequested = false;
|
||||
|
||||
// Defaults to dumping all sections, unless brief mode is specified in which
|
||||
// case only the .debug_info section in dumped.
|
||||
#define HANDLE_DWARF_SECTION(ENUM_NAME, ELF_NAME, CMDLINE_NAME) \
|
||||
if (Dump##ENUM_NAME.IsRequested) { \
|
||||
DumpType |= DIDT_##ENUM_NAME; \
|
||||
if (Dump##ENUM_NAME.HasValue) \
|
||||
if (Dump##ENUM_NAME.HasValue) { \
|
||||
DumpOffsets[DIDT_ID_##ENUM_NAME] = Dump##ENUM_NAME.Val; \
|
||||
OffsetRequested = true; \
|
||||
} \
|
||||
}
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
#undef HANDLE_DWARF_SECTION
|
||||
|
@ -558,6 +561,10 @@ int main(int argc, char **argv) {
|
|||
DumpType = DIDT_DebugInfo;
|
||||
}
|
||||
|
||||
// Unless dumping a specific DIE, default to --show-children.
|
||||
if (!ShowChildren && !Verify && !OffsetRequested && Name.empty() && Find.empty())
|
||||
ShowChildren = true;
|
||||
|
||||
// Defaults to a.out if no filenames specified.
|
||||
if (InputFilenames.size() == 0)
|
||||
InputFilenames.push_back("a.out");
|
||||
|
|
Loading…
Reference in New Issue