This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] stepping over thread-specific BP
- To: gdb-patches at sources dot redhat dot com
- Subject: [PATCH] stepping over thread-specific BP
- From: Michael Snyder <msnyder at cygnus dot com>
- Date: Fri, 01 Jun 2001 16:22:10 -0700
- Organization: Red Hat
A long time ago (February of 1999), I spotted something in infrun.c
that didn't look right, and tossed in a comment that said:
FIXME: shouldn't we look at currently_stepping()?
Well, I've finally happened upon the behavior that proves that
yes indeed, we should. The context is when you have a
thread-specific breakpoint, and it gets hit by the wrong thread.
You have to single-step the current thread to get past the
breakpoint before reinserting breakpoints and resuming.
But when you resume -- should you step or should you continue?
That's what this patch addresses. Without this change, a thread
that was stepping hits another thread's breakpoint, steps over it,
but then just continues instead of stepping.
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.33
diff -c -3 -p -r1.33 infrun.c
*** infrun.c 2001/05/15 00:03:36 1.33
--- infrun.c 2001/06/01 23:13:33
*************** handle_inferior_event (struct execution_
*** 1472,1483 ****
/* We need to restart all the threads now,
* unless we're running in scheduler-locked mode.
! * FIXME: shouldn't we look at currently_stepping ()?
*/
if (scheduler_mode == schedlock_on)
! target_resume (ecs->ptid, 0, TARGET_SIGNAL_0);
else
! target_resume (RESUME_ALL, 0, TARGET_SIGNAL_0);
ecs->infwait_state = infwait_normal_state;
prepare_to_wait (ecs);
return;
--- 1472,1487 ----
/* We need to restart all the threads now,
* unless we're running in scheduler-locked mode.
! * Use currently_stepping to determine whether to
! * step or continue.
*/
+
if (scheduler_mode == schedlock_on)
! target_resume (ecs->ptid,
! currently_stepping (ecs), TARGET_SIGNAL_0);
else
! target_resume (RESUME_ALL,
! currently_stepping (ecs), TARGET_SIGNAL_0);
ecs->infwait_state = infwait_normal_state;
prepare_to_wait (ecs);
return;
*************** handle_inferior_event (struct execution_
*** 1879,1884 ****
--- 1883,1903 ----
if (remove_status != 0)
{
write_pc_pid (stop_pc - DECR_PC_AFTER_BREAK + 4, ecs->ptid);
+ /* We need to restart all the threads now,
+ * unles we're running in scheduler-locked mode.
+ * Use currently_stepping to determine whether to
+ * step or continue.
+ */
+ if (scheduler_mode == schedlock_on)
+ target_resume (ecs->ptid,
+ currently_stepping (ecs),
+ TARGET_SIGNAL_0);
+ else
+ target_resume (RESUME_ALL,
+ currently_stepping (ecs),
+ TARGET_SIGNAL_0);
+ prepare_to_wait (ecs);
+ return;
}
else
{ /* Single step */
*************** handle_inferior_event (struct execution_
*** 1892,1908 ****
prepare_to_wait (ecs);
return;
}
-
- /* We need to restart all the threads now,
- * unles we're running in scheduler-locked mode.
- * FIXME: shouldn't we look at currently_stepping ()?
- */
- if (scheduler_mode == schedlock_on)
- target_resume (ecs->ptid, 0, TARGET_SIGNAL_0);
- else
- target_resume (RESUME_ALL, 0, TARGET_SIGNAL_0);
- prepare_to_wait (ecs);
- return;
}
else
{
--- 1911,1916 ----