-
Notifications
You must be signed in to change notification settings - Fork 12.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
DebugInfo: No alignment info for "transitive" alignment-enforced structures. #73623
Comments
@llvm/issue-subscribers-debuginfo Author: Haojian Wu (hokein)
Split from #72913.
Consider the following case: struct alignas(8) Base {} a;
struct Derived : Base {} b; Debug info emitted by clang
The This is a regression caused by https://reviews.llvm.org/D24426. |
@llvm/issue-subscribers-lldb Author: Haojian Wu (hokein)
Split from #72913.
Consider the following case: struct alignas(8) Base {} a;
struct Derived : Base {} b; Debug info emitted by clang
The This is a regression caused by https://reviews.llvm.org/D24426. |
GCC Does include the alignment, Clang does not: https://godbolt.org/z/q5rGMvEMn I could see an argument for Clang being correct & leaving it up to the consumer to do the layout - but DWARF does encode the member offsets, etc, when those could be derived with sufficient ABI knowledge, etc, so explicitly including the alignment when it's non-trivial seems maybe suitable. |
I had the same initial thought, since when alignment isn't specified, the |
Interestingly, I hacked something together that addresses #73563. With that in place we end up inferring the alignment correctly, presumably because the alignment calculations rely on data-size being set correctly. So I suggest we focus on the other issue first, and see if that resolves all our problems |
Hi, @Michael137 You seem to take a look on this issue and #73563, is there any progress or update on them? |
I've been meaning to follow-up on https://discourse.llvm.org/t/rfc-lldb-handling-no-unique-address-in-lldb/77483 but was sidetracked with other things. I think the direction we're taking is to make the Clang layout-builder assertions less restrictive for external sources (such as LLDB). This would resolve the original issue raised in #72913 (but wouldn't address the "DW_AT_alignment isn't propagated problem" raised here). |
Adds test that checks that LLDB correctly infers the alignment of packed structures. Specifically, the `InferAlignment` code-path of the `ItaniumRecordLayoutBuilder` where it assumes that overlapping field offsets imply a packed structure and thus sets alignment to `1`. See discussion in llvm#93809. Also adds two XFAIL-ed tests: 1. where LLDB doesn't correctly infer the alignment of a derived class whose base has an explicit `DW_AT_alignment. See llvm#73623. 2. where the aforementioned `InferAlignment` kicks in for overlapping fields (but in this case incorrectly since the structure isn't actually packed).
Split from #72913.
Consider the following case:
Debug info emitted by clang
./bin/clang -cc1 -emit-llvm -debug-info-kind=limited /tmp/t.cpp -o -
The
DICompositeType
forDerived
is missing thealign
attribute, it is a critical information for lldb to get correct layout for the structure.This is a regression caused by https://reviews.llvm.org/D24426.
Comments from @Michael137:
The text was updated successfully, but these errors were encountered: