Spurious re-attach error with extended-remote target

Dmitry Antipov <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
It seems that an attempt to re-attach to an existing PID fails after
an (unsuccessful) attempt to attach to a non-existing one. Example:

$ gdbserver --attach tcp:8888 $(pidof test)
Attached; pid = 5128
Listening on port 8888
Remote debugging from host 127.0.0.1
Detaching from process 5128
gdbserver: Cannot attach to process 12345: No such process (3)
Listening on port 8888
Attached; pid = 5128           ;; gdbserver says it's OK, but...

$ ./gdb/gdb -q
(gdb) set sysroot /
(gdb) target extended-remote :8888
Remote debugging using :8888
Reading symbols from /tmp/test...done.
Reading symbols from /lib64/libstdc++.so.6...(no debugging symbols found)...done.
Reading symbols from /lib64/libm.so.6...(no debugging symbols found)...done.
Reading symbols from /lib64/libgcc_s.so.1...(no debugging symbols found)...done.
Reading symbols from /lib64/libpthread.so.0...(no debugging symbols found)...done.
Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
0x00007f8fb3fae83d in pthread_join () from /lib64/libpthread.so.0
(gdb) detach
Detaching from program: /tmp/test, process 5128
(gdb) attach 12345                                 ;; no process with specified PID
Attaching to program: /tmp/test, process 12345
Attaching to process 12345 failed
(gdb) attach 5128
Attaching to program: /tmp/test, process 5128      ;;; hmm...
Unknown remote qXfer reply: T0006:0000000000000000;07:c00f7d81ff7f0000;10:3de8fab38f7f0000;thread:1408;core:3;      ;;; problem?
(gdb)

(current HEAD at 57a024f4650d7562e963efb6b00c4a4cd74185c4, configured with
'--with-python=no --with-guile=no --disable-nls --disable-binutils --disable-ld
--disable-gold --disable-gas --disable-sim --disable-gprof').

Dmitry
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.