Skip to content
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

VSCode调试Rust代码 #41

Open
chenshenhai opened this issue Mar 9, 2020 · 0 comments
Open

VSCode调试Rust代码 #41

chenshenhai opened this issue Mar 9, 2020 · 0 comments

Comments

@chenshenhai
Copy link
Owner

chenshenhai commented Mar 9, 2020

Rust开发

安装环境

开始调试

初始化调试项目

mkdir debug_rs

cd debug_rs

cargo init

编辑调试代码

./debug_rs/src/main.rs 文件上写入待调试代码

fn add(x: i32, y: i32) -> i32 {
    return x + y;
}

fn main() {
    let x = 123;
    let y = 456;
    let result = add(x, y);

    let result = add(result, result);
    println!("result = {}", result);
}

调试配置

  • 选择 调试 -> 添加配置

debug_rs_001

  • 会初始化配置文件

debug_rs_002

  • 打断点

debug_rs_003

  • 调试结果

debug_rs_debug

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

1 participant