public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFC 0/3] [gdb/dap] Handle DAP command files
@ 2023-03-14 13:05 Tom de Vries
  2023-03-14 13:05 ` [RFC 1/3] [gdb/dap] Add logging of ignored lines Tom de Vries
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Tom de Vries @ 2023-03-14 13:05 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

After reporting a failure in test-case gdb.dap/bt-nodebug.exp, I tried to
reproduce the failure in the usual way, using "-q -batch -x gdb.in":
...
$ gdb -q -batch -iex "set debug dap-log-file dap.log" -i dap -x gdb.in
...
but that didn't work.  It seems that the interpreter reading in gdb.in doesn't
use DAP despite the "-i dap".  I also tried modifying gdb.in to use
interpreter-exec dap, but that didn't work for me, maybe it's possible though,
I don't know.

Then I tried:
...
$ gdb -q -iex "set debug dap-log-file dap.log" -i dap < gdb.in
...
which sort of works, but didn't reproduce the failure due to not waiting for
events, something that is dealt with in the test-case using
dap_wait_for_event_and_check.

So, I've added processing of an input line "WAIT_FOR_EVENTS: <n>" to fix that
problem (patch 3).

With editing gdb.in came the need to make it a bit more readable, so I made
it possible to start Content-Length at a new line (patch 2).

Also I've added a patch to log ignored input, which helps to debug parsing
issues (patch 1).

Using this patch series, and the following gdb.in, I managed to reproduce the
problem:
...
Content-Length: 54
WAIT_FOR_EVENTS: 1
{"seq": 1, "type": "request", "command": "initialize"}
Content-Length: 163
WAIT_FOR_EVENTS: 0
{"seq": 2, "type": "request", "command": "launch", "arguments": {"program": "bt-nodebug"}}
Content-Length: 136
WAIT_FOR_EVENTS: 2
{"seq": 3, "type": "request", "command": "setFunctionBreakpoints", "arguments": {"breakpoints": [{"name": "function_breakpoint_here"}]}}
Content-Length: 61
WAIT_FOR_EVENTS: 1
{"seq": 4, "type": "request", "command": "configurationDone"}
Content-Length: 84

{"seq": 5, "type": "request", "command": "stackTrace", "arguments": {"threadId": 1}}
Content-Length: 54

{"seq": 6, "type": "request", "command": "disconnect"}
...

Sofar, this hasn't actually helped me to investigate, when doing:
...
$ gdb --args gdb -q -iex "set debug dap-log-file dap.log" -i dap
...
followed by:
...
(gdb) run < gdb.in
...
I end up with:
...
(gdb) Undefined command: "Content-Length".  Try "help".
...
which AFAICT means that the input from gdb.in does end up in the inner gdb, but
is not parsed as DAP.

Tom de Vries (3):
  [gdb/dap] Add logging of ignored lines
  [gdb/dap] Allow Content-Length on separate line
  [gdb/dap] Allow WAIT_FOR_EVENTS input

 gdb/python/lib/gdb/dap/io.py     | 17 ++++++++++++++---
 gdb/python/lib/gdb/dap/server.py | 12 +++++++++++-
 2 files changed, 25 insertions(+), 4 deletions(-)


base-commit: c8b3d02c49943d1fef2cc060dd7115a5ae5f7afe
-- 
2.35.3


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-05-10 16:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14 13:05 [RFC 0/3] [gdb/dap] Handle DAP command files Tom de Vries
2023-03-14 13:05 ` [RFC 1/3] [gdb/dap] Add logging of ignored lines Tom de Vries
2023-03-14 14:12   ` Tom Tromey
2023-03-24  8:10     ` Tom de Vries
2023-03-14 13:05 ` [RFC 2/3] [gdb/dap] Allow Content-Length on separate line Tom de Vries
2023-03-14 14:13   ` Tom Tromey
2023-03-14 15:35     ` Tom de Vries
2023-05-05 13:09       ` Tom Tromey
2023-03-14 13:05 ` [RFC 3/3] [gdb/dap] Allow WAIT_FOR_EVENTS input Tom de Vries
2023-05-05 13:09   ` Tom Tromey
2023-05-05 14:01     ` Tom de Vries
2023-05-10 16:23       ` Tom Tromey
2023-05-10 16:29   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).