개발/Rust

Visual Studio Code를 이용한 Rust Debug

njsung 2023. 4. 29. 16:42
반응형

vs code를 이용해 rust debug를 하는 방법에 대해 알아보려고한다.

 

1. vscode extension에서 CodeLLDB, rust-analyzer 설치

Extension에서 CodeLLDB, rust-analyzer 설치

2. Run 패널에서 Add Configuration 설정 후 launch.json 파일이 열리면 아래처럼 설정 추가

  • project-name에 본인 프로젝트 이름 설정후 저장
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "lldb",
            "request": "launch",
            "name": "Debug executable",            
            "cargo": {
                "args": [
                    "build",
                    "--bin="project-name"",
                    "--package="project-name""
                ],
                "filter": {
                    "name": ""project-name"",
                    "kind": "bin"
                }
            },
            "args": [],
            "cwd": "${workspaceFolder}/target/debug"
        }
    ]
}

3. "Run" 패널에서 "Debug executable" 선택해서 디버깅 시작

728x90

 

반응형