unsigned RecurseDepth = -1U;
bool ShowChildren = false;
bool ShowParents = false;
+ bool ShowForm = false;
bool SummarizeTypes = false;
bool Verbose = false;
else
WithColor(OS, syntax::Attribute).get() << format("DW_AT_Unknown_%x", Attr);
- if (DumpOpts.Verbose) {
+ if (DumpOpts.Verbose || DumpOpts.ShowForm) {
auto formString = FormEncodingString(Form);
if (!formString.empty())
OS << " [" << formString << ']';
--- /dev/null
+# This test verifies that DWARF form types are printed in verbose mode and when
+# passing -F but not in brief mode.
+
+# RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
+# RUN: | llvm-dwarfdump -v --debug-info - \
+# RUN: | FileCheck %s
+
+# RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
+# RUN: | llvm-dwarfdump -F --debug-info - \
+# RUN: | FileCheck %s
+
+# RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
+# RUN: | llvm-dwarfdump --debug-info - \
+# RUN: | FileCheck %s --check-prefix NO-FORM
+
+# CHECK: DW_TAG_compile_unit
+# CHECK: DW_AT_producer [DW_FORM_strp]
+# CHECK: DW_AT_language [DW_FORM_data2]
+# CHECK: DW_AT_name [DW_FORM_strp]
+# CHECK: DW_AT_stmt_list [DW_FORM_sec_offset]
+# CHECK: DW_AT_comp_dir [DW_FORM_strp]
+# CHECK: DW_AT_low_pc [DW_FORM_addr]
+# CHECK: DW_AT_high_pc [DW_FORM_data4]
+
+# CHECK: DW_TAG_subprogram
+# CHECK: DW_AT_low_pc [DW_FORM_addr]
+# CHECK: DW_AT_high_pc [DW_FORM_data4]
+# CHECK: DW_AT_frame_base [DW_FORM_exprloc]
+# CHECK: DW_AT_name [DW_FORM_strp]
+# CHECK: DW_AT_decl_file [DW_FORM_data1]
+# CHECK: DW_AT_decl_line [DW_FORM_data1]
+# CHECK: DW_AT_type [DW_FORM_ref4]
+# CHECK: DW_AT_external [DW_FORM_flag_present]
+
+# CHECK: DW_TAG_base_type
+# CHECK: DW_AT_name [DW_FORM_strp]
+# CHECK: DW_AT_encoding [DW_FORM_data1]
+# CHECK: DW_AT_byte_size [DW_FORM_data1]
+
+# NO-FORM-NOT: DW_FORM_
HELP: Specific Options
HELP: -find
HELP: -name
-HELP: -recurse-depth=<N>
+HELP: -recurse-depth=<N>
HELP: -show-children
+HELP: -show-form
HELP: -show-parents
HELP: -summarize-types
HELP-NOT: -reverse-iterate
cat(DwarfDumpCategory));
static alias ShowParentsAlias("p", desc("Alias for -show-parents"),
aliasopt(ShowParents));
+static opt<bool>
+ ShowForm("show-form",
+ desc("Show DWARF form types after the DWARF attribute types."),
+ cat(DwarfDumpCategory));
+static alias ShowFormAlias("F", desc("Alias for -show-form"),
+ aliasopt(ShowForm), cat(DwarfDumpCategory));
static opt<unsigned> RecurseDepth(
"recurse-depth",
desc("Only recurse to a depth of N when displaying debug info entries."),
cat(DwarfDumpCategory), init(-1U), value_desc("N"));
static alias RecurseDepthAlias("r", desc("Alias for -recurse-depth"),
aliasopt(RecurseDepth));
-
+
static opt<bool>
SummarizeTypes("summarize-types",
desc("Abbreviate the description of type unit entries"),
DumpOpts.RecurseDepth = RecurseDepth;
DumpOpts.ShowChildren = ShowChildren;
DumpOpts.ShowParents = ShowParents;
+ DumpOpts.ShowForm = ShowForm;
DumpOpts.SummarizeTypes = SummarizeTypes;
DumpOpts.Verbose = Verbose;
// In -verify mode, print DIEs without children in error messages.
StringSet<> Names;
for (auto name : Name)
Names.insert(name);
-
+
filterByName(Names, DICtx.compile_units(), OS);
filterByName(Names, DICtx.dwo_compile_units(), OS);
return true;
if (!DumpOffsets[DIDT_ID_DebugInfo])
return true;
}
-
+
// Dump the complete DWARF structure.
DICtx.dump(OS, getDumpOpts(), DumpOffsets);
return true;