Visual studio code 如何设置CodeLLDB以调试从Java进程调用的Rust可执行文件?
我有一个小的Rust程序,可以读写stdin和stdout。此Rust可执行文件将从Java程序调用并与之交互 Java程序从命令行启动,如下所示:Visual studio code 如何设置CodeLLDB以调试从Java进程调用的Rust可执行文件?,visual-studio-code,rust,lldb,vscode-debugger,codelldb,Visual Studio Code,Rust,Lldb,Vscode Debugger,Codelldb,我有一个小的Rust程序,可以读写stdin和stdout。此Rust可执行文件将从Java程序调用并与之交互 Java程序从命令行启动,如下所示: java-jar${pathToJar}${pathToMyRustExecutable}${otherArgs} 这是一个一次性的程序,不在循环中运行,这使得我很难将调试器附加到它 我一直在阅读VSCode关于tasks.json和launch.json的文档,下面是我迄今为止能想到的最好的 { // See https://go.micr
java-jar${pathToJar}${pathToMyRustExecutable}${otherArgs}
这是一个一次性的程序,不在循环中运行,这使得我很难将调试器附加到它
我一直在阅读VSCode关于tasks.json和launch.json的文档,下面是我迄今为止能想到的最好的
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Launch CG Referee",
"type": "shell",
"command": "java",
"args": [
"-jar",
"$HOME/.m2/repository/com/codingame/game/spring-2020/1.0-SNAPSHOT/spring-2020-1.0-SNAPSHOT-fat-tests.jar",
"${workspaceFolder}/target/debug/spring-challenge-2020-rust.exe",
"${workspaceFolder}/target/debug/spring-challenge-2020-rust.exe",
"5842184981578562716"
]
},
{
"type": "cargo",
"subcommand": "build",
"problemMatcher": [
"$rustc"
],
"group": "build",
"label": "Build"
},
{
"label": "Build and Launch CG Referee",
"dependsOn": [
"Build",
"Launch CG Referee"
],
"dependsOrder": "sequence"
}
]
}
这成功地构建了我的Rust代码并启动了Java进程,但它没有及时附加调试器。这个过程在结束之前就结束了。我怀疑这是因为launch.json在尝试附加调试器之前等待“preLaunchTask”退出,但我在文档中没有找到任何可以证实这一点的内容,也没有找到解决方法
如何正确配置此选项?可能会添加一个
let foo=false;虽然foo{}
在程序的开头,然后在调试器中更改foo
的值,以允许程序在连接lldb后继续。@Jmb是的。我现在有了这个设置。调试器仍然没有连接。它看起来确实在等待“预启动任务”终止。
{
// 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": "attach",
"name": "Debug",
"preLaunchTask": "Build and Launch CG Referee",
"program": "${workspaceFolder}/target/debug/spring-challenge-2020-rust.exe",
"sourceLanguages": ["rust"]
}
]
}