This is the mail archive of the gdb-patches@sources.redhat.com 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]

generic_prepare_to_proceed vs. Ctrl-C


David S's recently added generic_prepare_to_proceed() only takes account of
stopping at a breakpoint and switching threads. It does not deal with
stopping due to a Ctrl-C and switching threads. The below patch fixes this.

Okay to check in?

2001-05-22  Jonathan Larmour  <jlarmour@redhat.com>

	* arch-utils.c (generic_prepare_to_proceed): Allow for having
	stopped due to a Ctrl-C as well as breakpoints.

Jifl

Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.27
diff -u -5 -p -r1.27 arch-utils.c
--- arch-utils.c	2001/05/10 18:36:26	1.27
+++ arch-utils.c	2001/05/22 22:19:29
@@ -256,26 +256,26 @@ generic_prepare_to_proceed (int select_i
   struct target_waitstatus wait_status;
 
   /* Get the last target status returned by target_wait().  */
   get_last_target_status (&wait_ptid, &wait_status);
 
-  /* Make sure we were stopped at a breakpoint.  */
+  /* Make sure we were stopped either at a breakpoint, or because
+     of a Ctrl-C.  */
   if (wait_status.kind != TARGET_WAITKIND_STOPPED
-      || wait_status.value.sig != TARGET_SIGNAL_TRAP)
+      || (wait_status.value.sig != TARGET_SIGNAL_TRAP &&
+          wait_status.value.sig != TARGET_SIGNAL_INT))
     {
       return 0;
     }
 
   if (!ptid_equal (wait_ptid, minus_one_ptid)
       && !ptid_equal (inferior_ptid, wait_ptid))
     {
       /* Switched over from WAIT_PID.  */
       CORE_ADDR wait_pc = read_pc_pid (wait_ptid);
 
-      /* Avoid switching where it wouldn't do any good, i.e. if both
-         threads are at the same breakpoint.  */
-      if (wait_pc != read_pc () && breakpoint_here_p (wait_pc))
+      if (wait_pc != read_pc ())
 	{
 	  if (select_it)
 	    {
 	      /* User hasn't deleted the breakpoint.  Switch back to
 		 WAIT_PID and return non-zero.  */
@@ -286,12 +286,15 @@ generic_prepare_to_proceed (int select_i
 	      flush_cached_frames ();
 	      registers_changed ();
 	      stop_pc = wait_pc;
 	      select_frame (get_current_frame (), 0);
 	    }
-
-	  return 1;
+          /* Step over the breakpoint if there is one here. */
+          if (breakpoint_here_p (wait_pc))
+            {
+	      return 1;
+            }
 	}
     }
   return 0;
   
 }

-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]