我正在尝试创建一个我要调用gdb的启动文件。只有当我称之为时,似乎我必须在filepath中使用4个后斜切才能使其正常工作。因此,我现在正在使用硬编码路径,但是我想使用来自CMake-Tools的路径。
{
// 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",
"type": "cppdbg",
"request": "launch",
"program": "gdb",
"args": [],
"externalConsole": true,
"stopAtEntry": true,
"windows": {
"MIMode": "gdb",
"cwd": "${workspaceRoot}",
"miDebuggerPath": "${env:QNX_HOST}\usr\bin\ntox86_64-gdb.exe",
"miDebuggerServerAddress": "192.168.88.128:1234",
"launchCompleteCommand": "exec-run",
"customLaunchSetupCommands": [
{
"text": "-environment-cd ${workspaceRoot}"
},
{
"description": "Connecting to QNX pdebug",
"text": "target qnx 192.168.88.128:1234",
"ignoreFailures": false
},
{
"description": "Loading symbol table",
"text": "file ${command:cmake.launchTargetPath}", // this line is returning single backslashes and I want to replace them with four backslashes
"ignoreFailures": false
},
{
"description": "Uploading",
"text": "upload THIS\\FOLDER\\STRUCTURE\\IS\\WORKING /SOMEWHERE/ON/QNX",
"ignoreFailures": false
}
]
},
"logging": {
"engineLogging": true,
"trace": true,
"traceResponse": true
},
"targetArchitecture": "x86_64"
}
]
}
我已经将几件事更改为此脚本以使其正常工作。
- 看来,正向斜线也在使用。因此,您只能做
"text": "upload THIS/FOLDER/STRUCTURE/IS/WORKING /SOMEWHERE/ON/QNX
-
${workspaceRoot}
仍然无法使用,但是我使用VS代码电源工具来制作一些可以添加到构建脚本中的自定义命令,您只需通过${command:myCustomCommand}
调用它们即可。在这些命令中,您还可以调用其他命令,例如cmake.launchtargetpath,然后将其更改为使用简单的JavaScript Regex。