Bug 29285 - gdb ignores stub socket disconnect when no program running
Summary: gdb ignores stub socket disconnect when no program running
Status: UNCONFIRMED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-25 07:13 UTC by Manfred Steiner
Modified: 2022-06-27 15:31 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Manfred Steiner 2022-06-25 07:13:52 UTC
I am working on git version commit 325600eb1175e6f989f201ae885c8fae82953264 (Thu Jun 23 00:00:24 2022 +0000).

When no (stub-)thread is active, gdb ignores the TCP FIN packet and does not close the remote debugging connection.

Steps to reproduce:

1) Shell 1: start gdbserver
   $ gdbserver --multi localhost:2424
   Listening on port 2424
   Remote debugging from host 127.0.0.1, port 33498
   Remote side has terminated connection.  GDBserver will reopen the connection.
   Listening on port 2424

2) Shell 2: start gdb
   $ gdb
   (gdb) target extended-remote localhost:2424
   Remote debugging using localhost:2424

3) close shell 1 (gdbServer) with CTRL-C
   -> TCP/FIN is send to gdb (but ignored there)

4) Shell 2
   (gdb) target extended-remote localhost:2424
   Already connected to a remote target.  Disconnect? (y or n) 

gdb thinks that connection to server is already open.

If you do the same with an established connection (thread) to a running program you get on gdb-server CTRL-C ...

  (gdb) c
  Continuing.
  Remote connection closed

If the program is not running, TCP FIN packet is also ignored and gdb thinks that connection is already established.