Breakpoints don't hit when debugging Rust with gdb in Visual Studio Code

I started learning Rust, and I want to set up debugging in Visual Studio Code, but I can't get breakpoints to work. I am using the Native Debug and RustyCode extensions for VS Code.

Here is my startup file:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "gdb",
            "request": "launch",
            "target": "target/debug/test",
            "cwd": "${workspaceRoot}"
        }
    ]
}

But when I run this configuration, breakpoints do not hit. I see in the debug console that the debugger is running and the application is working fine, but there is a warning message "No Symbols loaded":

No symbol table is loaded.  Use the "file" command.
No symbol table is loaded.  Use the "file" command.
Running executable
[New Thread 32168.0x81e0]
[New Thread 32168.0x3360]
[New Thread 32168.0x61b8]
[New Thread 32168.0x8040]
The program "+ + * - /" calculates the value 1
[Thread 32168.0x61b8 exited with code 0]
[Thread 32168.0x3360 exited with code 0]
[Thread 32168.0x8040 exited with code 0]
[Inferior 1 (process 32168) exited normally]

Here is the source of the application that I am using . How can I make breakpoints work?

+4
source share
2 answers

, , msvc rustc.

GDB gnu , , rustup, , rustup default stable ( /). GNU , msvc stable-msvc).

rustup, gnu- Rust.

: , !

+4

, settings.json :

{
    "debug.allowBreakpointsEverywhere": true
}

Microsoft C/++ Debugger, . - GDB.

+1

Source: https://habr.com/ru/post/1665783/


All Articles