Can't get into debugger in vscode on macOS

evilrat evilrat666 at gmail.com
Thu Oct 19 14:30:06 UTC 2023


On Thursday, 19 October 2023 at 06:03:06 UTC, Daniel Zuncke wrote:
> Hello, I need some help getting into the debugger in vscode on 
> macOS. It did work some months ago but that was finicky to set 
> up. Maybe I am forgetting something now?
>
> I am compiling the project with `dub build --build debug 
> --compiler ldc2 --force` (the `-ld_classic` flag to fix the new 
> Xcode linker is set in dub.json).
>
> Debugging in the terminal with lldb works as expected `lldb 
> bin/dfmt -- --help`.
>
> In vscode I the debug process immediately exits with error (as 
> far as I can tell, don't know how to get more output).
> All required extensions should be installed since it worked 
> some time ago (mainly CodeLLDB, code-d and C++ from what I 
> remember).
>
> I have tried 2 launch configs (launch.json):
> ```json
> {
>     "version": "0.2.0",
>     "configurations": [
>         {
>             "type": "lldb",
>             "request": "launch",
>             "name": "debug lldb",
>             "cwd": "${workspaceFolder}",
>             "program": "./bin/dfmt",
>             "args": ["--help"],
>         },
>         {
>             "type": "code-d",
>             "request": "launch",
>             "name": "debug code-d",
>             "cwd": "${workspaceFolder}",
>             "program": "./bin/dfmt",
>             "args": ["--help"],
>         },
>     ]
> }
> ```
> And both fail the same way (vscode Debug Console output):
> ```
> Launching: /Users/dz/dev/dfmt/issue578/bin/dfmt --help
> Launched process 24999
> Process exited with code -1.
> ```
> Any ideas what the problem could be? Can I get more verbose 
> output what the problem is after launching the process?

Could it be is that it instantly crashes?

In that case you need to set the breakpoints, it works by default 
in Windows, but not in Linux and probably MacOS too.

You need to set breakpoints for these functions _d_throw, 
_d_throwdwarf (dmd), _d_throw_exception (ldc, i think?).

I'm not exactly sure what is the relevant name for LDC and i'm on 
windows machine so i can't check my debugger config.

With this it will break on throw and you should be able to 
inspect it in debugger.



More information about the Digitalmars-d-learn mailing list