-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[llvm-dwarfdump] Support for DW_AT_language_name and DW_AT_language_version #162449
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 1 commit into
llvm:main
from
Michael137:llvm/dwarf-language-attrs-2-part-3
Oct 10, 2025
+74
−1
Merged
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Demonstrate dumping DW_AT_language_name. | ||
# RUN: llvm-mc -triple=x86_64--linux -filetype=obj < %s | \ | ||
# RUN: llvm-dwarfdump -v - | FileCheck %s | ||
|
||
# CHECK: .debug_abbrev contents: | ||
# CHECK: DW_AT_language_name DW_FORM_data2 | ||
# CHECK: DW_AT_language_name DW_FORM_data2 | ||
# CHECK: .debug_info contents: | ||
# CHECK: DW_AT_language_name [DW_FORM_data2] (DW_LNAME_C) | ||
# CHECK: DW_AT_language_name [DW_FORM_data2] (0x0000) | ||
|
||
.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 "\220\001" # DW_AT_language_name | ||
.byte 5 # DW_FORM_data2 | ||
.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 | ||
.short 0 # DW_AT_language_name | ||
.byte 0 | ||
.Ldebug_info_end0: |
35 changes: 35 additions & 0 deletions
35
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Demonstrate dumping DW_AT_language_version. | ||
# RUN: llvm-mc -triple=x86_64--linux -filetype=obj < %s | \ | ||
# RUN: llvm-dwarfdump -v - | FileCheck %s | ||
|
||
# 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) | ||
|
||
.section .debug_abbrev,"",@progbits | ||
.byte 1 # Abbreviation Code | ||
.byte 17 # DW_TAG_compile_unit | ||
.byte 1 # DW_CHILDREN_no | ||
.ascii "\221\001" # DW_AT_language_version | ||
.byte 6 # DW_FORM_data4 | ||
.ascii "\221\001" # DW_AT_language_version | ||
.byte 5 # DW_FORM_data2 | ||
.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 | ||
.long 201402 # DW_AT_language_version | ||
.short 0 # DW_AT_language_version | ||
.byte 0 | ||
.Ldebug_info_end0: |
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.
Should dwarfdump also translate this into the human-readable version?
i.e.:
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.
That would be a neat addition. We'd have to detect the fact that there is a
DW_AT_language_name
present (I don't think the standard mandates that both attributes be present). Although it would be weird to have a version without a name. Might be worth asking the committee to clarify.Either way, I'll do it as a follow-up. For now I wanted to just get the minimal dwarfdump support for testing these attributes