microsoft / microsoft/vscode-cpptools
Using an Input Task for complex Launch Args doesn't work
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- TypeScript
- Estrellas
- 6.2k
- Forks
- 1.7k
- Merge medio
- 14 h 46 min
- PR fusionados (30 d)
- 61
Descripción
Bug type: Debugger
Describe the bug
- OS and Version: Host: MacOS, Container: Gentoo
- VS Code Version: 1.55.2
- C/C++ Extension Version: 1.3.1
I'm connecting to a Container workspace and trying to launch the debugger within the container. With a static config (without tasks) everything works fine. However, the process I'm trying to debug has complex logic to determine args depending on what input file we give it. So previously I had a launch.json like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug File",
"type": "cppdbg",
"request": "launch",
"program": "/depot/out/cur/process",
"args": [
"--read", "${input:filePicker}",
// ... sometimes gotta add other stuff
],
},
],
"inputs": [
{
"id": "filePicker",
"type": "command",
"command": "extension.commandvariable.file.pickFile",
"args": {
"include": "**/*.txt",
"display": "fullPath"
}
}
]
}
Which let us pick the file we wanted to debug. It worked fine, except sometimes we needed to tune the args by hand depending on the file, which is annoying.
Thanks to #4962 I know (and tested) I can pass args in the format {--foo,bar} and they'll be expanded correctly for GDB. So I wrote a little script that, given an input file, spits out the args we want in that format. So I changed my configs:
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug File",
"type": "cppdbg",
"request": "launch",
"program": "/depot/out/cur/process",
"args": ["${input:getDebugArgs}"],
"logging": {
"trace": true,
"traceResponse": true,
"engineLogging": true
}
}
],
"inputs": [
{
"id": "getDebugArgs",
"type": "command",
"command": "workbench.action.tasks.runTask",
"args": "getDebugArgs"
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "getDebugArgs",
"type": "shell",
"command": "/depot/test/gen_debug_args -w ${input:filePicker}"
},
],
"inputs": [
{
"id": "filePicker",
"type": "command",
"command": "extension.commandvariable.file.pickFile",
"args": {
"include": "**/*.txt",
"display": "fullPath"
}
}
]
}
The task runs correctly, with output
> Executing task in folder sensor: /depot/test/gen_debug_args -w /depot/test/a.txt <
{--foo,bar}
Terminal will be reused by tasks, press any key to close it.
But the debugger never actually starts. No loading bar, no spinner, no error messages anywhere (terminal, C/C++ output, Debug Console, or Dev Console); it just stops. Like I said, with a raw file input things worked fine, so I don't believe there's any issue with my other debugger settings. Any ideas?
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con las configuraciones launch.json y tasks.json, especialmente con la entrada cppdbg args y el comando workbench.action.tasks.runTask. Reproduce el inicio controlado por tareas con el registro de trace y traceResponse habilitado y compáralo con el caso funcional de raw file input. Se considera terminado cuando el depurador se inicia y recibe los argumentos generados por getDebugArgs.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- cpp, vscode
- Área
- devtools
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100