public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug dap/31386] New: [gdb/dap] Race between dap startup and dap log file initialization
@ 2024-02-15 19:45 vries at gcc dot gnu.org
  2024-02-15 20:05 ` [Bug dap/31386] " vries at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: vries at gcc dot gnu.org @ 2024-02-15 19:45 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31386

            Bug ID: 31386
           Summary: [gdb/dap] Race between dap startup and dap log file
                    initialization
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dap
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

In dap-support.exp, dap_gdb_start we do:
...
        append GDBFLAGS " -iex \"set debug dap-log-file $logfile\" -q -i=dap"
...

While the dap log file setting comes before the dap interpreter setting, that's
not the order in which things happen.

Consequently, there's a race between dap interpreter startup and dap log file
initialization.

The logging procs are setup to just do nothing if the log file is not yet
initialized.

I found this by adding this to gdb.dap/eof.exp (dap_check_log_file_re not yet
in trunk):
...
diff --git a/gdb/testsuite/gdb.dap/eof.exp b/gdb/testsuite/gdb.dap/eof.exp
index 9c17725c0d0..a64ac227880 100644
--- a/gdb/testsuite/gdb.dap/eof.exp
+++ b/gdb/testsuite/gdb.dap/eof.exp
@@ -35,3 +35,8 @@ catch "wait -i $gdb_spawn_id"
 unset gdb_spawn_id

 dap_check_log_file
+dap_check_log_file_re "JSON writer: terminating"
+dap_check_log_file_re "JSON reader: terminating"
+dap_check_log_file_re "DAP: terminating"
+dap_check_log_file_re "WROTE:"
+dap_check_log_file_re "READ:"
...
and the last check fails regularly, because the initial request:
...
READ: <<<{"seq": 1, "type": "request", "command": "initialize", "arguments":
{"clientID": "gdb testsuite", "supportsVariableType": true,
"supportsVariablePaging": true, "supportsMemoryReferences": true}}>>>
...
is often not logged.

I also tried using -eiex but that happens before interpreter setup, which means
the "set debug dap-log-file" command hasn't been setup yet, so there's no log
file at all.

I wondered whether to classify with component testsuite, but I think it should
be dap because it's a bug if we can't log a complete dap session.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2024-02-22 10:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-15 19:45 [Bug dap/31386] New: [gdb/dap] Race between dap startup and dap log file initialization vries at gcc dot gnu.org
2024-02-15 20:05 ` [Bug dap/31386] " vries at gcc dot gnu.org
2024-02-16  2:48 ` tromey at sourceware dot org
2024-02-16  9:36 ` vries at gcc dot gnu.org
2024-02-16 11:46 ` vries at gcc dot gnu.org
2024-02-16 17:24 ` tromey at sourceware dot org
2024-02-19  8:25 ` vries at gcc dot gnu.org
2024-02-19  8:47 ` vries at gcc dot gnu.org
2024-02-22 10:35 ` cvs-commit at gcc dot gnu.org
2024-02-22 10:39 ` vries at gcc dot gnu.org

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).