diff options
author | Tom de Vries <tdevries@suse.de> | 2023-03-24 09:08:10 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2023-03-24 09:08:10 +0100 |
commit | 8ee55b880fbabe0a20bf4adc1ba68307ba8a02be (patch) | |
tree | be59aa935a910c7785cee72fafcc5b0d463552ef | |
parent | 232c5cec145a21e3cf602e86a90dec4bc5f9ca67 (diff) | |
download | binutils-8ee55b880fbabe0a20bf4adc1ba68307ba8a02be.zip binutils-8ee55b880fbabe0a20bf4adc1ba68307ba8a02be.tar.gz binutils-8ee55b880fbabe0a20bf4adc1ba68307ba8a02be.tar.bz2 |
[gdb/dap] Add logging of ignored lines
This input sequence is accepted by DAP:
...
{"seq": 4, "type": "request", "command": "configurationDone"}Content-Length: 84
...
This input sequence has the same effect:
...
{"seq": 4, "type": "request", "command": "configurationDone"}ignorethis
Content-Length: 84
...
but the 'ignorethis' part is silently ignored.
Log the ignored bit, such that we have:
...
READ: <<<{"seq": 4, "type": "request", "command": "configurationDone"}>>>
WROTE: <<<{"request_seq": 4, "type": "response", "command": "configurationDone"
, "success": true}>>>
+++ run
IGNORED: <<<b'ignorethis'>>>
...
-rw-r--r-- | gdb/python/lib/gdb/dap/io.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/python/lib/gdb/dap/io.py b/gdb/python/lib/gdb/dap/io.py index 74cc823..7cec7b0 100644 --- a/gdb/python/lib/gdb/dap/io.py +++ b/gdb/python/lib/gdb/dap/io.py @@ -15,7 +15,7 @@ import json -from .startup import start_thread, send_gdb +from .startup import start_thread, send_gdb, log def read_json(stream): @@ -31,6 +31,8 @@ def read_json(stream): if line.startswith(b"Content-Length:"): line = line[15:].strip() content_length = int(line) + continue + log("IGNORED: <<<%s>>>" % line) data = bytes() while len(data) < content_length: new_data = stream.read(content_length - len(data)) |