Thread overview
[Issue 23811] Compiler doesn't emit global variables
Mar 28, 2023
RazvanN
Mar 28, 2023
ryuukk_
Mar 28, 2023
ryuukk_
Mar 28, 2023
ryuukk_
Mar 28, 2023
ryuukk_
Mar 28, 2023
ryuukk_
March 28, 2023
https://issues.dlang.org/show_bug.cgi?id=23811

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com
          Component|dmd                         |tools

--- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> ---
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.

--
March 28, 2023
https://issues.dlang.org/show_bug.cgi?id=23811

--- Comment #2 from ryuukk_ <ryuukk.dev@gmail.com> ---
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

--
March 28, 2023
https://issues.dlang.org/show_bug.cgi?id=23811

--- Comment #3 from ryuukk_ <ryuukk.dev@gmail.com> ---
nevermind my previous comment

--
March 28, 2023
https://issues.dlang.org/show_bug.cgi?id=23811

--- Comment #4 from ryuukk_ <ryuukk.dev@gmail.com> ---
I opened an issue on the microsoft tracker, let's wait and see what they have to say: https://github.com/microsoft/vscode-cpptools/issues/10751

--
March 28, 2023
https://issues.dlang.org/show_bug.cgi?id=23811

--- Comment #5 from ryuukk_ <ryuukk.dev@gmail.com> ---
I provide more information on the forum post:https://forum.dlang.org/post/fdnrbgfxvtexvpntehod@forum.dlang.org

- C example that works
- D example that doesn't
- difference between PDBs identified
- perhaps debuggers doesn't understand names with a . (dot)

--
March 28, 2023
https://issues.dlang.org/show_bug.cgi?id=23811

--- Comment #6 from ryuukk_ <ryuukk.dev@gmail.com> ---
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``?

--