2023-05-24
There is thankfully, now, an alternative. Here are the steps.
The key is to use lldb
instead of gdb
, which comes with XCode (you might need to install xcode tools first).
Follow the CodeLLDB reference here
Here is a basic example. The key is -g
.
WARNINGS = -Wall
DEBUG_BUILD = -g -v -o "sitegen" -std=c99
You might want to look up the various flags here.
and finally, here is an example launch.json
…
{
"version": "0.2.0",
"configurations": [
{
"name": "CodeLLDB",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/<compiled binary>",
"args": [
],
}
]
}
And that’s it, you should be able to set up breakpoints and hit them when you launch.
Be sure to build first, as this only launches and attaches to breakpoints.
HTH.