[RFC,1/3,gdb/dap] Add logging of ignored lines
Commit Message
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'>>>
...
---
gdb/python/lib/gdb/dap/io.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Comments
>>>>> "Tom" == Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes:
Tom> This input sequence is accepted by DAP:
Tom> ...
Tom> {"seq": 4, "type": "request", "command": "configurationDone"}Content-Length: 84
Tom> ...
Tom> This input sequence has the same effect:
Tom> ...
Tom> {"seq": 4, "type": "request", "command": "configurationDone"}ignorethis
Tom> Content-Length: 84
Tom> ...
Tom> but the 'ignorethis' part is silently ignored.
This is ok. Thank you.
Tom
On 3/14/23 15:12, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Tom> This input sequence is accepted by DAP:
> Tom> ...
> Tom> {"seq": 4, "type": "request", "command": "configurationDone"}Content-Length: 84
> Tom> ...
>
> Tom> This input sequence has the same effect:
> Tom> ...
> Tom> {"seq": 4, "type": "request", "command": "configurationDone"}ignorethis
> Tom> Content-Length: 84
> Tom> ...
> Tom> but the 'ignorethis' part is silently ignored.
>
> This is ok. Thank you.
Thanks for the review.
Committed after dropping the superfluous "import sys".
Thanks,
- Tom
@@ -14,8 +14,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import json
+import sys
-from .startup import start_thread, send_gdb
+from .startup import start_thread, send_gdb, log
def read_json(stream):
@@ -31,6 +32,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))