linux

如何配置Linux上的Rust调试环境

小樊
42
2025-12-22 05:30:14
栏目: 编程语言

Linux上Rust调试环境配置指南

一 安装Rust工具链与验证

二 安装系统级调试器与Rust增强组件

三 命令行调试步骤

四 在VSCode中一键调试

.vscode/tasks.json

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "build",
      "type": "shell",
      "command": "cargo",
      "args": ["build"]
    }
  ]
}

.vscode/launch.json(Linux,使用GDB)

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug",
      "type": "gdb",
      "preLaunchTask": "build",
      "request": "launch",
      "target": "${workspaceFolder}/target/debug/${workspaceFolderBasename}",
      "cwd": "${workspaceFolder}",
      "args": ""  // 需要传入的参数写在此处
    }
  ]
}

五 常见问题与实用技巧

0
看了该问题的人还看了