Skip to content

VSCode Debugger Won't Stop At Breaklines. #1747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ashourmm opened this issue Nov 1, 2023 · 2 comments
Closed

VSCode Debugger Won't Stop At Breaklines. #1747

ashourmm opened this issue Nov 1, 2023 · 2 comments

Comments

@ashourmm
Copy link

ashourmm commented Nov 1, 2023

I cannot get VSCode to stop at my breakpoints no matter what tutorial I follow on Rust debugging. I am currently doing this on Mac OS 12.6. I have rust-analyzer installed, CodeLLDB installed, and set “allow breakpoints anywhere” to enabled.

The file I am trying to debug is intro2.rs. I tried compiling it a couple of times by running rustc .../rustlings/intro/intro2.rs, and an executable (I think) file intro2 appears in the intro folder. Then I tried running the debugger but it doesn't stop at my breakpoints, and it doesn't output the print statements in my code (I do get the messages if I run executable directly from the command line).

I tried building the whole rustlings project by running "cargo build" in the rustlings directory and I get a message saying:
"Finished dev [unoptimized + debuginfo] target(s) in 0.09s"
and a file called rustlings appears in the directory ".../rustlings/target/debug".
Still the debugger won't stop at my breakpoints.

I have my launch.json file set up as shown below at the end with the "program" property set to either one of:
"program": /path/to/intro2
OR
"program": .../rustlings/target/debug/rustlings

still nothing.

The debugger does stop at some assembly instructions if I add "main" to my breakpoints which leads me to conclude that the debugger is working but the debug info is not included when compiling "intro2.rs" but I don't why that's the case.

Someone please help!

{
    // 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": [
        {
            "type": "lldb",
            "request": "launch",
            "name": "Debug executable 'rustlings'",
            "program": "/Users/mo0dy/Desktop/.rustuff/rustlings/exercises/intro/intro2",
            "cargo": {
                "args": [
                    "build",
                    "--bin=rustlings",
                    "--package=rustlings"
                ],
                "filter": {
                    "name": "rustlings",
                    "kind": "bin"
                }
            },
            "args": [],
            "cwd": "${workspaceFolder}"
        },
        {
            "type": "lldb",
            "request": "launch",
            "name": "Debug unit tests in executable 'rustlings'",
            "cargo": {
                "args": [
                    "test",
                    "--no-run",
                    "--bin=rustlings",
                    "--package=rustlings"
                ],
                "filter": {
                    "name": "rustlings",
                    "kind": "bin"
                }
            },
            "args": [],
            "cwd": "${workspaceFolder}"
        },
        {
            "type": "lldb",
            "request": "launch",
            "name": "Debug integration test 'integration_tests'",
            "cargo": {
                "args": [
                    "test",
                    "--no-run",
                    "--test=integration_tests",
                    "--package=rustlings"
                ],
                "filter": {
                    "name": "integration_tests",
                    "kind": "test"
                }
            },
            "args": [],
            "cwd": "${workspaceFolder}"
        }
    ]
}

Someone please help!

The debugger does stop at some assemly instructions if I add "main" to my breakpoints which leads me to conclude that the debugger is working but perhaps the debug info is not included when compiling "intro2.rs"

@magnusart
Copy link

I'm using the following config, starting rustlings watch and then attaching to the process. But same outcome.

...
{
      "name": "Attach to Process",
      "type": "lldb",
      "request": "attach",
      "pid": "${command:pickProcess}",
    },
...

@mo8it
Copy link
Contributor

mo8it commented Mar 30, 2024

Closing because this could be solved by #1935. Otherwise, there is nothing Rustlings can do towards this. It is a debugger issue.

Personal opinion: I only use print debugging in all languages, not only Rust. Especially for Rustlings, print debugging is more than enough.

@mo8it mo8it closed this as completed Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants