Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 4/6] Notify breakpoint-modified when uploaded tracepoints are merged.
Date: Tue, 04 Dec 2012 04:45:00 -0000	[thread overview]
Message-ID: <1354596282-32526-5-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1354596282-32526-1-git-send-email-yao@codesourcery.com>

When any location of a tracepoint is marked as installed/inserted,
notify 'breakpoint-modified' observer.

gdb:

2012-12-03  Yao Qi  <yao@codesourcery.com>

	* tracepoint.c (merge_uploaded_tracepoints): Record all modified
	tracepoints and notify 'breakpoint-modified' observer for them.
---
 gdb/tracepoint.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index c467b9c..0c023bd 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -3475,6 +3475,10 @@ void
 merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
 {
   struct uploaded_tp *utp;
+  /* A set of tracepoints which are modified.  */
+  VEC(breakpoint_p) *modified_tp = NULL;
+  int ix;
+  struct breakpoint *b;
 
   /* Look for GDB tracepoints that match up with our uploaded versions.  */
   for (utp = *uploaded_tps; utp; utp = utp->next)
@@ -3485,6 +3489,8 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
       loc = find_matching_tracepoint_location (utp);
       if (loc)
 	{
+	  int found = 0;
+
 	  /* Mark this location as already inserted.  */
 	  loc->inserted = 1;
 	  t = (struct tracepoint *) loc->owner;
@@ -3492,6 +3498,22 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
 			     "as target's tracepoint %d at %s.\n"),
 			   loc->owner->number, utp->number,
 			   paddress (loc->gdbarch, utp->addr));
+
+	  /* One location LOC of tracepoint is modified ('inserted' is
+	     set to 1), save LOC->owner in MODIFIED_TP if LOC->owner
+	     is not added to MODIFIED_TP before.  The observer
+	     'breakpoint-modified' will be notified later with every
+	     tracepoint saved in MODIFIED_TP.  */
+	  for (ix = 0;
+	       VEC_iterate (breakpoint_p, modified_tp, ix, b);
+	       ix++)
+	    if (b == loc->owner)
+	      {
+		found = 1;
+		break;
+	      }
+	  if (!found)
+	    VEC_safe_push (breakpoint_p, modified_tp, loc->owner);
 	}
       else
 	{
@@ -3514,6 +3536,12 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
 	t->number_on_target = utp->number;
     }
 
+  /* Notify 'breakpoint-modified' observer that at least one of B's
+     locations is changed.  */
+  for (ix = 0; VEC_iterate (breakpoint_p, modified_tp, ix, b); ix++)
+    observer_notify_breakpoint_modified (b);
+
+  VEC_free (breakpoint_p, modified_tp);
   free_uploaded_tps (uploaded_tps);
 }
 
-- 
1.7.7.6


  parent reply	other threads:[~2012-12-04  4:45 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-04  4:45 [PATCH 0/6] Add a new field 'installed' when reporting tracepoint Yao Qi
2012-12-04  4:45 ` [PATCH 3/6] Notify breakpoint-modified when tracepoints are downloaded Yao Qi
2012-12-06 20:56   ` Pedro Alves
2012-12-04  4:45 ` [PATCH 2/6] Iterate over ALL_TRACEPOINTS first Yao Qi
2012-12-06 20:56   ` Pedro Alves
2012-12-04  4:45 ` [PATCH 6/6] Update test cases for 'installed' field Yao Qi
2012-12-07 12:42   ` Pedro Alves
2012-12-13 12:07     ` Yao Qi
2012-12-13 17:13       ` Pedro Alves
2012-12-04  4:45 ` [PATCH 5/6] Test tracepoints are installed or not Yao Qi
2012-12-07 12:39   ` Pedro Alves
2012-12-07 13:55     ` Yao Qi
2012-12-07 14:20       ` Pedro Alves
2012-12-09 12:53         ` Yao Qi
2012-12-11 17:53           ` Pedro Alves
2012-12-12  2:59             ` Yao Qi
2012-12-12 12:24               ` Pedro Alves
2012-12-12 15:00                 ` Yao Qi
2012-12-04  4:45 ` Yao Qi [this message]
2012-12-06 20:57   ` [PATCH 4/6] Notify breakpoint-modified when uploaded tracepoints are merged Pedro Alves
2012-12-04  4:45 ` [PATCH 1/6] Add a field 'installed' for each location of tracepoint Yao Qi
2012-12-06 20:56   ` Pedro Alves
2012-12-07 13:49     ` Yao Qi
2012-12-09 12:49     ` Yao Qi
2012-12-09 16:57       ` Eli Zaretskii
2012-12-11 17:26       ` Pedro Alves
2012-12-12  1:54         ` Yao Qi
2012-12-12 12:03           ` Pedro Alves
2012-12-06 20:55 ` [PATCH 0/6] Add a new field 'installed' when reporting tracepoint Pedro Alves

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=1354596282-32526-5-git-send-email-yao@codesourcery.com \
    --to=yao@codesourcery.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