Debug with GDB on Windows

user1234 user1234 at 12.de
Sun May 26 04:25:22 UTC 2024


On Saturday, 18 May 2024 at 22:57:23 UTC, Aleksey Gorelov wrote:
> I am trying to debug on windows.
>
> A simple hello world app compiled with
> ```
> "c:\D\ldc2-1.38.0-windows-x64\bin\ldc2.exe" -gdwarf -O0 app.d
> ```
>
> has debug symbols.
>
> But the same app compiled with
> ```
>  dub  build  -b debug 
> --compiler="c:\D\ldc2-1.38.0-windows-x64\bin\ldc2.exe"  --force 
> --root ../..
> ```
> and dub.json
> ```
> {
> 	"name" : "testd1",
> 	"description" : "Hello World - A minimal DUB bundle.",
> 	"dependencies" : {
> 	},
> 	"dflags": ["-gdwarf", "-O0", "-d-debug"]
> }
> ```
>
> has NO debug symbols. gdb reports
> ```
> Reading symbols from ./testd1.exe...
> (No debugging symbols found in ./testd1.exe)
> ```
>
> If add additional option `-vv` to `dflags` the it is visible 
> that ldc2 receives the `gdwarf` option. Probably the dub does 
> some thing wrong? Or I am wrong. :-(

- in the json, try `dflags-ldc2` instead of `dflags`
- try not to use the debug build but a custom one

I suspect that `-g` passed (automatically) after `-gdwarf` would 
have for effect to cancel the effect of the first, so maybe a 
ldc2 CLI bug.


More information about the Digitalmars-d-debugger mailing list