-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[llvm][dwarfdump] Pretty-print DW_AT_language_version #164222
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
Michael137
merged 5 commits into
llvm:main
from
Michael137:llvm/dwarf-language-attrs-2-part-13
Oct 21, 2025
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
eaeeeac
[llvm][dwarfdump] Pretty-print DW_AT_language_version in non-verbose …
Michael137 662b7e6
fixup! fix test
Michael137 9deb8f4
fixup! print prettfied name in verbose mode too
Michael137 16ee162
fixup! no const local
Michael137 20e0411
fixup! add test explanation; add test-case for invalid DW_AT_language…
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
10 changes: 5 additions & 5 deletions
10
llvm/test/DebugInfo/Generic/compileunit-source-language-name.ll
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
37 changes: 37 additions & 0 deletions
37
llvm/test/tools/llvm-dwarfdump/X86/DW_AT_language_version-pretty.s
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,37 @@ | ||
| # Demonstrate dumping DW_AT_language_version in human-readable form. | ||
| # RUN: llvm-mc -triple=x86_64--linux -filetype=obj -o %t.o < %s | ||
| # RUN: llvm-dwarfdump %t.o -v | FileCheck %s --check-prefix=VERBOSE | ||
| # RUN: llvm-dwarfdump %t.o | FileCheck %s --check-prefix=NO-VERBOSE | ||
|
|
||
| # VERBOSE: .debug_info contents: | ||
| # VERBOSE: DW_AT_language_name [DW_FORM_data2] (DW_LNAME_C) | ||
| # VERBOSE: DW_AT_language_version [DW_FORM_data4] (201112 C11) | ||
|
|
||
| # NO-VERBOSE: .debug_info contents: | ||
| # NO-VERBOSE: DW_AT_language_name (DW_LNAME_C) | ||
| # NO-VERBOSE: DW_AT_language_version (C11) | ||
|
|
||
| .section .debug_abbrev,"",@progbits | ||
| .byte 1 # Abbreviation Code | ||
| .byte 17 # DW_TAG_compile_unit | ||
| .byte 1 # DW_CHILDREN_no | ||
| .ascii "\220\001" # DW_AT_language_name | ||
| .byte 5 # DW_FORM_data2 | ||
| .ascii "\221\001" # DW_AT_language_version | ||
| .byte 6 # DW_FORM_data4 | ||
| .byte 0 # EOM(1) | ||
| .byte 0 # EOM(2) | ||
| .byte 0 # EOM(3) | ||
|
|
||
| .section .debug_info,"",@progbits | ||
| .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit | ||
| .Ldebug_info_start0: | ||
| .short 5 # DWARF version number | ||
| .byte 1 # Unit type | ||
| .byte 8 # Address Size (in bytes) | ||
| .long .debug_abbrev # Offset Into Abbrev. Section | ||
| .byte 1 # Abbrev [1] DW_TAG_compile_unit | ||
| .short 3 # DW_AT_language_name | ||
| .long 201112 # DW_AT_language_version | ||
| .byte 0 | ||
| .Ldebug_info_end0: |
21 changes: 13 additions & 8 deletions
21
llvm/test/tools/llvm-dwarfdump/X86/DW_AT_language_version.s
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 |
|---|---|---|
| @@ -1,13 +1,18 @@ | ||
| # Demonstrate dumping DW_AT_language_version. | ||
|
||
| # RUN: llvm-mc -triple=x86_64--linux -filetype=obj < %s | \ | ||
| # RUN: llvm-dwarfdump -v - | FileCheck %s | ||
| # RUN: llvm-mc -triple=x86_64--linux -filetype=obj -o %t.o < %s | ||
| # RUN: llvm-dwarfdump -v %t.o | FileCheck %s --check-prefix=VERBOSE | ||
| # RUN: llvm-dwarfdump %t.o | FileCheck %s --check-prefix=NO-VERBOSE | ||
|
|
||
| # CHECK: .debug_abbrev contents: | ||
| # CHECK: DW_AT_language_version DW_FORM_data4 | ||
| # CHECK: DW_AT_language_version DW_FORM_data2 | ||
| # CHECK: .debug_info contents: | ||
| # CHECK: DW_AT_language_version [DW_FORM_data4] (201402) | ||
| # CHECK: DW_AT_language_version [DW_FORM_data2] (0) | ||
| # VERBOSE: .debug_abbrev contents: | ||
| # VERBOSE: DW_AT_language_version DW_FORM_data4 | ||
| # VERBOSE: DW_AT_language_version DW_FORM_data2 | ||
| # VERBOSE: .debug_info contents: | ||
| # VERBOSE: DW_AT_language_version [DW_FORM_data4] (201402) | ||
| # VERBOSE: DW_AT_language_version [DW_FORM_data2] (0) | ||
|
|
||
| # NO-VERBOSE: .debug_info contents: | ||
| # NO-VERBOSE: DW_AT_language_version (201402) | ||
| # NO-VERBOSE: DW_AT_language_version (0) | ||
|
|
||
| .section .debug_abbrev,"",@progbits | ||
| .byte 1 # Abbreviation Code | ||
|
|
||
Oops, something went wrong.
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.
We don't usually use
conston locals - ends up feeling pretty inconsistent & then confusing when it is used (eg: why is it on this local, but not onPrettyVersionName, orDumpUnsignedConstantabove?