public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug dap/31217] New: dap throws exception when trying to rerun session
@ 2024-01-06 16:02 asn at samba dot org
  2024-01-08 23:23 ` [Bug dap/31217] " tromey at sourceware dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: asn at samba dot org @ 2024-01-06 16:02 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 31217
           Summary: dap throws exception when trying to rerun session
           Product: gdb
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: dap
          Assignee: unassigned at sourceware dot org
          Reporter: asn at samba dot org
  Target Milestone: ---

I've configured nvim-dap for gdb [1] and when try to use
require('dap').run_last() to restart the session, I run into an exception.



Exception in thread DAP:
Traceback (most recent call last):
  File "/usr/lib64/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/share/gdb/python/gdb/dap/startup.py", line 51, in really_start_dap
    target()
  File "/usr/share/gdb/python/gdb/dap/startup.py", line 73, in
ensure_dap_thread
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/gdb/python/gdb/dap/server.py", line 117, in main_loop
    cmd = read_json(self.in_stream)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/gdb/python/gdb/dap/io.py", line 37, in read_json
    while len(data) < content_length:
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'int' and 'NoneType'
Breakpoint 1 at 0x5096: file ../../source3/utils/smbget.c, line 119.

content_length gets initialized with None

[1] https://blog.cryptomilk.org/2024/01/02/neovim-dap-and-gdb-14-1/

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

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

* [Bug dap/31217] dap throws exception when trying to rerun session
  2024-01-06 16:02 [Bug dap/31217] New: dap throws exception when trying to rerun session asn at samba dot org
@ 2024-01-08 23:23 ` tromey at sourceware dot org
  2024-01-09  8:07 ` asn at samba dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2024-01-08 23:23 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
If you could get a trace of the protocol messages, that would be great.
One way to do it is to invoke gdb with

gdb -iex "set debug dap-log-file /tmp/log" -i=dap

gdb will then write to the log file.

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

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

* [Bug dap/31217] dap throws exception when trying to rerun session
  2024-01-06 16:02 [Bug dap/31217] New: dap throws exception when trying to rerun session asn at samba dot org
  2024-01-08 23:23 ` [Bug dap/31217] " tromey at sourceware dot org
@ 2024-01-09  8:07 ` asn at samba dot org
  2024-01-09  8:08 ` asn at samba dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: asn at samba dot org @ 2024-01-09  8:07 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Andreas Schneider <asn at samba dot org> ---
Created attachment 15291
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15291&action=edit
gdb-dap.log

Here is the requrested trace.

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

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

* [Bug dap/31217] dap throws exception when trying to rerun session
  2024-01-06 16:02 [Bug dap/31217] New: dap throws exception when trying to rerun session asn at samba dot org
  2024-01-08 23:23 ` [Bug dap/31217] " tromey at sourceware dot org
  2024-01-09  8:07 ` asn at samba dot org
@ 2024-01-09  8:08 ` asn at samba dot org
  2024-01-09 17:02 ` tromey at sourceware dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: asn at samba dot org @ 2024-01-09  8:08 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Andreas Schneider <asn at samba dot org> ---
I'm on Fedora 39: gdb-14.1-1.fc39.x86_64

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

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

* [Bug dap/31217] dap throws exception when trying to rerun session
  2024-01-06 16:02 [Bug dap/31217] New: dap throws exception when trying to rerun session asn at samba dot org
                   ` (2 preceding siblings ...)
  2024-01-09  8:08 ` asn at samba dot org
@ 2024-01-09 17:02 ` tromey at sourceware dot org
  2024-01-09 20:36 ` asn at samba dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2024-01-09 17:02 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-01-09
             Status|UNCONFIRMED                 |NEW
           Assignee|unassigned at sourceware dot org   |tromey at sourceware dot org

--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
Unfortunately the trace doesn't show the request after the
'terminate' request.  If you know of another way to get a trace
that shows this, that might be helpful.

But meanwhile I think terminate shouldn't cause the session to
end, which based on the exception is what seems to be happening.

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

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

* [Bug dap/31217] dap throws exception when trying to rerun session
  2024-01-06 16:02 [Bug dap/31217] New: dap throws exception when trying to rerun session asn at samba dot org
                   ` (3 preceding siblings ...)
  2024-01-09 17:02 ` tromey at sourceware dot org
@ 2024-01-09 20:36 ` asn at samba dot org
  2024-01-09 21:20 ` asn at samba dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: asn at samba dot org @ 2024-01-09 20:36 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Andreas Schneider <asn at samba dot org> ---
I could create you a minimal reproducer the next days.

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

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

* [Bug dap/31217] dap throws exception when trying to rerun session
  2024-01-06 16:02 [Bug dap/31217] New: dap throws exception when trying to rerun session asn at samba dot org
                   ` (4 preceding siblings ...)
  2024-01-09 20:36 ` asn at samba dot org
@ 2024-01-09 21:20 ` asn at samba dot org
  2024-01-10 19:01 ` tromey at sourceware dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: asn at samba dot org @ 2024-01-09 21:20 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 from Andreas Schneider <asn at samba dot org> ---
