Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DWARFDump] Make --verify handle all sections by default #81559

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion llvm/test/DebugInfo/X86/dwarfdump-str-offsets.s
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
# RUN: llvm-dwarfdump -v %t.o 2> %t.err | FileCheck --check-prefixes=COMMON,SPLIT,OFFSETS %s
# RUN: llvm-dwarfdump -verify %t.o | FileCheck --check-prefix=VERIFY %s

# FIXME: the verifier does not accept padding between debug-str-offset
# sections, which this test uses.
# RUN: llvm-dwarfdump -verify --debug-info %t.o | FileCheck --check-prefix=VERIFY %s
# RUN: llvm-dwarfdump -debug-str-offsets %t.o | FileCheck --check-prefix=OFFSETS %s
#
# Check that we don't report an error on a non-existent range list table.
Expand Down
2 changes: 2 additions & 0 deletions llvm/test/DebugInfo/X86/skeleton-unit-verify.s
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# CHECK-NEXT: DW_TAG_skeleton_unit
# CHECK-NEXT: error: Skeleton compilation unit has children.
# CHECK-NEXT: Verifying dwo Units...
# CHECK-NEXT: Verifying .debug_line...
# CHECK-NEXT: Verifying .debug_str_offsets...
# CHECK-NEXT: Errors detected.

.section .debug_abbrev,"",@progbits
Expand Down
2 changes: 2 additions & 0 deletions llvm/test/tools/llvm-dwarfdump/X86/verify_file_encoding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
# CHECK-NEXT: DW_AT_call_file [DW_FORM_sdata] (4)
# CHECK-NEXT: DW_AT_call_line [DW_FORM_sdata] (5){{[[:space:]]}}
# CHECK-NEXT: Verifying dwo Units...
# CHECK-NEXT: Verifying .debug_line...
# CHECK-NEXT: Verifying .debug_str_offsets...
# CHECK-NEXT: error: Aggregated error counts:
# CHECK-NEXT: error: Invalid encoding in DW_AT_decl_file occurred 4 time(s).
# CHECK-NEXT: error: Invalid file index in DW_AT_call_line occurred 1 time(s).
Expand Down
7 changes: 5 additions & 2 deletions llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-macro.test
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,15 @@

## Check that macro table preserved during simple copying.
#
# FIXME: the input of this test is itself invalid w.r.t. debug_str_offsets,
# which also causes the next two calls to --verify to fail, so we only verify
# debug_info on those.
#RUN: llvm-dwarfutil --no-garbage-collection %p/Inputs/dwarf5-macro.out %t1
#RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
#RUN: llvm-dwarfdump -verify --debug-info %t1 | FileCheck %s
#RUN: llvm-dwarfdump -a %t1 | FileCheck %s --check-prefix=MACRO

#RUN: llvm-dwarfutil --linker parallel --no-garbage-collection %p/Inputs/dwarf5-macro.out %t1
#RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
#RUN: llvm-dwarfdump -verify %t1 --debug-info | FileCheck %s
#RUN: llvm-dwarfdump -a %t1 | FileCheck %s --check-prefix=MACRO

## Check that macro table preserved during updating accelerator tables.
Expand Down
3 changes: 2 additions & 1 deletion llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,8 @@ int main(int argc, char **argv) {
if (Verbose)
DumpType = DIDT_All;
else
DumpType = DIDT_DebugInfo;
// If no options are passed, verify everything but dump only debug_info.
Copy link
Member

@JDevlieghere JDevlieghere Feb 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this comment is slightly ambiguous. I think you can sidestep it by using an else if so it looks symmetrical with the verbose dumping.

if (Verbose)
  DumpType = DIDT_All;
else if(Verify)
  DumpType = DIDT_All;
else 
  DumpType = DIDT_DebugInfo;

or maybe even simpler:

if (Verbose || Verify)
  DumpType = DIDT_All;
else 
  DumpType = DIDT_DebugInfo;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, good point! I like your second suggestion.

DumpType = Verify ? DIDT_All : DIDT_DebugInfo;
}

// Unless dumping a specific DIE, default to --show-children.
Expand Down
Loading