Open ghost opened 8 months ago
The behavior with Ubuntu 22's gdb v12.1 on my box is different; it 'just' shows a garbage value if the global is a TLS var.
E.g., with a thread-global var:
struct S {
shared static int a = 666;
int b;
}
int main() {
S s;
return s.a;
}
Breakpoint 1, _Dmain () at test.d:8
8 return s.a;
(gdb) p s
$1 = {b = 0, static a = 666}
(gdb) p s.a
$2 = 666
(gdb) p S.a
$3 = 666
(gdb) p test.S.a
$4 = 666
(gdb) p S.b
Cannot reference non-static field "b"
To be frank, I know that the LLVM API for DWARF info has a function for static members. But I cant find an open sourced language that is able to use it correctly. Possibly the problem would be that a GDB "expression" would have to be created to have the propoer access.
In other words...if you fix this problem, that will help, and not only D programmers.
It appears that LDC generates standard member info, leading GDB to read the memory with an invalid address
Information generated seem to confirm that