This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug breakpoints/20322] New: gdb misses breakpoints after call to clone()


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

            Bug ID: 20322
           Summary: gdb misses breakpoints after call to clone()
           Product: gdb
           Version: 7.11.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: dkondor at mit dot edu
  Target Milestone: ---

Created attachment 9376
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9376&action=edit
sample program which reproduces the problem when run in gdb

gdb does not stop on breakpoints after the inferior has called clone() (to be
more specific, the glibc wrapper for the Linux syscall of that name)

See the attached source file with a minimal test case; to reproduce, compile
as:
gcc -o gc gdbclone.c -g -pthread
(I'm not sure if the -pthread switch is needed or relevant here)

Run in gdb as:
gdb gc
break 79
run

Expected behavior:
program stops at line 79

Observed behavior:
program runs and exits; output in gdb:
Starting program: /home/dkondor/program/gc 
0
--------
1
[Inferior 1 (process 13717) exited normally]
(the numbers and the line are output from the program; the zero is from the
cloned process, the rest is from the main process)


Manually breaking execution (Ctrl-C) while the program is in the sleep() call
on line 78 "fixes" the problem; sample output:
(gdb) run
Starting program: /home/dkondor/program/gc 
0
^C
Program received signal SIGINT, Interrupt.
0x00007ffff7ad98c0 in __nanosleep_nocancel ()
    at ../sysdeps/unix/syscall-template.S:84
84      ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) cont
Continuing.

Breakpoint 1, main (argc=1, argv=0x7fffffffe0b8) at gdbclone.c:79
79              fprintf(f,"--------\n");
(gdb) cont
Continuing.
--------
1
[Inferior 1 (process 13761) exited normally]


BTW This does not happen with fork() (as suggested by bug #12363)


Other basic info:
Ubuntu 16.04, Linux 4.4.0, x86_64
gcc (Ubuntu 5.3.1-14ubuntu2.1) 5.3.1 20160413
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]