[Lldb-commits] [lldb] [llvm] [lldb] Prefer `DW_AT_bit_size` over `DW_AT_byte_size` in `GetDIEBitSizeAndSign` (PR #137123)
Yingwei Zheng via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 24 07:10:08 PDT 2025
dtcxzyw wrote:
> > `DW_AT_bit_size` will be ignored by lldb if `DW_AT_byte_size` is available and non-zero. Unfortunately, gdb crashes when `DW_AT_byte_size` does not exist or is set to zero. So I decided to change lldb to match gdb's behavior :(
>
> Can you file a gdb bug report with an executable showing this behavior? Or even just email it to me?
Reproducer:
test.c:
```
int a, b, c;
int d(int e) { return e; }
int main() {
int l_4516;
c = d(1);
l_4516 = 1 && c;
b = l_4516 & a;
return 0;
}
```
test.s: https://gist.github.com/dtcxzyw/a3fa3d33dbbea9717dfe7a1579df0d01
```
> gcc test.s # or use `clang test.s`
> gdb ./a.out
(gdb) b 7
(gdb) r
(gdb) p l_4516
/build/gdb-1WjiBe/gdb-15.0.50.20240403/gdb/gmp-utils.c:84: internal-error: export_bits: Assertion `buf.size () > 0' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
----- Backtrace -----
0x5d2df1cddbc6 ???
0x5d2df20f9dd4 ???
0x5d2df20fa0d0 ???
0x5d2df228df74 ???
0x5d2df1e41744 ???
0x5d2df21140ad ???
0x5d2df2105e96 ???
0x5d2df1d91242 ???
0x5d2df1d91ae7 ???
0x5d2df1d921c3 ???
0x5d2df1dacbcd ???
0x5d2df1dacfc6 ???
0x5d2df1dad599 ???
0x5d2df1e1d270 ???
0x5d2df2100eb8 ???
0x5d2df1dfaf46 ???
0x5d2df1dfa398 ???
0x5d2df1f3bcc3 ???
0x5d2df1f3c32f ???
0x5d2df1d16464 ???
0x5d2df2080727 ???
0x5d2df1e01967 ???
0x5d2df1e03143 ???
0x5d2df1e02332 ???
0x7c7e1b1ca9e4 ???
0x5d2df1e02495 ???
0x5d2df1e02663 ???
0x5d2df20c3a5c ???
0x5d2df228e975 ???
0x5d2df228f4f7 ???
0x5d2df1eddea9 ???
0x5d2df1ee0f04 ???
0x5d2df1c27dab ???
0x7c7e19e2a1c9 __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
0x7c7e19e2a28a __libc_start_main_impl
../csu/libc-start.c:360
0x5d2df1c361f4 ???
0xffffffffffffffff ???
---------------------
/build/gdb-1WjiBe/gdb-15.0.50.20240403/gdb/gmp-utils.c:84: internal-error: export_bits: Assertion `buf.size () > 0' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
```
gcc version: gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
gdb version: GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git
https://github.com/llvm/llvm-project/pull/137123
More information about the lldb-commits
mailing list