-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[llvm][dwarfdump] Add --child-tags option to filter by DWARF tags #165720
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9f93f7a
[llvm][dwarfdump] Add --child-tags option to filter by DWARF tags
Michael137 5ab9513
fixup! add test
Michael137 3d92747
fixup! rename option
Michael137 c03d995
fixup! SmallVector size to 0
Michael137 9c9a459
fixup! update docs
Michael137 30da832
fixup! re-order DIDumpOptions member
Michael137 8f711d2
fixup! fix test comment
Michael137 ae5adf8
fixup! make tests more readable
Michael137 60b7523
fixup! remove redundant comments
Michael137 f912b46
fixup! adjust codeblock in docs
Michael137 e42f202
fixup! don't error on incompatible flag
Michael137 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
llvm/test/tools/llvm-dwarfdump/X86/filter-child-tag.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| ## Tests the --filter-child-tag (-t) option. | ||
|
|
||
| # RUN: yaml2obj %s -o %t.o | ||
|
|
||
| # RUN: llvm-dwarfdump %t.o --filter-child-tag=DW_TAG_structure_type | FileCheck %s --check-prefix=ONLY_STRUCT | ||
|
|
||
| # ONLY_STRUCT: DW_TAG_compile_unit | ||
| # ONLY_STRUCT-NOT: DW_TAG_namespace | ||
| # ONLY_STRUCT-NOT: DW_TAG_structure_type | ||
|
|
||
| # RUN: llvm-dwarfdump %t.o -t DW_TAG_structure_type -t DW_TAG_namespace | \ | ||
| # RUN: FileCheck %s --check-prefix=STRUCT_AND_NS --implicit-check-not=DW_TAG_subprogram --implicit-check-not=DW_TAG_member | ||
|
|
||
| # STRUCT_AND_NS: DW_TAG_compile_unit | ||
| # STRUCT_AND_NS: DW_TAG_namespace | ||
| # STRUCT_AND_NS: DW_TAG_structure_type | ||
| # STRUCT_AND_NS: DW_TAG_structure_type | ||
|
|
||
| # RUN: llvm-dwarfdump %t.o -c --name=Foo -t DW_TAG_member | \ | ||
| # RUN: FileCheck %s --check-prefix=FOO_MEM --implicit-check-not=DW_TAG_compile_unit --implicit-check-not=DW_TAG_subprogram --implicit-check-not=DW_TAG_namespace | ||
|
|
||
| # FOO_MEM: DW_TAG_structure_type | ||
| # FOO_MEM: DW_TAG_member | ||
| # FOO_MEM: DW_TAG_member | ||
| # FOO_MEM: DW_TAG_member | ||
| # FOO_MEM-NOT: DW_TAG_structure_type | ||
| # FOO_MEM-NOT: DW_TAG_member | ||
|
|
||
| # RUN: llvm-dwarfdump %t.o -c --name=Foo -t not_a_tag -t DW_TAG_member | \ | ||
| # RUN: FileCheck %s --check-prefix=SINGLE_INVALID_TAG --implicit-check-not=DW_TAG_compile_unit --implicit-check-not=DW_TAG_subprogram --implicit-check-not=DW_TAG_namespace | ||
|
|
||
| # SINGLE_INVALID_TAG: DW_TAG_structure_type | ||
| # SINGLE_INVALID_TAG: DW_TAG_member | ||
| # SINGLE_INVALID_TAG: DW_TAG_member | ||
| # SINGLE_INVALID_TAG: DW_TAG_member | ||
| # SINGLE_INVALID_TAG-NOT: DW_TAG_structure_type | ||
| # SINGLE_INVALID_TAG-NOT: DW_TAG_member | ||
|
|
||
| # RUN: llvm-dwarfdump %t.o -c --name=Foo -t not_a_tag | \ | ||
| # RUN: FileCheck %s --check-prefix=ONLY_INVALID_TAGS --implicit-check-not=DW_TAG_compile_unit --implicit-check-not=DW_TAG_subprogram --implicit-check-not=DW_TAG_namespace --implicit-check-not=DW_TAG_member | ||
|
|
||
| # ONLY_INVALID_TAGS: DW_TAG_structure_type | ||
| # ONLY_INVALID_TAGS-NOT: DW_TAG_structure_type | ||
|
|
||
| # RUN: llvm-dwarfdump %t.o -c -p --name=Foo -t DW_TAG_member | \ | ||
| # RUN: FileCheck %s --check-prefix=FOO_MEM_WITH_PARENT --implicit-check-not=DW_TAG_subprogram | ||
|
|
||
| # FOO_MEM_WITH_PARENT: DW_TAG_compile_unit | ||
| # FOO_MEM_WITH_PARENT: DW_TAG_namespace | ||
| # FOO_MEM_WITH_PARENT: DW_TAG_structure_type | ||
| # FOO_MEM_WITH_PARENT: DW_TAG_member | ||
| # FOO_MEM_WITH_PARENT: DW_TAG_member | ||
| # FOO_MEM_WITH_PARENT: DW_TAG_member | ||
| # FOO_MEM_WITH_PARENT-NOT: DW_TAG_structure_type | ||
| # FOO_MEM_WITH_PARENT-NOT: DW_TAG_member | ||
|
|
||
| ## Not specifying --show-children ignores the --filter-child-tag option. | ||
| # RUN: llvm-dwarfdump %t.o --name=Foo -t DW_TAG_member 2>&1 | FileCheck %s --check-prefix=NO_SHOW_CHILDREN | ||
|
|
||
| # NO_SHOW_CHILDREN: DW_TAG_structure_type | ||
|
|
||
| --- !ELF | ||
| FileHeader: | ||
| Class: ELFCLASS64 | ||
| Data: ELFDATA2LSB | ||
| Type: ET_EXEC | ||
| Machine: EM_X86_64 | ||
| DWARF: | ||
| debug_abbrev: | ||
| - Table: | ||
| - Tag: DW_TAG_compile_unit | ||
| Children: DW_CHILDREN_yes | ||
| Attributes: | ||
| - Attribute: DW_AT_producer | ||
| Form: DW_FORM_string | ||
| - Tag: DW_TAG_namespace | ||
| Children: DW_CHILDREN_yes | ||
| Attributes: | ||
| - Attribute: DW_AT_name | ||
| Form: DW_FORM_string | ||
| - Tag: DW_TAG_structure_type | ||
| Children: DW_CHILDREN_yes | ||
| Attributes: | ||
| - Attribute: DW_AT_name | ||
| Form: DW_FORM_string | ||
| - Tag: DW_TAG_member | ||
| Children: DW_CHILDREN_no | ||
| Attributes: | ||
| - Attribute: DW_AT_name | ||
| Form: DW_FORM_string | ||
| - Tag: DW_TAG_subprogram | ||
| Children: DW_CHILDREN_no | ||
| Attributes: | ||
| - Attribute: DW_AT_name | ||
| Form: DW_FORM_string | ||
| debug_info: | ||
| - Version: 5 | ||
| UnitType: DW_UT_compile | ||
| Entries: | ||
| - AbbrCode: 1 | ||
| Values: | ||
| - CStr: handwritten | ||
| - AbbrCode: 2 | ||
| Values: | ||
| - CStr: ns | ||
| - AbbrCode: 3 | ||
| Values: | ||
| - CStr: Foo | ||
| - AbbrCode: 4 | ||
| Values: | ||
| - CStr: mem1 | ||
| - AbbrCode: 4 | ||
| Values: | ||
| - CStr: mem2 | ||
| - AbbrCode: 4 | ||
| Values: | ||
| - CStr: mem3 | ||
| - AbbrCode: 3 | ||
| Values: | ||
| - CStr: NestedInFoo | ||
| - AbbrCode: 4 | ||
| Values: | ||
| - CStr: NestedMem1 | ||
| - AbbrCode: 4 | ||
| Values: | ||
| - CStr: NestedMem2 | ||
| - AbbrCode: 5 | ||
| Values: | ||
| - CStr: NestedFunc | ||
| - AbbrCode: 0x0 | ||
| - AbbrCode: 5 | ||
| Values: | ||
| - CStr: FooFunc | ||
| - AbbrCode: 0x0 | ||
| - AbbrCode: 0x0 | ||
| - AbbrCode: 0x0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would find it easier to follow the test if you did something like:
etc.
You should also break up your longer lines over multiple lines using
\as the line continuation character (see last example).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!