[clang] [lldb] [clang][lldb] Don't assert structure layout correctness for layouts provided by LLDB (PR #93809)

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 26 11:02:51 PDT 2024


dwblaikie wrote:

Ah, I think this right solution to /this/ case is that the compiler should be emitting the alignment for the structure?

Like there's no way for the debugger to know that this structure is underaligned at the moment:
```
struct __attribute__((packed)) t1 {
  int i;
};
```
Which means the debugger might generate code that assumes `t1` is naturally aligned, and break (ARM crashes on underaligned operations, doesn't it? so if you got a pointer to t1 back from some API that happened to have put it in an underaligned location - then in your expression you tried to read `i`, this could generate crashing code?)

Essentially the `packed` attribute on the above structure is providing the same value/effect as `aligned(1)` and should produce the same DWARF, but it doesn't.

https://github.com/llvm/llvm-project/pull/93809


More information about the cfe-commits mailing list