Nicolas Noben

Configure Visual Studio Code on macOS to get breakpoints on Apple Silicon (M1/M2)

vscode, clangd, lldb, M1, debugging


Breakpoints on Apple Silicon

As an update to my previous post[1], when I upgraded to Apple Silicon ARM based laptops and computer (M1/M2), I learnt the hard way that debugging via gdb is no more.

There is thankfully, now, an alternative. Here are the steps.

Install CodeLLDB in VSCode

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

Include the debug symbols in your makefile

Here is a basic example. The key is -g.

DEBUG_BUILD = -g -v -o "sitegen" -std=c99

You might want to look up the various flags here.

Create/update a launch.json config

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.


[1]: My previous post with macOS on Intel hardware