keiths / rpms / gdb

Forked from rpms/gdb 10 days ago
Clone
c78c51c
2007-06-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
c78c51c
c78c51c
	* inferior.h (enum resume_step): New definition.
c78c51c
	(resume): Change STEP parameter type to ENUM RESUME_STEP.
c78c51c
	* infrun.c (resume): Likewise.  Extend debug printing of the STEP
c78c51c
	parameter.  Lock the scheduler only for intentional stepping.
c78c51c
	(proceed): Replace the variable ONESTEP with tristate RESUME_STEP.
c78c51c
	Set the third RESUME_STEP state according to BPSTAT_SHOULD_STEP.
c78c51c
	(currently_stepping): Change the return type to ENUM RESUME_STEP.
c78c51c
	Return RESUME_STEP_NEEDED if it is just due to BPSTAT_SHOULD_STEP.
c78c51c
	* linux-nat.c (select_singlestep_lwp_callback): Do not focus on
c78c51c
	the software watchpoint events.
c78c51c
	* linux-nat.h (struct lwp_info): Redeclare STEP as ENUM RESUME_STEP.
c78c51c
cc17157
2007-10-19  Jan Kratochvil  <jan.kratochvil@redhat.com>
cc17157
cc17157
	* infrun.c (proceed): RESUME_STEP initialized for non-stepping.
cc17157
	RESUME_STEP set according to STEP only at the end of the function.
cc17157
25ff8a1
2008-02-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
25ff8a1
25ff8a1
	Port to GDB-6.8pre.
25ff8a1
25ff8a1
Index: gdb-6.8cvs20080219/gdb/inferior.h
25ff8a1
===================================================================
25ff8a1
--- gdb-6.8cvs20080219.orig/gdb/inferior.h	2008-02-14 23:03:57.000000000 +0100
25ff8a1
+++ gdb-6.8cvs20080219/gdb/inferior.h	2008-02-19 14:15:01.000000000 +0100
25ff8a1
@@ -179,7 +179,15 @@ extern void reopen_exec_file (void);
5a72cda
 /* The `resume' routine should only be called in special circumstances.
5a72cda
    Normally, use `proceed', which handles a lot of bookkeeping.  */
5a72cda
 
5a72cda
-extern void resume (int, enum target_signal);
5a72cda
+enum resume_step
5a72cda
+  {
5a72cda
+    /* currently_stepping () should return non-zero for non-continue.  */
5a72cda
+    RESUME_STEP_CONTINUE = 0,
5a72cda
+    RESUME_STEP_USER,		/* Stepping is intentional by the user.  */
5a72cda
+    RESUME_STEP_NEEDED		/* Stepping only for software watchpoints.  */
5a72cda
+  };
5a72cda
+
5a72cda
+extern void resume (enum resume_step, enum target_signal);
5a72cda
 
5a72cda
 /* From misc files */
5a72cda
 
