From 74609e7188f10d5e809774d81245232c18824fba Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Mon, 6 Sep 2010 13:10:28 +0000 Subject: [PATCH] 2010-09-06 Yao Qi * infrunc(resume): When inferior is waiting_for_vfork_done, clear step and don't use displaced stepping. --- gdb/ChangeLog | 5 +++++ gdb/infrun.c | 22 ++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f569efad71c..c7102765487 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2010-09-06 Yao Qi + + * infrunc(resume): When inferior is waiting_for_vfork_done, + clear step and don't use displaced stepping. + 2010-09-04 Daniel Jacobowitz * breakpoint.c (can_use_hardware_watchpoint): Handle the first diff --git a/gdb/infrun.c b/gdb/infrun.c index 031544633e9..b21fd3f33e4 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1560,6 +1560,19 @@ resume (int step, enum target_signal sig) QUIT; + /* Don't consider single-stepping when the inferior is + waiting_for_vfork_done, either software or hardware step. In + software step, child process will hit the software single step + breakpoint inserted in parent process. In hardware step, GDB + can resumes inferior, and wait for vfork_done event. */ + 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), " @@ -1587,11 +1600,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; -- 2.30.2