public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/3] Remove single-step breakpoint for GDBserver internal event
Date: Mon, 26 Sep 2016 02:47:00 -0000	[thread overview]
Message-ID: <1474856716-5913-2-git-send-email-yao.qi@linaro.org> (raw)
In-Reply-To: <1474856716-5913-1-git-send-email-yao.qi@linaro.org>

This patch removes single-step breakpoints if the event is only
GDBserver internal, IOW, isn't reported back to GDB.

gdb/gdbserver:

2016-09-25  Yao Qi  <yao.qi@linaro.org>

	* linux-low.c (linux_wait_1): If single-step breakpoints are
	inserted, remove them.
---
 gdb/gdbserver/linux-low.c | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 4203b92..fd3cd5a 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -3670,17 +3670,31 @@ linux_wait_1 (ptid_t ptid,
 	  (*the_low_target.set_pc) (regcache, event_child->stop_pc);
 	}
 
-      /* We may have finished stepping over a breakpoint.  If so,
-	 we've stopped and suspended all LWPs momentarily except the
-	 stepping one.  This is where we resume them all again.  We're
-	 going to keep waiting, so use proceed, which handles stepping
-	 over the next breakpoint.  */
-      if (debug_threads)
-	debug_printf ("proceeding all threads.\n");
-
       if (step_over_finished)
-	unsuspend_all_lwps (event_child);
+	{
+	  /* If we have finished stepping over a breakpoint, we've
+	     stopped and suspended all LWPs momentarily except the
+	     stepping one.  This is where we resume them all again.
+	     We're going to keep waiting, so use proceed, which
+	     handles stepping over the next breakpoint.  */
+	  unsuspend_all_lwps (event_child);
+	}
+      else
+	{
+	  /* Remove the single-step breakpoints if any.  Note that
+	     there isn't single-step breakpoint if we finished stepping
+	     over.  */
+	  if (can_software_single_step ()
+	      && has_single_step_breakpoints (current_thread))
+	    {
+	      stop_all_lwps (0, event_child);
+	      delete_single_step_breakpoints (current_thread);
+	      unstop_all_lwps (0, event_child);
+	    }
+	}
 
+      if (debug_threads)
+	debug_printf ("proceeding all threads.\n");
       proceed_all_lwps ();
       return ignore_event (ourstatus);
     }
-- 
1.9.1

  parent reply	other threads:[~2016-09-26  2:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-26  2:25 [PATCH 0/3] Support range stepping on software single-step target Yao Qi
2016-09-26  2:25 ` [PATCH 3/3] Enable range stepping if software single step is supported Yao Qi
2016-09-26  2:25 ` [PATCH 2/3] Get pending events in random Yao Qi
2016-09-26  2:47 ` Yao Qi [this message]
2016-10-26 17:45   ` [PATCH 1/3] Remove single-step breakpoint for GDBserver internal event Pedro Alves
2016-10-26 20:14     ` Yao Qi
2016-10-27 13:16       ` Pedro Alves
2016-10-27 14:14         ` Yao Qi
2016-10-27 14:14           ` Pedro Alves
2016-10-10  8:43 ` [PATCH 0/3] Support range stepping on software single-step target Yao Qi
2016-10-26 15:39   ` Yao Qi
2016-10-26 17:34     ` Antoine Tremblay
2016-10-27 15:07       ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474856716-5913-2-git-send-email-yao.qi@linaro.org \
    --to=qiyaoltc@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).