public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFC 0/3] [gdb/dap] Handle DAP command files
Date: Tue, 14 Mar 2023 14:05:32 +0100	[thread overview]
Message-ID: <20230314130535.6369-1-tdevries@suse.de> (raw)

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


             reply	other threads:[~2023-03-14 13:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-14 13:05 Tom de Vries [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230314130535.6369-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).