public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/27055] New: Attaching to a process in non-stop mode doesn't work
@ 2020-12-11 16:38 simark at simark dot ca
  2020-12-23 16:13 ` [Bug gdb/27055] " simark at simark dot ca
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: simark at simark dot ca @ 2020-12-11 16:38 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 27055
           Summary: Attaching to a process in non-stop mode doesn't work
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: simark at simark dot ca
  Target Milestone: ---

The program a.out is a simple infinite loop:

#include <unistd.h>

int main() {
    for (;;) {
        sleep (5);
    }
}


Attaching to the process in non-stop mode gives this:

$ ./gdb -q -nx --data-directory=data-directory -ex "set non-stop on"
(gdb) attach 2896612
Attaching to process 2896612
No unwaited-for children left.
(gdb) i th
  Id   Target Id               Frame 
* 1    process 2896612 "a.out" 0xc856e334 in ?? ()
(gdb) bt
#0  0xc856e334 in ?? ()

The state seems a bit broken.  However, continuing and doing ^C makes GDB fall
back on its feet:

(gdb) c
Continuing.
^C
Program received signal SIGINT, Interrupt.
0xc856e334 in ?? ()
Reading symbols from /home/smarchi/build/binutils-gdb-all-targets/gdb/a.out...
Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...
Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libc-2.31.so...
Reading symbols from /lib64/ld-linux-x86-64.so.2...
Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/ld-2.31.so...

Program received signal SIGINT, Interrupt.
0x00007f01c856e334 in __GI___clock_nanosleep (clock_id=<optimized out>,
clock_id@entry=0, flags=flags@entry=0, req=req@entry=0x7ffc5dbb6f70,
rem=rem@entry=0x7ffc5dbb6f70) at
../sysdeps/unix/sysv/linux/clock_nanosleep.c:78
78      ../sysdeps/unix/sysv/linux/clock_nanosleep.c: No such file or
directory.
(gdb) bt
#0  0x00007f01c856e334 in __GI___clock_nanosleep (clock_id=<optimized out>,
clock_id@entry=0, 
    flags=flags@entry=0, req=req@entry=0x7ffc5dbb6f70,
rem=rem@entry=0x7ffc5dbb6f70)
    at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:78
#1  0x00007f01c8574047 in __GI___nanosleep (
    requested_time=requested_time@entry=0x7ffc5dbb6f70, 
    remaining=remaining@entry=0x7ffc5dbb6f70) at nanosleep.c:27
#2  0x00007f01c8573f7e in __sleep (seconds=0) at ../sysdeps/posix/sleep.c:55
#3  0x0000563bb85cb15b in main () at test.c:7


A second test is making GDB attach to a process while another one is running:

$ ./gdb -q -nx --data-directory=data-directory a.out -ex "set non-stop on" -ex
"r&" -ex "add-inferior" -ex "inferior 2"
Reading symbols from a.out...
Starting program: /home/smarchi/build/binutils-gdb-all-targets/gdb/a.out 
[New inferior 2]
Added inferior 2 on connection 1 (native)
[Switching to inferior 2 [<null>] (<noexec>)]
(gdb) attach 2896985
Attaching to process 2896985
^C^C^C^C

The attach doesn't go through and GDB doesn't respond to inputs.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-03  1:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11 16:38 [Bug gdb/27055] New: Attaching to a process in non-stop mode doesn't work simark at simark dot ca
2020-12-23 16:13 ` [Bug gdb/27055] " simark at simark dot ca
2021-02-03  1:16 ` cvs-commit at gcc dot gnu.org
2021-02-03  1:36 ` palves at redhat dot com

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).