From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6566D382FAF9; Wed, 16 Nov 2022 19:40:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6566D382FAF9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668627603; bh=GZ0KwP7hX9tDkkV1WRKSrguvP3nOGTARKXuM6nNBtDc=; h=From:To:Subject:Date:From; b=WE609oPtux3k50/zSjmyLpu9kN5CmP4zj16cMytywBkDR52Fpnyc+gGJtyEUlwoZ3 6keFZO+zrYgwvN/FjR3O2JWTWB60lTNBq2BzxhZWPSBi23dY4hd9CgCxwAdWFWiyuv rQTM06Ree8ZpRh0kAcsWcHRiol+XTqhTXbqHQqGg= From: "pedro at palves dot net" To: gdb-prs@sourceware.org Subject: [Bug server/29796] New: gdbserver should imply --once if connected via stdio Date: Wed, 16 Nov 2022 19:40:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: server X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pedro at palves dot net X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29796 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 han= gs 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=3D2, buf=3D0x560d25e89158, nbytes=3D78) at ../sysdeps/unix/sysv/linux/write.c:26 #1 0x00007fa124f79e8d in _IO_new_file_write (f=3D0x7fa1250d85c0 <_IO_2_1_stderr_>, data=3D0x560d25e89158, n=3D78) at fileops.c:1176 #2 0x00007fa124f7a7a8 in new_do_write (to_do=3D, data=3D0x560d25e89158 "Remote side has terminated connection. GDBserver wi= ll reopen the connection.\n", fp=3D0x7fa1250d85c0 <_IO_2_1_stderr_>) at libioP= .h:948 #3 _IO_new_file_xsputn (n=3D78, data=3D, f=3D) at fileops.c:1255 #4 _IO_new_file_xsputn (f=3D0x7fa1250d85c0 <_IO_2_1_stderr_>, data=3D, n=3D78) at fileops.c:1197 #5 0x00007fa124f6e3c1 in __GI__IO_fwrite (buf=3D0x560d25e89158, size=3D1, count=3D78, fp=3D0x7fa1250d85c0 <_IO_2_1_stderr_>) at libioP.h:948 #6 0x0000560d25e081c4 in captured_main (argc=3D3, argv=3D0x7ffcfd97ceb8) at ../../src/gdbserver/server.cc:4145 #7 0x0000560d25e0840f in main (argc=3D3, argv=3D0x7ffcfd97ceb8) 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 std= io. --=20 You are receiving this mail because: You are on the CC list for the bug.=