public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug server/29796] New: gdbserver should imply --once if connected via stdio
@ 2022-11-16 19:40 pedro at palves dot net
  2022-11-16 19:41 ` [Bug server/29796] " simon.marchi at polymtl dot ca
  2023-12-29  0:29 ` tromey at sourceware dot org
  0 siblings, 2 replies; 3+ messages in thread
From: pedro at palves dot net @ 2022-11-16 19:40 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29796
           Summary: gdbserver should imply --once if connected via stdio
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: server
          Assignee: unassigned at sourceware dot org
          Reporter: pedro at palves dot net
  Target Milestone: ---

(gdb) target extended-remote | gdbserver --multi -
Remote debugging using | gdbserver --multi -
Remote debugging using stdio
(gdb) quit
* hang for 5 seconds *

You get the hang plus the PIPE_CLOSE_TIMEOUT timeout, because gdbserver hangs
while writing:

  "Remote side has terminated connection.  GDBserver will reopen the
connection.\n"

to stderr.  Like so:

(gdb) bt
#0  0x00007fa124ff9077 in __GI___libc_write (fd=2, buf=0x560d25e89158,
nbytes=78) at ../sysdeps/unix/sysv/linux/write.c:26
#1  0x00007fa124f79e8d in _IO_new_file_write (f=0x7fa1250d85c0
<_IO_2_1_stderr_>, data=0x560d25e89158, n=78) at fileops.c:1176
#2  0x00007fa124f7a7a8 in new_do_write (to_do=<optimized out>,
data=0x560d25e89158 "Remote side has terminated connection.  GDBserver will
reopen the connection.\n", fp=0x7fa1250d85c0 <_IO_2_1_stderr_>) at libioP.h:948
#3  _IO_new_file_xsputn (n=78, data=<optimized out>, f=<optimized out>) at
fileops.c:1255
#4  _IO_new_file_xsputn (f=0x7fa1250d85c0 <_IO_2_1_stderr_>, data=<optimized
out>, n=78) at fileops.c:1197
#5  0x00007fa124f6e3c1 in __GI__IO_fwrite (buf=0x560d25e89158, size=1,
count=78, fp=0x7fa1250d85c0 <_IO_2_1_stderr_>) at libioP.h:948
#6  0x0000560d25e081c4 in captured_main (argc=3, argv=0x7ffcfd97ceb8) at
../../src/gdbserver/server.cc:4145
#7  0x0000560d25e0840f in main (argc=3, argv=0x7ffcfd97ceb8) at
../../src/gdbserver/server.cc:4211


If you pass --once to gdbserver, then the hang disappears, since gdbserver
exits as soon as the connection closes:

(gdb) target extended-remote | gdbserver --once --multi -
Remote debugging using | ../gdbserver/gdbserver --once --multi -
Remote debugging using stdio
(gdb) q
$ # got back the shell prompt immediately.


I'm thinking that gdbserver should auto-imply --once when connected via stdio.

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

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

* [Bug server/29796] gdbserver should imply --once if connected via stdio
  2022-11-16 19:40 [Bug server/29796] New: gdbserver should imply --once if connected via stdio pedro at palves dot net
@ 2022-11-16 19:41 ` simon.marchi at polymtl dot ca
  2023-12-29  0:29 ` tromey at sourceware dot org
  1 sibling, 0 replies; 3+ messages in thread
From: simon.marchi at polymtl dot ca @ 2022-11-16 19:41 UTC (permalink / raw)
  To: gdb-prs

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

Simon Marchi <simon.marchi at polymtl dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |good-first-bug
                 CC|                            |simon.marchi at polymtl dot ca

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

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

* [Bug server/29796] gdbserver should imply --once if connected via stdio
  2022-11-16 19:40 [Bug server/29796] New: gdbserver should imply --once if connected via stdio pedro at palves dot net
  2022-11-16 19:41 ` [Bug server/29796] " simon.marchi at polymtl dot ca
@ 2023-12-29  0:29 ` tromey at sourceware dot org
  1 sibling, 0 replies; 3+ messages in thread
From: tromey at sourceware dot org @ 2023-12-29  0:29 UTC (permalink / raw)
  To: gdb-prs

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

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> ---
Similar to bug#21454

If we want real remote/local parity, with the goal of replacing
the nat- targets with gdbserver, then I think this is a scenario
that should work without implying --once.
So, gdb shutdown should somehow cause a clean shutdown of gdbserver.

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

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

end of thread, other threads:[~2023-12-29  0:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-16 19:40 [Bug server/29796] New: gdbserver should imply --once if connected via stdio pedro at palves dot net
2022-11-16 19:41 ` [Bug server/29796] " simon.marchi at polymtl dot ca
2023-12-29  0:29 ` 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).