-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[lldb/DWARF] Respect member layout for types parsed through declarations #110648
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
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
132 changes: 132 additions & 0 deletions
132
lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_declaration-unusual-layout.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,132 @@ | ||
## Test that lldb respects the layout defined in DWARF even when starting out | ||
## with a declaration of the class. | ||
|
||
# RUN: split-file %s %t | ||
# RUN: llvm-mc --triple x86_64-pc-linux %t/asm --filetype=obj -o %t.o | ||
# RUN: %lldb -s %t/commands -o exit %t.o 2>&1 | FileCheck %s | ||
|
||
#--- commands | ||
target var a -fx | ||
# CHECK-LABEL: target var a | ||
# CHECK: (A) a = (i = 0xbaadf00d) | ||
|
||
#--- asm | ||
.data | ||
.p2align 4 | ||
.long 0 | ||
a: | ||
.long 0xdeadbeef | ||
.long 0xbaadf00d | ||
|
||
.section .debug_abbrev,"",@progbits | ||
.byte 1 # Abbreviation Code | ||
.byte 17 # DW_TAG_compile_unit | ||
.byte 1 # DW_CHILDREN_yes | ||
.byte 37 # DW_AT_producer | ||
.byte 8 # DW_FORM_string | ||
.byte 0 # EOM(1) | ||
.byte 0 # EOM(2) | ||
.byte 2 # Abbreviation Code | ||
.byte 52 # DW_TAG_variable | ||
.byte 0 # DW_CHILDREN_no | ||
.byte 3 # DW_AT_name | ||
.byte 8 # DW_FORM_string | ||
.byte 73 # DW_AT_type | ||
.byte 19 # DW_FORM_ref4 | ||
.byte 2 # DW_AT_location | ||
.byte 24 # DW_FORM_exprloc | ||
.byte 0 # EOM(1) | ||
.byte 0 # EOM(2) | ||
.byte 3 # Abbreviation Code | ||
.byte 19 # DW_TAG_structure_type | ||
.byte 0 # DW_CHILDREN_no | ||
.byte 3 # DW_AT_name | ||
.byte 8 # DW_FORM_string | ||
.byte 60 # DW_AT_declaration | ||
.byte 25 # DW_FORM_flag_present | ||
.byte 0 # EOM(1) | ||
.byte 0 # EOM(2) | ||
.byte 4 # Abbreviation Code | ||
.byte 19 # DW_TAG_structure_type | ||
.byte 1 # DW_CHILDREN_yes | ||
.byte 3 # DW_AT_name | ||
.byte 8 # DW_FORM_string | ||
.byte 11 # DW_AT_byte_size | ||
.byte 11 # DW_FORM_data1 | ||
.byte 0 # EOM(1) | ||
.byte 0 # EOM(2) | ||
.byte 5 # Abbreviation Code | ||
.byte 13 # DW_TAG_member | ||
.byte 0 # DW_CHILDREN_no | ||
.byte 3 # DW_AT_name | ||
.byte 8 # DW_FORM_string | ||
.byte 73 # DW_AT_type | ||
.byte 19 # DW_FORM_ref4 | ||
.byte 56 # DW_AT_data_member_location | ||
.byte 11 # DW_FORM_data1 | ||
.byte 0 # EOM(1) | ||
.byte 0 # EOM(2) | ||
.byte 6 # Abbreviation Code | ||
.byte 36 # DW_TAG_base_type | ||
.byte 0 # DW_CHILDREN_no | ||
.byte 3 # DW_AT_name | ||
.byte 8 # DW_FORM_string | ||
.byte 62 # DW_AT_encoding | ||
.byte 11 # DW_FORM_data1 | ||
.byte 11 # DW_AT_byte_size | ||
.byte 11 # DW_FORM_data1 | ||
.byte 0 # EOM(1) | ||
.byte 0 # EOM(2) | ||
.byte 0 # EOM(3) | ||
|
||
.section .debug_info,"",@progbits | ||
.Lcu_begin0: | ||
.long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit | ||
.Ldebug_info_start0: | ||
.short 4 # DWARF version number | ||
.long .debug_abbrev # Offset Into Abbrev. Section | ||
.byte 8 # Address Size (in bytes) | ||
.byte 1 # Abbrev [1] DW_TAG_compile_unit | ||
.asciz "Hand-written DWARF" # DW_AT_producer | ||
|
||
.byte 2 # Abbrev [2] DW_TAG_variable | ||
.asciz "a" # DW_AT_name | ||
.long .LA_decl-.Lcu_begin0 # DW_AT_type | ||
.byte 9 # DW_AT_location | ||
.byte 3 | ||
.quad a | ||
.LA_decl: | ||
.byte 3 # Abbrev [3] DW_TAG_structure_type | ||
.asciz "A" # DW_AT_name | ||
# DW_AT_declaration | ||
.byte 0 # End Of Children Mark | ||
.Ldebug_info_end0: | ||
|
||
.Lcu_begin1: | ||
.long .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit | ||
.Ldebug_info_start1: | ||
.short 4 # DWARF version number | ||
.long .debug_abbrev # Offset Into Abbrev. Section | ||
.byte 8 # Address Size (in bytes) | ||
.byte 1 # Abbrev [1] DW_TAG_compile_unit | ||
.asciz "Hand-written DWARF" # DW_AT_producer | ||
|
||
.byte 4 # Abbrev [4] DW_TAG_structure_type | ||
.asciz "A" # DW_AT_name | ||
# DW_AT_declaration | ||
.byte 8 # DW_AT_byte_size | ||
.byte 5 # Abbrev [5] DW_TAG_member | ||
.asciz "i" # DW_AT_name | ||
.long .Lint-.Lcu_begin1 # DW_AT_type | ||
## NB: empty padding before this member | ||
.byte 4 # DW_AT_data_member_location | ||
.byte 0 # End Of Children Mark | ||
|
||
.Lint: | ||
.byte 6 # Abbrev [6] DW_TAG_base_type | ||
.asciz "int" # DW_AT_name | ||
.byte 5 # DW_AT_encoding | ||
.byte 4 # DW_AT_byte_size | ||
|
||
.byte 0 # End Of Children Mark | ||
.Ldebug_info_end1: |
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
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.
Adding this was necessary because lldb crashed without it (in llvm record layout code). Removal of the check was hiding this problem by recomputing the size without lldb's input. While this is something that we may to fix, I don't think we're likely to run into this situation (structure definition without a size attribute) outside of hyper-reduced test cases.