Created attachment 15292
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15292&action=edit
dap.tar.gz reproducer

Unpack the dap.tar.gz

There is a a.out in .repro/ for x86_64, but you can compile the test.c if you
want with: gcc -ggdb test.c

Open the file:
nvim -u repro.lua .repro/test.c

* Once in neovim
* Go to line 6
* Press F2 (sets breakpoint, you will get a 'B' before the line)
* Press F3 (opens dap UI)
* Press F5
* Select 2
* Path to executable: Point to .repro/a.out
* Argruments: wurst brot

Now you see the a '->' instead of a 'B' in line 6. The debugger started and
stopped at the line. lAso the UI should show the scope and the stack etc.

Now press F10 to restart the session. The repl window will show the python
backtrace. Logs are going to /tmp/gdb-dap.log.

F12 terminates the debugging session.

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

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

* [Bug dap/31217] dap throws exception when trying to rerun session
  2024-01-06 16:02 [Bug dap/31217] New: dap throws exception when trying to rerun session asn at samba dot org
                   ` (5 preceding siblings ...)
  2024-01-09 21:20 ` asn at samba dot org
@ 2024-01-10 19:01 ` tromey at sourceware dot org
  2024-01-10 20:09 ` tromey at sourceware dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2024-01-10 19:01 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #7 from Tom Tromey <tromey at sourceware dot org> ---
Thank you for the reproducer.  That makes this very easy!

I think this is just a generic error when shutting down.
In particular I think nvim is ending the connection, then
gdb is printing this exception from its reader.

gdb should shut down more cleanly in this case.

Also I see that nvim seems to send a full path name in
its breakpoint request, so my session wouldn't hit
the breakpoint because the path name was not found
in the executable.  That confused me for a bit but
recompiling cleared it up.

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

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

* [Bug dap/31217] dap throws exception when trying to rerun session
  2024-01-06 16:02 [Bug dap/31217] New: dap throws exception when trying to rerun session asn at samba dot org
                   ` (6 preceding siblings ...)
  2024-01-10 19:01 ` tromey at sourceware dot org
@ 2024-01-10 20:09 ` tromey at sourceware dot org
  2024-01-22 16:00 ` cvs-commit at gcc dot gnu.org
  2024-01-22 16:00 ` tromey at sourceware dot org
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2024-01-10 20:09 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #8 from Tom Tromey <tromey at sourceware dot org> ---
https://sourceware.org/pipermail/gdb-patches/2024-January/205825.html

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

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

* [Bug dap/31217] dap throws exception when trying to rerun session
  2024-01-06 16:02 [Bug dap/31217] New: dap throws exception when trying to rerun session asn at samba dot org
                   ` (7 preceding siblings ...)
  2024-01-10 20:09 ` tromey at sourceware dot org
@ 2024-01-22 16:00 ` cvs-commit at gcc dot gnu.org
  2024-01-22 16:00 ` tromey at sourceware dot org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-22 16:00 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #9 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=46bdb641642d20307521f5db2e1f1c7dcc49d5a7

commit 46bdb641642d20307521f5db2e1f1c7dcc49d5a7
Author: Tom Tromey <tromey@adacore.com>
Date:   Wed Jan 10 12:51:10 2024 -0700

    Handle EOF more gracefully in DAP

    A user pointed out that gdb will print a Python exception when it gets
    an EOF in DAP mode.  And, it turns out that an EOF like this also
    causes gdb not to exit.  This is due to the refactoring that moved the
    JSON reader to its own thread -- previously this caused an exception
    to propagate and cause an exit, but now it just leaves the reader
    hung.

    This patch fixes these problems by arranging to handle EOF more
    gracefully.

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

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

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

* [Bug dap/31217] dap throws exception when trying to rerun session
  2024-01-06 16:02 [Bug dap/31217] New: dap throws exception when trying to rerun session asn at samba dot org
                   ` (8 preceding siblings ...)
  2024-01-22 16:00 ` cvs-commit at gcc dot gnu.org
@ 2024-01-22 16:00 ` tromey at sourceware dot org
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2024-01-22 16:00 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |15.1

--- Comment #10 from Tom Tromey <tromey at sourceware dot org> ---
Fixed.

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

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

end of thread, other threads:[~2024-01-22 16:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-06 16:02 [Bug dap/31217] New: dap throws exception when trying to rerun session asn at samba dot org
2024-01-08 23:23 ` [Bug dap/31217] " tromey at sourceware dot org
2024-01-09  8:07 ` asn at samba dot org
2024-01-09  8:08 ` asn at samba dot org
2024-01-09 17:02 ` tromey at sourceware dot org
2024-01-09 20:36 ` asn at samba dot org
2024-01-09 21:20 ` asn at samba dot org
2024-01-10 19:01 ` tromey at sourceware dot org
2024-01-10 20:09 ` tromey at sourceware dot org
2024-01-22 16:00 ` cvs-commit at gcc dot gnu.org
2024-01-22 16:00 ` tromey at sourceware dot 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).