From: Yao Qi Date: Wed, 8 Sep 2010 12:25:19 +0000 (+0000) Subject: 2010-09-08 Yao Qi X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=026bcebb717a6bda3c8473edb4174b5cf303ab60;p=thirdparty%2Fbinutils-gdb.git 2010-09-08 Yao Qi Pedro Alves * infrunc(resume): When inferior is waiting_for_vfork_done, clear step and don't use displaced stepping. Extend comment on ignoring single-step requests on vfork parents waiting for a vfork-done. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7abb05a6480..48db57812d0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2010-09-08 Yao Qi + Pedro Alves + + * infrunc(resume): When inferior is waiting_for_vfork_done, + clear step and don't use displaced stepping. + Extend comment on ignoring single-step requests on vfork + parents waiting for a vfork-done. + 2010-09-03 Joel Brobecker * version.in: Set version to 7.2.0.20100903-cvs. diff --git a/gdb/infrun.c b/gdb/infrun.c index 54b1d9f1f74..3ac82f6afed 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1549,6 +1549,25 @@ resume (int step, enum target_signal sig) QUIT; + /* Don't try to single-step a vfork parent that is waiting for + the child to get out of the shared memory region (by exec'ing + or exiting). This is particularly important on software + single-step archs, as the child process would trip on the + software single step breakpoint inserted for the parent + process. Since the parent will not actually execute any + instruction until the child is out of the shared region (such + are vfork's semantics), it is safe to simply continue it. + Eventually, we'll see a TARGET_WAITKIND_VFORK_DONE event for + the parent, and tell it to `keep_going', which automatically + re-sets it stepping. */ + if (current_inferior ()->waiting_for_vfork_done) + { + if (debug_infrun) + fprintf_unfiltered (gdb_stdlog, + "infrun: resume : clear step\n"); + step = 0; + } + if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: resume (step=%d, signal=%d), " @@ -1576,11 +1595,16 @@ a command like `return' or `jump' to continue execution.")); We can't use displaced stepping when we have a signal to deliver; the comments for displaced_step_prepare explain why. The comments in the handle_inferior event for dealing with 'random - signals' explain what we do instead. */ + signals' explain what we do instead. + + We can't use displaced stepping when we are waiting for vfork_done + event, displaced stepping breaks the vfork child similarly as single + step software breakpoint. */ if (use_displaced_stepping (gdbarch) && (tp->trap_expected || (step && gdbarch_software_single_step_p (gdbarch))) - && sig == TARGET_SIGNAL_0) + && sig == TARGET_SIGNAL_0 + && !current_inferior ()->waiting_for_vfork_done) { struct displaced_step_inferior_state *displaced;