Skip to content
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

DWARF for static members are wrong #4567

Open
ghost opened this issue Jan 28, 2024 · 2 comments
Open

DWARF for static members are wrong #4567

ghost opened this issue Jan 28, 2024 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 28, 2024

It appears that LDC generates standard member info, leading GDB to read the memory with an invalid address

sta_mbr

Information generated seem to confirm that

dwex_sta_mbr

@kinke
Copy link
Member

kinke commented Jan 28, 2024

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"

@ghost
Copy link
Author

ghost commented Jan 29, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant