-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
debug/dwarf: BitOffset values of bitfields is not being set in newer version of DWARF #46784
Comments
This seems reasonable to me. Would you like to send a patch? Thanks. |
Change https://golang.org/cl/328709 mentions this issue: |
@seankhliao What is the fix needed? I have already updated the PR to add the requested unit test. |
@jtsylve The "NeedsFix" label just means that closing this issue requires a fix to be applied to the repository. The change you already sent can be that fix. Thanks. |
@ianlancetaylor My apologies. I thought I was responding to the thread label on the PR and not the issue. That makes sense. |
For anybody who found this issue: currently there is a subtle difference in bitfield representation with dward4+, see: |
I filed a new issue to track the problem Dmitry raised: #50685 |
Change https://golang.org/cl/380714 mentions this issue: |
This patch reworks the handling of the DWARF DW_AT_bit_offset and DW_AT_data_bit_offset attributes to resolve problems arising from a previous related change (CL 328709). In CL 328709 the DWARF type reader was updated to look for and use the DW_AT_data_bit_offset attribute for structure fields, handling the value of the attribute in the same way as for DW_AT_bit_offset. This caused problems for clients, since the two attributes have very different semantics. This CL effectively reverts CL 328709 and moves to a scheme in which we detect and report the two attributes separately/independently. This patch also corrects a problem in the DWARF type reader in the code that detects and fixes up the type of struct fields corresponding to zero-length arrays; the code in question was testing the DW_AT_bit_offset attribute value but assuming DW_AT_data_bit_offset semantics, meaning that it would fail to fix up cases such as typedef struct another_struct { unsigned short quix; int xyz[0]; unsigned x:1; long long array[40]; } t; The code in question has been changed to avoid using BitOffset and instead consider only ByteOffset and BitSize. Fixes #50685. Updates #46784. Change-Id: Ic15ce01c851af38ebd81af827973ec49badcab6f Reviewed-on: https://go-review.googlesource.com/c/go/+/380714 Trust: Than McIntosh <[email protected]> Run-TryBot: Than McIntosh <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
Change https://golang.org/cl/381778 mentions this issue: |
For golang#46784 For golang#47694 For golang#50685 Change-Id: I5351b56722d036a520d1a598ef7af95c5eb44c35 Reviewed-on: https://go-review.googlesource.com/c/go/+/381778 Trust: Ian Lance Taylor <[email protected]> Reviewed-by: Than McIntosh <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes (including 1.17 beta 1)
Background Information
The DWARF v4 Standard depreciated the
DW_AT_bit_offset
attribute in favor of a newDW_AT_data_bit_offset
attribute. The value ofDW_AT_bit_offset
was reserved for backwards compatibility.See the following snippet from the v4 DWARF Standard [1]:
The Issue
The
debug/dwarf
package only checks againstAttrBitOffset
and ignores theAttrDataBitOffset
attribute, causing theBitOffset
fields to be set to zero in newer versions of DWARF debug info.Possible Solution
AttrDataBitOffset
should be checked if there is noAttrBitOffset
attribute.References
[1] DWARF Debugging Information Format, Version 4
The text was updated successfully, but these errors were encountered: