How to debug and watch globals in windows debugger?
ryuukk_
ryuukk.dev at gmail.com
Tue Mar 28 13:47:31 UTC 2023
C program:
```C
int notice_me_global = -1;
void main()
{
notice_me_global = -5;
}
```
``cl app_c.c /DEBUG /Zi /EHsc /std:c11 /link /DEBUG
/out:app_c.exe``
``llvm-pdbutil.exe dump --globals app_c.pdb > dump_c``
```
688476 | S_GDATA32 [size = 32] `notice_me_global`
type = 0x0074 (int), addr = 0003:0040
```
D program:
```D
__gshared int notice_me_global = -1;
extern(C) void main()
{
notice_me_global = 5;
int* a;
*a = 1;
}
```
``dmd -betterC -m64 -g -debug app_d.d``
``llvm-pdbutil.exe dump --globals app_d.pdb > dump_d``
```
0 | S_GDATA32 [size = 40] `app_d.notice_me_global`
type = 0x0074 (int), addr = 0003:3504
```
Open question:
Why is it:
For D: ``0 |``
For C: ``688476 |``
Potential issue:
Debugger doesn't understand: the ``.`` in the name
``app_d.notice_me_global``, mangled name also doesn't work
That's the info i provided in the microsoft tracker, maybe some
people here can notice something else that's wrong
dump_c:
https://gist.github.com/ryuukk/40c6d7d1cd3d6a010242d505380fe233
dump_d:
https://gist.github.com/ryuukk/38f43383025907a8f44049503887206c
More information about the Digitalmars-d-learn
mailing list