microsoft / microsoft/vscode-cpptools

Debug console hangs when trying to execute multiline gdb commands

Offen
#3,666 6 Kommentare 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug debugger
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduzieren Sie den Hänger über die Debug-Konsole mit dem gemeldeten mehrzeiligen -exec while-Befehl und vergleichen Sie ihn anschließend mit der Shift+Enter-Anfrage und dem gdb.execute-Workaround. Es ist keine Quelldatei und kein Test angegeben; abgeschlossen ist die Aufgabe, wenn mehrzeilige Eingaben weder die Konsole noch GDB hängen lassen, einschließlich einer ordnungsgemäßen Behandlung nicht unterstützter Eingaben.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
linux, vscode
Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.