Debugging using macOS lldb instead of gdb

Hi, I am new to platformio, so apologies in advanced if this question has previously been asked (I’ve scoured the net and couldn’t find anything).

Does anyone know how to get lldb working on platformio as apposed to gdb.

The usage of gdb should be engrained in the platformio-core code. Please file an issue at Issues · platformio/platformio-core · GitHub to get help from developers.

Since gdb does not work on M1 I would be interested in this too. Any progress?

P.S. Just used lldb as debugger and that worked a charm (unlike gdb on my old Intel which caused a hang). All I did was to add a config to launch.json like

    {
        "name": "(lldb) Starten",
        "type": "cppdbg",
        "request": "launch",
        "program": "<mypath>/PlatformIO/Projects/LLDB/.pio/build/native/program",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${fileDirname}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "lldb"
    },

where <mypath> is somewhere in my Documents folder.

P.P.S. Also it seemed to be a good idea to add something like

build_flags = 
  -g 

to the environment since although it debugged, some locations were weird and symbols not shown as debug info was not complete.

1 Like

Im using neovim with vimspector debugger user interface.

this is my working .vimspector.json configuration. I tried the solution mentioned by Thomas.killian but I couldn’t make it work under nvim. vscode-cpptools adapter seems to work fine. After default instalation I have to specify the path manually with MIDebuggerPath option.

{
  "configurations": {
    "native": {
      "adapter": "vscode-cpptools",
      "configuration": {
		"type" : "cppdbg",
		"request": "launch",
        "program": "${workspaceRoot}/.pio/build/native/program",
		"stopAtEntry": true,
        "cwd": "${workspaceRoot}",
		"MiMode" : "lldb",
		"MIDebuggerPath" : "${gadgetDir}/vscode-cpptools/debugAdapters/lldb-mi/bin/lldb-mi",
		"externalConsole": true,
		"logging": {
			"engineLogging" : false 
		}
	  }
    }
  }
}