Bug 23811 – Compiler doesn't emit global variables
Status
NEW
Severity
blocker
Priority
P1
Component
tools
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2023-03-27T23:21:02Z
Last change time
2023-03-28T14:48:45Z
Assigned to
No Owner
Creator
ryuukk_
Comments
Comment #0 by ryuukk.dev — 2023-03-27T23:21:02Z
Take this example:
OS: Windows x64
Debugger: Visual Studio Code
```
module debugme;
struct NoticeMe
{
int value_int;
}
NoticeMe notice_me_global;
void break_me()
{
NoticeMe i_am_local;
}
void main()
{}
```
Break at: i_am_local, and try to inspect notice_me_global
notice_me_global // doesn't work
debugme.notice_me_global //doesn't work
debugme:notice_me_global //doesn't work
debugme::notice_me_global //doesn't work
debugme@notice_me_global // doesn't work
Expected:
I should be able to inspect and watch globals
Notes:
- it works with visual studio when you have the visual d plugin
- it doesn't work on visual studio code debugger (wich uses msvc)
- it doesn't work with remedybg (https://remedybg.handmade.network/)
Notes 2:
D should provide great experience on popular editors/tools, otherwise what to tell to people?
Notes 3:
It works great out of the box with: c/c++/rust/zig/odin/jai
Notes 4:
I tried to raise awareness and ask questions on IRC/Forum, i was left blind, not a good outlook
Notes 5:
Making D great to use is my goal, just a reminder, in case people see me as a "complainer"
Notes 6:
People are too kind, they see X not working, they'll move on and choose Y instead, X team won't understand why people leave
Comment #1 by razvan.nitu1305 — 2023-03-28T10:27:34Z
I don't use any of the tools you pointed out, but potential issues might be:
- the code is not compiled with -g
- notice_me_global is the user facing name, but in the resulting binary it's going to have a mangled name
Anyway, this seems more like a tool issue, rather than a compiler issue.
Comment #2 by ryuukk.dev — 2023-03-28T11:09:16Z
As i mentioned in the forum post, it is compiled with debug -g -debug, i tried all kind of -g (-g -gf -gs)
The problem is displayed here:
https://godbolt.org/z/nYGfMTqYY
!dbg on the global for C++
missing for D
I provide more information on the forum post:https://forum.dlang.org/post/[email protected]
- C example that works
- D example that doesn't
- difference between PDBs identified
- perhaps debuggers doesn't understand names with a . (dot)
Comment #6 by ryuukk.dev — 2023-03-28T14:48:45Z
I noticed in the pdb, there are no mention of the ``app_d`` module
I can only find:
```
40 | S_PROCREF [size = 28] `app_d.main`
module = 1, sum name = 0, offset = 40
```
and
```
0 | S_GDATA32 [size = 40] `app_d.notice_me_global`
type = 0x0074 (int), addr = 0003:3504
```
Is that why the debugger can't inspect global variables?
Why doesn't the pdb contain anything about ``app_d``?