Closed zhouhao27 closed 2 years ago
As long as i know cmake is only for building final image/binary. You need install extension for debugging for device you want to. E.g. i am debugging arm embedded device so i am using gdb debugger or cortex debugger.
Are you hitting this issue? https://github.com/microsoft/vscode-cpptools/issues/3829 We're working on it (with the C++ extension).
@bobbrow Yes, I have the same issue. Thanks for your information.
Based on this youtube video, we even don't need to setup launch.json or task.json to debug. Is that true?
That is correct. You shouldn't need a launch.json or tasks.json. If you do need to override a setting for debugging, you can use the cmake.debugConfig
setting.
The problem is this:
[proc] Executing command: /usr/bin/lldb --version
The default lldb gets picked, which will not work. The launch command of /usr/bin/lldb --interpreter=mi
will just fail with
Starting: "/usr/bin/lldb" --interpreter=mi
lldb: unrecognized option `--interpreter=mi'
The root of the issue is in this fallback codepath in this plugin: https://github.com/microsoft/vscode-cmake-tools/blob/50fc5ba265ee13f53dc9f273d0f1635c8861bd7d/src/debugger.ts#L163
If your compiler is "/usr/bin/clang" it tries to use "/usr/bin/lldb" as a debugger, and does not respect the "miDebuggerPath" setting in launch.json ( as launch.json might not even exist here ).
It works fine when hardcoding something like : let clang_debugger_path = '/Applications/Xcode.app/Contents/Developer/usr/bin/lldb-mi';
instead, which is what the plugin code should probably be trying by default, or alternatively look for lldb-mi
provided by vscode-cpptools
Also, the default miDebuggerPath
should probably be a global setting for this plugin, which would get used when launch.json doesn't exist and built-in guesses fail.
FYI, miDebuggerPath
can be set via the cmake.debugConfig
setting:
"cmake.debugConfig": {
"miDebuggerPath": "/path/to/lldb-mi"
},
@bobbrow your suggestion did the trick for me, before I applied that:
[main] Starting debugger with following configuration. ... "miDebuggerPath":"gdb"
So it was effectively ignoring:
"miDebuggerPath": "C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\gdb.exe"
In launch.json
.
I believe this issue was addressed but was never closed. If any of you are still having issues, we encourage you to open a new issue.
Brief Issue Summary
Can't make the Visual Studio Code debugger work.
Expected:
CMake Configuration
The result:
IntelliSense for this folder
The result:
Apparent Behavior:
Output
Platform and Versions