简体   繁体   中英

Error setting breakpoint in Visual Studio Code C++ Debugger

Until last week I was able to hit breakpoints in my C++ code in VSCode. Since last two days when I try to attach the debugger to the remote process, the breakpoints grey out.

On bringing my mouse pointer on a greyed out breakpoint, the message says:

Error setting breakpoint. The debug engine threw an exception.

, as shown in the image below:

失败的断点图像


My launch.json looks like the following:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "prgAttach",
            "type": "cppdbg",
            "request": "attach",
            "program": "~/JBL/SC-253/bin/azg",
            "processId": "${command:pickProcess}",
            "MIMode": "lldb"
        },
        //Followed by other debug configurations...
    ]
}

My platform info, obtained from Code > About Visual Studio Code, is:

Version: 1.41.1
Commit: 26076a4de974ead31f97692a0d32f90d735645c0
Date: 2019-12-18T14:57:51.166Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 18.7.0

Anyone else familiar with the problem? Any suggestions/workarounds?

I have:

  • tried uninstalling the C/C++ extensions and reinstalled them. No effect.
  • verified that I'm attaching to the correct process.
  • restarted the process too, to do a fresh attach.

I have a feeling that your issue could be related to this (you don't provide your full platform information): https://github.com/microsoft/vscode-cpptools/issues/3829

LLDB itself still works, it's just broken from within VS Code, but a fix is in the works according to the link.

It could also be worth re-generating launch.json and trying that out.

The reason why there are no real answers to this issue is that the debugging ability is due to an extension you may have added. The inability to set a breakpoint, is likely due to some bug in that extension.


Workaround:

You do not need to use the debugger you have been using so far in Visual Studio Code. Since the IDE is heavily extension supported, you can find and install another debugger and modify launch.json to use the new installation.

At the time of writing this answer, just typing lldb in the search tab of Extensions: Marketplace (Mac keyboard shortcut - shift command K ) lists some seven possible debugging extensions that you can install, three of which pertain to C/C++.


Whichever debugging extension you install, will have a Quick Start or similar guide that will explain how to modify the launch.json to enable debugging with the new extension. Remove or comment out the configuration entries for older debugger so that it doesn't interfere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM