Ziq*_*Fan 5 gdb visual-studio-code
我在 vscode 中的设置launch.json
如下:
{
// 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": [
{
"name": "(gdb) Launch 25.0_regeragpu",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/25.0_regeragpu/Blazer/MercuryImageComputer/KT/leaf/M31/BrightField/bin/LeafStandalone/Debug/12/LeafStandAlone.x86-64",
"args": ["-noForcedPatches","${workspaceFolder}/virgo_algo_preq/JobDump/JobInfo_108"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/25.0_regeragpu/Blazer/MercuryImageComputer/KT/leaf/M31/BrightField/bin/LeafStandalone/Debug/12",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
此设置的目的是在 vscode 中使用 GDB 集成。特别是,我指定了以下对,以确保在调试时继承 vscode 终端的 bash 会话中设置的所有环境变量:"externalConsole": false
。environment
我还注意到配置中有一对命名的。据我了解,如果通过 vscode 启动一个新的 bash 会话进行调试,那么所有环境变量都应该在这environment
对中指定。为了尝试在调试时启动新的 bash 选项,我修改了配置文件:
{
// 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": [
{
"name": "(gdb) Launch 25.0_regeragpu",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/25.0_regeragpu/Blazer/MercuryImageComputer/KT/leaf/M31/BrightField/bin/LeafStandalone/Debug/12/LeafStandAlone.x86-64",
"args": ["-noForcedPatches","${workspaceFolder}/virgo_algo_preq/JobDump/JobInfo_108"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/25.0_regeragpu/Blazer/MercuryImageComputer/KT/leaf/M31/BrightField/bin/LeafStandalone/Debug/12",
"environment": [{"CUDA_VISIBLE_DEVICES":"0,1,2,3","CUDA_DEVICE_ORDER":"PCI_BUS_ID"}],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
特别是,可以看出我指定了以下对:"environment": [{"CUDA_VISIBLE_DEVICES":"0,1,2,3","CUDA_DEVICE_ORDER":"PCI_BUS_ID"}]
和"externalConsole": true
。然而,当我开始调试时,vscode的调试工具永远处于准备状态,从未进入真正的调试会话。如果我想在vscode中新的控制台中调试,应该如何设置环境变量?
小智 4
这是一个示例,您在环境块中设置值。
{
// 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": [
{
"name": "g++ - (GDB 9.2) Build and debug active file with RepoCodeInspection",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/bin/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [
{
"description": "same as commands below by using 'setenv ...",
"info": "cant debug b/c of libBase/libRecipe now requiring dependency to boost for stacktrace dumps",
"name": "LD_LIBRARY_PATH",
"value": "/libs/:./"
}
],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"logging": {
"trace": false,
"traceResponse": false
},
"preLaunchTask": "RepoCodeInspection",
},
{
"name": "g++ - (GDB 9.2) Attach to a running process",
"type": "cppdbg",
"request": "attach",
"processId":"${command:pickProcess}",
"program": "${fileDirname}/bin/${fileBasenameNoExtension}",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"logging": {
"trace": false,
"traceResponse": false
},
"preLaunchTask": "RepoCodeInspection",
},
]
Run Code Online (Sandbox Code Playgroud)
}
归档时间: |
|
查看次数: |
20131 次 |
最近记录: |