microsoft / microsoft/vscode-cpptools
Debug console hangs when trying to execute multiline gdb commands
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 1.7k
- Merge medio
- 14h 46m
- PR unite (30g)
- 61
Descrizione
Environment
Extension version: 0.23.1
GDB Version: 8.2.1
VS Code version: 1.33.1
OS: Linux x64 5.0.9-arch1-1-ARCH
The bug
So I know I can send commands to gdb using the -exec prefix. However, some gdb commands seem to require entering multiple lines (I couldn't find any delimiters for them), and when they're used with -exec, the console seems to hang.
When I try to send multiline command lines line-by-line, after entering the first one, the console just hangs, here's the log:
-exec while $ctr++<10
not available
<-- C (evaluate-29): {"command":"evaluate","arguments":{"expression":"-exec while $ctr++<10\n","frameId":1000,"context":"repl"},"type":"request","seq":29}
--> E (output): {"event":"output","body":{"category":"console","output":"1: (253496) <-1197-interpreter-exec console \"while $ctr++<10\"\n"},"seq":3648,"type":"event"}
1: (253496) <-1197-interpreter-exec console "while $ctr++<10"
--> E (output): {"event":"output","body":{"category":"console","output":"1: (253498) ->~\" >\"\n"},"seq":3650,"type":"event"}
1: (253498) ->~" >"`
After this, typing further lines of the command (prefixed with -exec or not) does nothing (there's no output either). Even clicking the stop button doesn't make gdb exit, the only thing I can do is to manually kill the gdb process.
I've also tried using Shift+Enter to send multiline command, and while it doesn't hang this time, it doesn't work either:
-exec while $ctr++<10
p $ctr
end
<-- C (evaluate-28): {"command":"evaluate","arguments":{"expression":"-exec while $ctr++<10\np $ctr\nend\n","frameId":1000,"context":"repl"},"type":"request","seq":28}
--> E (output): {"event":"output","body":{"category":"console","output":"1: (103563) <-1196-interpreter-exec console \"while $ctr++<10\np $ctr\nend\"\n"},"seq":3608,"type":"event"}
1: (103563) <-1196-interpreter-exec console "while $ctr++<10
p $ctr
end"
--> E (output): {"event":"output","body":{"category":"console","output":"1: (103575) ->1196^error,msg=\"Problem parsing arguments: interpreter-exec console \\\"while $ctr++<10\"\n"},"seq":3610,"type":"event"}
1: (103575) ->1196^error,msg="Problem parsing arguments: interpreter-exec console \"while $ctr++<10"
--> E (output): {"event":"output","body":{"category":"console","output":"1: (103576) 1196: elapsed time 13\n"},"seq":3612,"type":"event"}
1: (103576) 1196: elapsed time 13
--> E (output): {"event":"output","body":{"category":"console","output":"1: (103577) ->(gdb)\n"},"seq":3614,"type":"event"}
1: (103577) ->(gdb)
--> E (output): {"event":"output","body":{"category":"console","output":"1: (103578) ->&\"p $ctr\\n\"\n"},"seq":3616,"type":"event"}
1: (103578) ->&"p $ctr\n"
--> E (output): {"event":"output","body":{"category":"stdout","output":"p $ctr\n\n"},"seq":3618,"type":"event"}
p $ctr
--> E (output): {"event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/Evaluate","data":{"VS.Diagnostics.Debugger.ImplementationName":"Microsoft.MIDebugEngine","VS.Diagnostics.Debugger.EngineVersion":"16.1.10504.1","VS.Diagnostics.Debugger.HostVersion":"16.1.10504.1","VS.Diagnostics.Debugger.AdapterId":"cppdbg","VS.Diagnostics.Debugger.Evaluate.Duration":58.0,"VS.Diagnostics.Debugger.Evaluate.IsError":false,"VS.Diagnostics.Debugger.Evaluate.ExecuteInConsole":true}},"seq":3620,"type":"event"}
--> R (evaluate-28): {"request_seq":28,"success":true,"command":"evaluate","body":{"result":"","variablesReference":0},"seq":3622,"type":"response"}
--> E (output): {"event":"output","body":{"category":"console","output":"1: (103683) ->~\"$1 = void\"\n"},"seq":3624,"type":"event"}
1: (103683) ->~"$1 = void"
--> E (output): {"event":"output","body":{"category":"stdout","output":"$1 = void"},"seq":3626,"type":"event"}
$1 = void
--> E (output): {"event":"output","body":{"category":"console","output":"1: (103688) ->~\"\\n\"\n"},"seq":3628,"type":"event"}
1: (103688) ->~"\n"
--> E (output): {"event":"output","body":{"category":"stdout","output":"\n"},"seq":3630,"type":"event"}
--> E (output): {"event":"output","body":{"category":"console","output":"1: (103692) ->^done\n"},"seq":3632,"type":"event"}
1: (103692) ->^done
--> E (output): {"event":"output","body":{"category":"console","output":"1: (103695) ->(gdb)\n"},"seq":3634,"type":"event"}
1: (103695) ->(gdb)
--> E (output): {"event":"output","body":{"category":"console","output":"1: (103699) ->&\"end\\\"\\n\"\n"},"seq":3636,"type":"event"}
1: (103699) ->&"end\"\n"
--> E (output): {"event":"output","body":{"category":"console","output":"1: (103709) ->&\"This command cannot be used at the top level.\\n\"\n"},"seq":3638,"type":"event"}
1: (103709) ->&"This command cannot be used at the top level.\n"
--> E (output): {"event":"output","body":{"category":"console","output":"1: (103711) ->^error,msg=\"This command cannot be used at the top level.\"\n"},"seq":3640,"type":"event"}
1: (103711) ->^error,msg="This command cannot be used at the top level."
--> E (output): {"event":"output","body":{"category":"console","output":"1: (103716) Send Event AD7MessageEvent\n"},"seq":3642,"type":"event"}
1: (103716) Send Event AD7MessageEvent
--> E (output): {"event":"output","body":{"category":"stderr","output":"ERROR: This command cannot be used at the top level.\n"},"seq":3644,"type":"event"}
1: (103720) ->(gdb)
ERROR: This command cannot be used at the top level.
Workaround
Multiline commands work when using the gdb.execute function in Python, so this works (but it's ugly...):
-exec python gdb.execute('set $ctr=0\nwhile $ctr++<10\np $ctr\nend')
However I am still reporting this because I think the console shouldn't hang, even if the user tries to use an unimplemented feature.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproducete il blocco dalla console di debug usando il comando -exec while su più righe segnalato, quindi confrontatelo con la richiesta Shift+Enter e il workaround gdb.execute. Non sono indicati file sorgente né test; il lavoro è completato quando l’input su più righe non lascia più bloccati né la console né GDB, inclusa la gestione corretta dell’input non supportato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- linux, vscode
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100