Bug 29968 - [gdb/dap] silent exceptions when using DAP
Summary: [gdb/dap] silent exceptions when using DAP
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: dap (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2023-01-06 13:53 UTC by Tom de Vries
Modified: 2024-05-08 18:48 UTC (History)
1 user (show)

See Also:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2023-01-06 13:53:54 UTC
When reproducing the problem fixed by commit 954a1f9183c ("[gdb/python] Avoid queue.SimpleQueue for python 3.6"), by reverting the commit, I get:
$ gdb -q -i dap
So gdb, just exits.

By echoing the exit status I get confirmation that indeed something is wrong:
$ gdb -q -i dap; echo $?

Only by debugging and doing catch throw do I find out that I'm running into a python exception.

It would be nice if gdb would somehow print exceptions.

By doing catch catch do I see that indeed exception_print is called in gdb_main:
1329          exception_print (gdb_stderr, ex);
with the exception ex containing the desired message, but that seems to have no visible effect.

I tried some obvious-looking things after executing the exception_print, trying to get the printed text to somehow appear:
(gdb) call (void)fflush (0)
(gdb) call gdb_flush (*current_ui_gdb_stderr_ptr ())
(gdb) call gdb_flush (*current_ui_gdb_stdout_ptr ())
(gdb) call (void)fflush (0)
but no luck.
Comment 1 Tom Tromey 2023-01-06 19:34:03 UTC
I don't think gdb can really print anything, because
the output has to follow the JSON-RPC protocol.
Previously I had this mode not redirect stderr,
but that turned out not to work with the client we're using.
There is a logging setting that the test suite uses though.