microsoft / microsoft/vscode-cpptools
Using an Input Task for complex Launch Args doesn't work
Personne n'a encore pris cette issue.
- Langage dominant
- TypeScript
- Étoiles
- 6.2k
- Forks
- 1.7k
- Merge moyen
- 14 h 46 min
- PR mergées (30 j)
- 61
Description
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?
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par les configurations launch.json et tasks.json, en particulier l’entrée cppdbg args et la commande workbench.action.tasks.runTask. Reproduisez le lancement piloté par une tâche avec la journalisation trace et traceResponse activée, puis comparez-le au cas fonctionnel raw file input. C’est terminé lorsque le débogueur démarre et reçoit les arguments générés par getDebugArgs.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- cpp, vscode
- Domaine
- devtools
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100