]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/ChangeLog
gdb: use interruptible_select when connecting to a remote
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 21 Jan 2021 19:04:52 +0000 (14:04 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 21 Jan 2021 19:04:52 +0000 (14:04 -0500)
commit439706e6a907b54658714a358b220febc63a0182
tree885bc354b9501dfff4ff3c729410bb1fcd184ffa
parent730af66356b3181784c72b3ddd5cb23dd09a2ef3
gdb: use interruptible_select when connecting to a remote

When GDB is waiting trying to connect to a remote target and it receives
a SIGWINCH (terminal gets resized), the blocking system call gets
interrupted and we abort.

For example, I connect to some port (on which nothing listens):

    (gdb) tar rem :1234
    ... GDB blocks here, resize the terminal ...
    :1234: Interrupted system call.

The backtrace where GDB is blocked while waiting for the connection to
establish is:

    #0  0x00007fe9db805b7b in select () from /usr/lib/libc.so.6
    #1  0x000055f2472e9c42 in gdb_select (n=0, readfds=0x0, writefds=0x0, exceptfds=0x0, timeout=0x7ffe8fafe050) at /home/simark/src/binutils-gdb/gdb/posix-hdep.c:31
    #2  0x000055f24759c212 in wait_for_connect (sock=-1, polls=0x7ffe8fafe300) at /home/simark/src/binutils-gdb/gdb/ser-tcp.c:147
    #3  0x000055f24759d0e8 in net_open (scb=0x62500015b900, name=0x6020000601d8 ":1234") at /home/simark/src/binutils-gdb/gdb/ser-tcp.c:356
    #4  0x000055f2475a0395 in serial_open_ops_1 (ops=0x55f24892ca60 <tcp_ops>, open_name=0x6020000601d8 ":1234") at /home/simark/src/binutils-gdb/gdb/serial.c:244
    #5  0x000055f2475a01d6 in serial_open (name=0x6020000601d8 ":1234") at /home/simark/src/binutils-gdb/gdb/serial.c:231
    #6  0x000055f2474d5274 in remote_serial_open (name=0x6020000601d8 ":1234") at /home/simark/src/binutils-gdb/gdb/remote.c:5019
    #7  0x000055f2474d7025 in remote_target::open_1 (name=0x6020000601d8 ":1234", from_tty=1, extended_p=0) at /home/simark/src/binutils-gdb/gdb/remote.c:5571
    #8  0x000055f2474d47d5 in remote_target::open (name=0x6020000601d8 ":1234", from_tty=1) at /home/simark/src/binutils-gdb/gdb/remote.c:4898
    #9  0x000055f24776379f in open_target (args=0x6020000601d8 ":1234", from_tty=1, command=0x611000042bc0) at /home/simark/src/binutils-gdb/gdb/target.c:242

Fix that by using interruptible_select in wait_for_connect, instead of
gdb_select.  Resizing the terminal now no longer aborts the connection.
It is still possible to interrupt the connection using ctrl-c.

gdb/ChangeLog:

* ser-tcp.c (wait_for_connect): Use interruptible_select instead
of gdb_select.

Change-Id: Ie25577bd1e5699e4847b6b53fdfa10b8c0dc5c89
gdb/ChangeLog
gdb/ser-tcp.c