25ff8a1
Index: gdb-6.8cvs20080219/gdb/infrun.c
25ff8a1
===================================================================
25ff8a1
--- gdb-6.8cvs20080219.orig/gdb/infrun.c	2008-02-14 23:03:57.000000000 +0100
25ff8a1
+++ gdb-6.8cvs20080219/gdb/infrun.c	2008-02-19 14:24:37.000000000 +0100
25ff8a1
@@ -74,7 +74,8 @@ static void set_schedlock_func (char *ar
5a72cda
 
5a72cda
 struct execution_control_state;
5a72cda
 
5a72cda
-static int currently_stepping (struct execution_control_state *ecs);
5a72cda
+static enum resume_step currently_stepping (struct execution_control_state
5a72cda
+									  *ecs);
5a72cda
 
5a72cda
 static void xdb_handle_command (char *args, int from_tty);
5a72cda
 
25ff8a1
@@ -508,15 +509,18 @@ set_schedlock_func (char *args, int from
5a72cda
    STEP nonzero if we should step (zero to continue instead).
5a72cda
    SIG is the signal to give the inferior (zero for none).  */
5a72cda
 void
5a72cda
-resume (int step, enum target_signal sig)
5a72cda
+resume (enum resume_step step, enum target_signal sig)
5a72cda
 {
5a72cda
   int should_resume = 1;
5a72cda
   struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
5a72cda
   QUIT;
5a72cda
 
5a72cda
   if (debug_infrun)
5a72cda
-    fprintf_unfiltered (gdb_stdlog, "infrun: resume (step=%d, signal=%d)\n",
5a72cda
-			step, sig);
5a72cda
+    fprintf_unfiltered (gdb_stdlog, "infrun: resume (step=%s, signal=%d)\n",
5a72cda
+			(step == RESUME_STEP_CONTINUE ? "RESUME_STEP_CONTINUE"
5a72cda
+			: (step == RESUME_STEP_USER ? "RESUME_STEP_USER"
5a72cda
+			                            : "RESUME_STEP_NEEDED")),
5a72cda
+			sig);
5a72cda
 
5a72cda
   /* FIXME: calling breakpoint_here_p (read_pc ()) three times! */
5a72cda
 
25ff8a1
@@ -632,9 +636,10 @@ a command like `return' or `jump' to con
c78c51c
 	  resume_ptid = inferior_ptid;
c78c51c
 	}
5a72cda
 
c78c51c
-      if ((scheduler_mode == schedlock_on)
c78c51c
+      if (scheduler_mode == schedlock_on
5a72cda
 	  || (scheduler_mode == schedlock_step
5a72cda
-	      && (step || singlestep_breakpoints_inserted_p)))
5a72cda
+	      && (step == RESUME_STEP_USER
5a72cda
+		  || singlestep_breakpoints_inserted_p)))
5a72cda
 	{
5a72cda
 	  /* User-settable 'scheduler' mode requires solo thread resume. */
5a72cda
 	  resume_ptid = inferior_ptid;
25ff8a1
@@ -742,7 +747,7 @@ static CORE_ADDR prev_pc;
5a72cda
 void
5a72cda
 proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
5a72cda
 {
5a72cda
-  int oneproc = 0;
cc17157
+  enum resume_step resume_step = RESUME_STEP_CONTINUE;
5a72cda
 
5a72cda
   if (step > 0)
5a72cda
     step_start_function = find_pc_function (read_pc ());
25ff8a1
@@ -756,13 +761,13 @@ proceed (CORE_ADDR addr, enum target_sig
5a72cda
 	   step one instruction before inserting breakpoints so that
5a72cda
 	   we do not stop right away (and report a second hit at this
5a72cda
 	   breakpoint).  */
5a72cda
-	oneproc = 1;
5a72cda
+	resume_step = RESUME_STEP_USER;
5a72cda
       else if (gdbarch_single_step_through_delay_p (current_gdbarch)
5a72cda
               && gdbarch_single_step_through_delay (current_gdbarch,
5a72cda
                                                     get_current_frame ()))
5a72cda
 	/* We stepped onto an instruction that needs to be stepped
5a72cda
 	   again before re-inserting the breakpoint, do so.  */
5a72cda
-	oneproc = 1;
5a72cda
+	resume_step = RESUME_STEP_USER;
5a72cda
     }
5a72cda
   else
5a72cda
     {
25ff8a1
@@ -786,9 +791,9 @@ proceed (CORE_ADDR addr, enum target_sig
5a72cda
      that reported the most recent event.  If a step-over is required
5a72cda
      it returns TRUE and sets the current thread to the old thread. */
25ff8a1
   if (prepare_to_proceed (step))
5a72cda
-    oneproc = 1;
5a72cda
+    resume_step = RESUME_STEP_USER;
5a72cda
 
5a72cda
-  if (oneproc)
5a72cda
+  if (resume_step == RESUME_STEP_USER)
5a72cda
     /* We will get a trace trap after one instruction.
5a72cda
        Continue it automatically and insert breakpoints then.  */
25ff8a1
     stepping_over_breakpoint = 1;
25ff8a1
@@ -832,8 +837,13 @@ proceed (CORE_ADDR addr, enum target_sig
5a72cda
      updated correctly when the inferior is stopped.  */
5a72cda
   prev_pc = read_pc ();
5a72cda
 
cc17157
+  if (step)
cc17157
+    resume_step = RESUME_STEP_USER;
5a72cda
+  if (resume_step == RESUME_STEP_CONTINUE && bpstat_should_step ())
5a72cda
+    resume_step = RESUME_STEP_NEEDED;
5a72cda
+
5a72cda
   /* Resume inferior.  */
5a72cda
-  resume (oneproc || step || bpstat_should_step (), stop_signal);
5a72cda
+  resume (resume_step, stop_signal);
5a72cda
 
5a72cda
   /* Wait for it to stop (if not standalone)
5a72cda
      and in any case decode why it stopped, and act accordingly.  */
25ff8a1
@@ -2723,14 +2733,21 @@ process_event_stop_test:
5a72cda
 
5a72cda
 /* Are we in the middle of stepping?  */
5a72cda
 
5a72cda
-static int
5a72cda
+static enum resume_step
5a72cda
 currently_stepping (struct execution_control_state *ecs)
5a72cda
 {
5a72cda
-  return ((!ecs->handling_longjmp
5a72cda
-	   && ((step_range_end && step_resume_breakpoint == NULL)
25ff8a1
-	       || stepping_over_breakpoint))
5a72cda
-	  || ecs->stepping_through_solib_after_catch
5a72cda
-	  || bpstat_should_step ());
5a72cda
+  if (!ecs->handling_longjmp
25ff8a1
+      && ((step_range_end && step_resume_breakpoint == NULL)
25ff8a1
+	  || stepping_over_breakpoint))
5a72cda
+    return RESUME_STEP_USER;
5a72cda
+
5a72cda
+  if (ecs->stepping_through_solib_after_catch)
5a72cda
+    return RESUME_STEP_USER;
5a72cda
+
5a72cda
+  if (bpstat_should_step ())
5a72cda
+    return RESUME_STEP_NEEDED;
5a72cda
+
5a72cda
+  return RESUME_STEP_CONTINUE;
5a72cda
 }
5a72cda
 
5a72cda
 /* Subroutine call with source code we should not step over.  Do step
25ff8a1
Index: gdb-6.8cvs20080219/gdb/linux-nat.c
25ff8a1
===================================================================
25ff8a1
--- gdb-6.8cvs20080219.orig/gdb/linux-nat.c	2008-02-14 23:03:57.000000000 +0100
25ff8a1
+++ gdb-6.8cvs20080219/gdb/linux-nat.c	2008-02-19 14:15:01.000000000 +0100
25ff8a1
@@ -1751,7 +1751,10 @@ count_events_callback (struct lwp_info *
c78c51c
 static int
c78c51c
 select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
c78c51c
 {
c78c51c
-  if (lp->step && lp->status != 0)
c78c51c
+  /* We do not focus on software watchpoints as we would not catch
c78c51c
+     STEPPING_PAST_SINGLESTEP_BREAKPOINT breakpoints in some other thread
c78c51c
+     as they would remain pending due to `Push back breakpoint for %s'.  */
c78c51c
+  if (lp->step == RESUME_STEP_USER && lp->status != 0)
c78c51c
     return 1;
c78c51c
   else
c78c51c
     return 0;
25ff8a1
Index: gdb-6.8cvs20080219/gdb/linux-nat.h
25ff8a1
===================================================================
25ff8a1
--- gdb-6.8cvs20080219.orig/gdb/linux-nat.h	2008-02-14 23:03:58.000000000 +0100
25ff8a1
+++ gdb-6.8cvs20080219/gdb/linux-nat.h	2008-02-19 14:15:01.000000000 +0100
25ff8a1
@@ -55,8 +55,8 @@ struct lwp_info
c78c51c
   /* If non-zero, a pending wait status.  */
c78c51c
   int status;
c78c51c
 
c78c51c
-  /* Non-zero if we were stepping this LWP.  */
c78c51c
-  int step;
c78c51c
+  /* The kind of stepping of this LWP.  */
c78c51c
+  enum resume_step step;
c78c51c
 
25ff8a1
   /* Non-zero si_signo if this LWP stopped with a trap.  si_addr may
25ff8a1
      be the address of a hardware watchpoint.  */