Thread overview
-gc in dmd?
Apr 07, 2021
WebFreak001
Apr 07, 2021
Andre Pany
Apr 08, 2021
Mathias LANG
Apr 08, 2021
WebFreak001
Apr 08, 2021
Siemargl
Apr 08, 2021
Siemargl
Apr 08, 2021
Imperatorn
Apr 08, 2021
Andre Pany
Apr 10, 2021
Rainer Schuetze
April 07, 2021
Does DMD have a -gc flag comparable to the LDC flag? (emit C compatible debug information)

I thought it had that but seems like it doesn't exist actually. I need it because the Visual Studio debugger (VSDBG) only works with C/C++ style names and thinks arrays/associative arrays of the form like int[] are illegal because of the []

It's also only possible to add wildcards inside C++ style template arguments (<T>) so something like slice<T> in LDC would be nice to have.

This would greatly improve the debugging experience on Windows as then arrays and associative arrays could work with visualizers. (like using the new natvis visualizer)

Only being restricted to LDC with -gc might be a bad constraint for some users, so I'm looking for something that works with both compilers. mago-mi doesn't seem to work at all (running works, no breakpoint support or anything else though)
April 07, 2021
On Wednesday, 7 April 2021 at 11:36:59 UTC, WebFreak001 wrote:
> Does DMD have a -gc flag comparable to the LDC flag? (emit C compatible debug information)
>
> I thought it had that but seems like it doesn't exist actually. I need it because the Visual Studio debugger (VSDBG) only works with C/C++ style names and thinks arrays/associative arrays of the form like int[] are illegal because of the []
>
> It's also only possible to add wildcards inside C++ style template arguments (<T>) so something like slice<T> in LDC would be nice to have.
>
> This would greatly improve the debugging experience on Windows as then arrays and associative arrays could work with visualizers. (like using the new natvis visualizer)
>
> Only being restricted to LDC with -gc might be a bad constraint for some users, so I'm looking for something that works with both compilers. mago-mi doesn't seem to work at all (running works, no breakpoint support or anything else though)

Some years ago I got mago-mi working in IntelliJ D plugin, but yes, it was a try and error until I got the right order and syntax. Maybe this is a starting point:
https://github.com/rainers/mago/issues/14#issuecomment-395517912

You can also look at the DLangIde about the order and syntax of the commands in the debugger log output.

Kind regards
Andre

April 08, 2021
On Wednesday, 7 April 2021 at 11:36:59 UTC, WebFreak001 wrote:
> Does DMD have a -gc flag comparable to the LDC flag? (emit C compatible debug information)
>
> [...]
>
> Only being restricted to LDC with -gc might be a bad constraint for some users, so I'm looking for something that works with both compilers. mago-mi doesn't seem to work at all (running works, no breakpoint support or anything else though)

https://github.com/dlang/dmd/pull/4766
Is VSDBG not extensible in any way ? What does other languages (Go, Rust) do here ? Adding back `-gc` would be a step back IMO.
April 08, 2021
On Thursday, 8 April 2021 at 06:06:58 UTC, Mathias LANG wrote:
> On Wednesday, 7 April 2021 at 11:36:59 UTC, WebFreak001 wrote:
>> Does DMD have a -gc flag comparable to the LDC flag? (emit C compatible debug information)
>>
>> [...]
>>
>> Only being restricted to LDC with -gc might be a bad constraint for some users, so I'm looking for something that works with both compilers. mago-mi doesn't seem to work at all (running works, no breakpoint support or anything else though)
>
> https://github.com/dlang/dmd/pull/4766
> Is VSDBG not extensible in any way ? What does other languages (Go, Rust) do here ? Adding back `-gc` would be a step back IMO.

From https://github.com/rust-lang/rust/issues/36503 I assume no and it looks like they emit C++ compatible debug symbols
April 08, 2021
On Wednesday, 7 April 2021 at 11:36:59 UTC, WebFreak001 wrote:
>
> This would greatly improve the debugging experience on Windows as then arrays and associative arrays could work with visualizers. (like using the new natvis visualizer)
>
> Only being restricted to LDC with -gc might be a bad constraint for some users, so I'm looking for something that works with both compilers. mago-mi doesn't seem to work at all (running works, no breakpoint support or anything else though)

I take mago-mi  from https://ci.appveyor.com/project/rainers/mago/build/artifacts
and basically it works for x86 apps, breakpoints stops, array are shown, but not AA.
April 08, 2021
I tested all debuggers for Windows, but best (most working) was WinDBG from Win10 SDK


April 08, 2021
On Thursday, 8 April 2021 at 06:42:09 UTC, Siemargl wrote:
> On Wednesday, 7 April 2021 at 11:36:59 UTC, WebFreak001 wrote:
>>
>> This would greatly improve the debugging experience on Windows as then arrays and associative arrays could work with visualizers. (like using the new natvis visualizer)
>>
>> Only being restricted to LDC with -gc might be a bad constraint for some users, so I'm looking for something that works with both compilers. mago-mi doesn't seem to work at all (running works, no breakpoint support or anything else though)
>
> I take mago-mi  from https://ci.appveyor.com/project/rainers/mago/build/artifacts
> and basically it works for x86 apps, breakpoints stops, array are shown, but not AA.

To debug x86_64 applications you need also MagoRemote.exe and a regedit key "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\MagoDebugger" with a value "Remote_x64" containing path to "MagoRemote.exe" e.g. "C:\Program Files (x86)\VisualD\Mago\MagoRemote.exe".

(But as far as I know, WebFreak001 recently did a PR which should find MagoRemote in the same folder).

Kind regards
Andre
April 08, 2021
On Thursday, 8 April 2021 at 07:10:23 UTC, Siemargl wrote:
> I tested all debuggers for Windows, but best (most working) was WinDBG from Win10 SDK

Yeah, I would also recommend trying the preview version:
https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debugging-using-windbg-preview

https://www.microsoft.com/en-us/p/windbg-preview/9pgjgd53tn86?activetab=pivot:overviewtab
April 10, 2021

On 07/04/2021 13:36, WebFreak001 wrote:
> Does DMD have a -gc flag comparable to the LDC flag? (emit C compatible
> debug information)
> 
> I thought it had that but seems like it doesn't exist actually. I need it because the Visual Studio debugger (VSDBG) only works with C/C++ style names and thinks arrays/associative arrays of the form like int[] are illegal because of the []

The VS Code debug engine for C++ actually uses the same architecture as the debugger in Visual Studio, but misses a tiny bit: you cannot add source language mappings. So using the mago expression evaluator extension is likely to work once they add a possibility to load it.

You might want to remind the developers that this is still of interest: https://github.com/microsoft/vscode-cpptools/issues/2932