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 gdb/14762] New: finish broken with "set follow-fork child"


http://sourceware.org/bugzilla/show_bug.cgi?id=14762

             Bug #: 14762
           Summary: finish broken with "set follow-fork child"
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: palves@redhat.com
    Classification: Unclassified


>./gdb ./testsuite/gdb.base/foll-fork 
GNU gdb (GDB) 7.5.50.20121008-cvs
...
Reading symbols from
/home/pedro/gdb/mygit/build/gdb/testsuite/gdb.base/foll-fork...done.
...
(gdb) set follow-fork-mode child 
(gdb) start
Temporary breakpoint 1 at 0x40061d: file
../../../src/gdb/testsuite/gdb.base/foll-fork.c, line 23.
Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.base/foll-fork 

Temporary breakpoint 1, 
During symbol reading, incomplete CFI data; unspecified registers (e.g., rax)
at 0x400619.
main () at ../../../src/gdb/testsuite/gdb.base/foll-fork.c:23
23        int  v = 5;
(gdb) catch fork 
Catchpoint 2 (fork)
(gdb) c
Continuing.

Catchpoint 2 (forked process 11261), 0x0000003de92ba7a4 in __libc_fork () at
../nptl/sysdeps/unix/sysv/linux/fork.c:131
131       pid = ARCH_FORK ();
(gdb) finish
Run till exit from #0  0x0000003de92ba7a4 in __libc_fork () at
../nptl/sysdeps/unix/sysv/linux/fork.c:131
[New process 11261]
[Inferior 2 (process 11261) exited normally]
(gdb)

infrun.c:follow_fork has:

    case TARGET_WAITKIND_VFORKED:
      {
    ptid_t parent, child;

    /* If the user did a next/step, etc, over a fork call,
       preserve the stepping state in the fork child.  */
    if (follow_child && should_resume)
      {
        step_resume_breakpoint = clone_momentary_breakpoint
                     (tp->control.step_resume_breakpoint);
        step_range_start = tp->control.step_range_start;
        step_range_end = tp->control.step_range_end;
        step_frame_id = tp->control.step_frame_id;
        exception_resume_breakpoint
          = clone_momentary_breakpoint
(tp->control.exception_resume_breakpoint);

        /* For now, delete the parent's sr breakpoint, otherwise,
           parent/child sr breakpoints are considered duplicates,
           and the child version will not be installed.  Remove
           this when the breakpoints module becomes aware of
           inferiors and address spaces.  */
        delete_step_resume_breakpoint (tp);
        tp->control.step_range_start = 0;
        tp->control.step_range_end = 0;
        tp->control.step_frame_id = null_frame_id;
        delete_exception_resume_breakpoint (tp);
      }

But this only works for next/step & co.  "finish" manages its own momentary
breakpoint, and doesn't store it in the thread_info.  Other commands have other
state that would need copying.  A proper full fix needs a better design.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- 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]