Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: gdb-patches@sourceware.org
Subject: [RFC 1/3] make reinsert breakpoint thread specific
Date: Fri, 06 May 2016 10:32:00 -0000	[thread overview]
Message-ID: <1462530736-25117-2-git-send-email-yao.qi@linaro.org> (raw)
In-Reply-To: <1462530736-25117-1-git-send-email-yao.qi@linaro.org>

gdb/gdbserver:

2016-05-06  Yao Qi  <yao.qi@linaro.org>

	* mem-break.c (struct breakpoint) <thread>: New field.
	(set_reinsert_breakpoint): New parameter thread.  Callers
	updated.
	(delete_reinsert_breakpoints): Likewise.
	* mem-break.h (set_reinsert_breakpoint): Update declaration.
	(delete_reinsert_breakpoints): Likewise.
---
 gdb/gdbserver/linux-low.c |  4 ++--
 gdb/gdbserver/mem-break.c | 11 ++++++++---
 gdb/gdbserver/mem-break.h |  8 ++++----
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 8e1e2fc..e539e34 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -4080,7 +4080,7 @@ install_software_single_step_breakpoints (struct lwp_info *lwp)
   next_pcs = (*the_low_target.get_next_pcs) (regcache);
 
   for (i = 0; VEC_iterate (CORE_ADDR, next_pcs, i, pc); ++i)
-    set_reinsert_breakpoint (pc);
+    set_reinsert_breakpoint (pc, current_thread);
 
   do_cleanups (old_chain);
 }
@@ -4705,7 +4705,7 @@ finish_step_over (struct lwp_info *lwp)
 	 because we were stepping over a breakpoint, and we hold all
 	 threads but LWP stopped while doing that.  */
       if (!can_hardware_single_step ())
-	delete_reinsert_breakpoints ();
+	delete_reinsert_breakpoints (get_lwp_thread (lwp));
 
       step_over_bkpt = null_ptid;
       return 1;
diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c
index 363d7ca..197d7a1 100644
--- a/gdb/gdbserver/mem-break.c
+++ b/gdb/gdbserver/mem-break.c
@@ -190,6 +190,10 @@ struct breakpoint
      the breakpoint shall be deleted; 0 or if this callback is NULL,
      it will be left inserted.  */
   int (*handler) (CORE_ADDR);
+
+  /* The owner of this breakpoint if it is not NULL.  It is only used
+     by reinsert breakpoint so far.  */
+  struct thread_info *thread;
 };
 
 /* Return the breakpoint size from its kind.  */
@@ -1407,16 +1411,17 @@ gdb_breakpoint_here (CORE_ADDR where)
 }
 
 void
-set_reinsert_breakpoint (CORE_ADDR stop_at)
+set_reinsert_breakpoint (CORE_ADDR stop_at, struct thread_info *thread)
 {
   struct breakpoint *bp;
 
   bp = set_breakpoint_at (stop_at, NULL);
   bp->type = reinsert_breakpoint;
+  bp->thread = thread;
 }
 
 void
-delete_reinsert_breakpoints (void)
+delete_reinsert_breakpoints (struct thread_info *thread)
 {
   struct process_info *proc = current_process ();
   struct breakpoint *bp, **bp_link;
@@ -1426,7 +1431,7 @@ delete_reinsert_breakpoints (void)
 
   while (bp)
     {
-      if (bp->type == reinsert_breakpoint)
+      if (bp->type == reinsert_breakpoint && bp->thread == thread)
 	{
 	  *bp_link = bp->next;
 	  release_breakpoint (proc, bp);
diff --git a/gdb/gdbserver/mem-break.h b/gdb/gdbserver/mem-break.h
index 4d9a76c..2744584 100644
--- a/gdb/gdbserver/mem-break.h
+++ b/gdb/gdbserver/mem-break.h
@@ -150,13 +150,13 @@ struct breakpoint *set_breakpoint_at (CORE_ADDR where,
 
 int delete_breakpoint (struct breakpoint *bkpt);
 
-/* Set a reinsert breakpoint at STOP_AT.  */
+/* Set a reinsert breakpoint at STOP_AT for THREAD.  */
 
-void set_reinsert_breakpoint (CORE_ADDR stop_at);
+void set_reinsert_breakpoint (CORE_ADDR stop_at, struct thread_info *thread);
 
-/* Delete all reinsert breakpoints.  */
+/* Delete all reinsert breakpoints of THREAD.  */
 
-void delete_reinsert_breakpoints (void);
+void delete_reinsert_breakpoints (struct thread_info *thread);
 
 /* Reinsert breakpoints at WHERE (and change their status to
    inserted).  */
-- 
1.9.1


  parent reply	other threads:[~2016-05-06 10:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06 10:32 [RFC 0/3] Use reinsert breakpoint for vCont;s Yao Qi
2016-05-06 10:32 ` [RFC 2/3] use " Yao Qi
2016-05-11 10:41   ` Yao Qi
2016-05-12 13:25     ` Antoine Tremblay
2016-05-13 12:12       ` Antoine Tremblay
     [not found]     ` <wwokeg97l6fe.fsf@ericsson.com>
2016-05-12 16:38       ` Yao Qi
2016-05-06 10:32 ` [PATCH 3/3] [GDBserver] Support vCont s and S actions with software single step Yao Qi
2016-05-06 10:32 ` Yao Qi [this message]
2016-05-09 15:17 ` [RFC 0/3] Use reinsert breakpoint for vCont;s Antoine Tremblay
2016-05-10 13:29   ` Antoine Tremblay
2016-05-11  8:35     ` Yao Qi
2016-05-11 12:08       ` Antoine Tremblay
     [not found] ` <wwokfutg3hge.fsf@ericsson.com>
2016-05-18  7:50   ` Yao Qi
2016-05-18 11:50     ` Antoine Tremblay

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=1462530736-25117-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