public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* tighten gdbserver's decr_pc_after_break checks
@ 2010-04-01 15:34 Pedro Alves
  0 siblings, 0 replies; only message in thread
From: Pedro Alves @ 2010-04-01 15:34 UTC (permalink / raw)
  To: gdb-patches

Something I had noticed while looking at gdbserver debug logs.

Tested on x86_64-linux, and checked in.

-- 
Pedro Alves

2010-04-01  Pedro Alves  <pedro@codesourcery.com>

	gdb/gdbserver/
	* linux-low.c (get_stop_pc): Don't adjust the PC if stopped with
	an extended waitstatus, or by a watchpoint.
	(cancel_breakpoints_callback): Don't cancel a breakpoint if the
	thread was stepping or has been stopped by a watchpoint.

---
 gdb/gdbserver/linux-low.c |   16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

Index: src/gdb/gdbserver/linux-low.c
===================================================================
--- src.orig/gdb/gdbserver/linux-low.c	2010-04-01 15:56:52.000000000 +0100
+++ src/gdb/gdbserver/linux-low.c	2010-04-01 16:03:02.000000000 +0100
@@ -511,7 +511,10 @@ get_stop_pc (struct lwp_info *lwp)
 
   stop_pc = get_pc (lwp);
 
-  if (WSTOPSIG (lwp->last_status) == SIGTRAP && !lwp->stepping)
+  if (WSTOPSIG (lwp->last_status) == SIGTRAP
+      && !lwp->stepping
+      && !lwp->stopped_by_watchpoint
+      && lwp->last_status >> 16 == 0)
     stop_pc -= the_low_target.decr_pc_after_break;
 
   if (debug_threads)
@@ -1128,15 +1131,6 @@ cancel_breakpoint (struct lwp_info *lwp)
   if (!supports_breakpoints ())
     return 0;
 
-  if (lwp->stepping)
-    {
-      if (debug_threads)
-	fprintf (stderr,
-		 "CB: [%s] is stepping\n",
-		 target_pid_to_str (lwp->head.id));
-      return 0;
-    }
-
   regcache = get_thread_regcache (get_lwp_thread (lwp), 1);
 
   /* breakpoint_at reads from current inferior.  */
@@ -1499,6 +1493,8 @@ cancel_breakpoints_callback (struct infe
       && lp->status_pending_p
       && WIFSTOPPED (lp->status_pending)
       && WSTOPSIG (lp->status_pending) == SIGTRAP
+      && !lp->stepping
+      && !lp->stopped_by_watchpoint
       && cancel_breakpoint (lp))
     /* Throw away the SIGTRAP.  */
     lp->status_pending_p = 0;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-04-01 15:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-01 15:34 tighten gdbserver's decr_pc_after_break checks Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).