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

Compiler doesn't emit global variables #88

Open
mdparker opened this issue Jun 21, 2023 · 0 comments
Open

Compiler doesn't emit global variables #88

mdparker opened this issue Jun 21, 2023 · 0 comments

Comments

@mdparker
Copy link
Member

ryuukk.dev reported this on 2023-03-27T23:21:02Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=23811

CC List

  • razvan.nitu1305

Description

Take this example:

OS: Windows x64
Debugger: Visual Studio Code

```dlang
module debugme;

struct NoticeMe
{
    int value_int;
}

NoticeMe notice_me_global;

void break_me()
{
NoticeMe i_am_local;
}

{}

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

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

Comments

razvan.nitu1305 commented on 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.

ryuukk.dev commented on 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

ryuukk.dev commented on 2023-03-28T11:10:26Z

nevermind my previous comment

ryuukk.dev commented on 2023-03-28T13:16:21Z

I opened an issue on the microsoft tracker, let's wait and see what they have to say: microsoft/vscode-cpptools#10751

ryuukk.dev commented on 2023-03-28T13:48:45Z

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)

ryuukk.dev commented on 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?

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

No branches or pull requests

1 participant