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
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ 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] 10+ 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
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ 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] 10+ 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
  2024-06-12 13:54 ` tromey at sourceware dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ 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] 10+ 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
@ 2024-06-12 13:54 ` tromey at sourceware dot org
  2024-06-12 14:37 ` mark at klomp dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tromey at sourceware dot org @ 2024-06-12 13:54 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|                            |b.r.longbons at gmail dot com

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
*** Bug 21454 has been marked as a duplicate of this bug. ***

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

^ permalink raw reply	[flat|nested] 10+ 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
                   ` (2 preceding siblings ...)
  2024-06-12 13:54 ` tromey at sourceware dot org
@ 2024-06-12 14:37 ` mark at klomp dot org
  2024-06-12 14:43 ` mark at klomp dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mark at klomp dot org @ 2024-06-12 14:37 UTC (permalink / raw)
  To: gdb-prs

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

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org

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

^ permalink raw reply	[flat|nested] 10+ 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
                   ` (3 preceding siblings ...)
  2024-06-12 14:37 ` mark at klomp dot org
@ 2024-06-12 14:43 ` mark at klomp dot org
  2024-08-26 14:45 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mark at klomp dot org @ 2024-06-12 14:43 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
Patch posted:
https://inbox.sourceware.org/gdb-patches/20240524211541.378520-1-wqferr@gmail.com/

Duplicate patch (now withdrawn, in favor of the above) for the same issue:
https://inbox.sourceware.org/gdb-patches/20240611221916.3146658-1-mark@klomp.org/

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

^ permalink raw reply	[flat|nested] 10+ 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
                   ` (4 preceding siblings ...)
  2024-06-12 14:43 ` mark at klomp dot org
@ 2024-08-26 14:45 ` cvs-commit at gcc dot gnu.org
  2024-08-27 18:18 ` tromey at sourceware dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-08-26 14:45 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andrew Burgess <aburgess@sourceware.org>:

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

commit a733b2c90463231d9fb8b143e168403d96efe54f
Author: William Ferreira <wqferr@gmail.com>
Date:   Thu Jul 18 16:38:31 2024 -0300

    gdb: imply --once if connecting via stdio

    Currently, gdbserver hangs after stdin is closed while it tries to
    write: "Remote side has terminated connection.  GDBserver will reopen
    the connection." This hang disappears if --once is also given. Since
    the stdin connection won't ever reopen if it's closed, it's safe to
    assume --once is desired.

    The gdb.server/server-pipe.exp test was also updated to reflect this
    change. There is now a second disconnect at the end of the proc,
    with a tighter-than-normal timeout to catch if the command hangs as
    it used to.

    Co-Authored-By: Guinevere Larsen <blarsen@redhat.com>
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29796

    Approved-By: Andrew Burgess <aburgess@redhat.com>

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

^ permalink raw reply	[flat|nested] 10+ 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
                   ` (5 preceding siblings ...)
  2024-08-26 14:45 ` cvs-commit at gcc dot gnu.org
@ 2024-08-27 18:18 ` tromey at sourceware dot org
  2024-11-16  7:24 ` brobecker at gnat dot com
  2024-11-16 14:08 ` mark at klomp dot org
  8 siblings, 0 replies; 10+ messages in thread
From: tromey at sourceware dot org @ 2024-08-27 18:18 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
----------------------------------------------------------------------------
   Target Milestone|---                         |16.1

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

^ permalink raw reply	[flat|nested] 10+ 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
                   ` (6 preceding siblings ...)
  2024-08-27 18:18 ` tromey at sourceware dot org
@ 2024-11-16  7:24 ` brobecker at gnat dot com
  2024-11-16 14:08 ` mark at klomp dot org
  8 siblings, 0 replies; 10+ messages in thread
From: brobecker at gnat dot com @ 2024-11-16  7:24 UTC (permalink / raw)
  To: gdb-prs

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

Joel Brobecker <brobecker at gnat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |brobecker at gnat dot com

--- Comment #5 from Joel Brobecker <brobecker at gnat dot com> ---
Hello! Looks like this PR can be closed (commit pushed to master last July)?

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

^ permalink raw reply	[flat|nested] 10+ 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
                   ` (7 preceding siblings ...)
  2024-11-16  7:24 ` brobecker at gnat dot com
@ 2024-11-16 14:08 ` mark at klomp dot org
  8 siblings, 0 replies; 10+ messages in thread
From: mark at klomp dot org @ 2024-11-16 14:08 UTC (permalink / raw)
  To: gdb-prs

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

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Mark Wielaard <mark at klomp dot org> ---
(In reply to Joel Brobecker from comment #5)
> Hello! Looks like this PR can be closed (commit pushed to master last July)?

Yes! It works perfectly too.

-- 
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-11-16 14:08 UTC | newest]

Thread overview: 10+ 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
2024-06-12 13:54 ` tromey at sourceware dot org
2024-06-12 14:37 ` mark at klomp dot org
2024-06-12 14:43 ` mark at klomp dot org
2024-08-26 14:45 ` cvs-commit at gcc dot gnu.org
2024-08-27 18:18 ` tromey at sourceware dot org
2024-11-16  7:24 ` brobecker at gnat dot com
2024-11-16 14:08 ` mark at klomp 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).