VSCode Linux C debugging

HI! I'm trying to debug a game made in C but breakpoints are not working, I managed to make it work under MacOS but no luck on Linux, here is my launch.json

Anyone has managed to get VSCode breakpoints to work under linux ?

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(lldb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${env:PLAYDATE_SDK_PATH}/bin/PlaydateSimulator",
            "osx": {
                "program": "${env:PLAYDATE_SDK_PATH}/bin/Playdate Simulator.app",
            },
            "args": [
                "${workspaceFolder}/game.pdx"
            ],
            "cwd": "${workspaceFolder}/Source",
            "additionalSOLibSearchPath": "${workspaceFolder}/build;${workspaceFolder}/build",
            "stopAtEntry": false,
            "environment": [],
            "externalConsole": false,
            "MIMode": "lldb"
        },
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${env:PLAYDATE_SDK_PATH}/bin/PlaydateSimulator",
            "args": [
                "${workspaceFolder}/game.pdx"
            ],
            "additionalSOLibSearchPath": "${workspaceFolder}/build;${workspaceFolder}/build",
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}/Source",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

If you add the -g flag to common.mk in the SIMCOMPILER var debugging should work!

Thanks for tracking this down! I will get this added to the common.mk file for gcc/linux.

1 Like