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 2/6] Iterate over ALL_TRACEPOINTS first.
Date: Tue, 04 Dec 2012 04:45:00 -0000	[thread overview]
Message-ID: <1354596282-32526-3-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1354596282-32526-1-git-send-email-yao@codesourcery.com>

Hi,
The 'breakpoint-modified' observer is notified on the breakpoint
level, in order to notify observer for a given tracepoint only once,
we change to iterate over tracepoint first, and then iterate over
locations of each tracepoint.  In the inner loop, when we find a
tracepoint location is downloaded, we mark a flag, and notify the
observer in outer loop (on tracepoints) if flag is true.  In short, we
change the iteration from:

  ALL_BP_LOCATIONS (bl, blp_tmp)
   {
     if (!is_tracepoint (bl->owner))
       continue;
   }

to:

  ALL_TRACEPOINTS (b)
   {
      for (bl = b->loc; bl; bl = bl->next)
        {}
   }

download_tracepoint_locations is called after breakpoint re-setting,
so I think this change has no functional affect.

gdb:

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

	* breakpoint.c (download_tracepoint_locations): Iterate over
	ALL_TRACEPOINTS first and then iterate over locations of
	each tracepoint.
---
 gdb/breakpoint.c |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 40d2edd..3f2f0c9 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -12078,7 +12078,7 @@ bp_location_target_extensions_update (void)
 static void
 download_tracepoint_locations (void)
 {
-  struct bp_location *bl, **blp_tmp;
+  struct breakpoint *b;
   struct cleanup *old_chain;
 
   if (!target_can_download_tracepoint ())
@@ -12086,31 +12086,32 @@ download_tracepoint_locations (void)
 
   old_chain = save_current_space_and_thread ();
 
-  ALL_BP_LOCATIONS (bl, blp_tmp)
+  ALL_TRACEPOINTS (b)
     {
+      struct bp_location *bl;
       struct tracepoint *t;
 
-      if (!is_tracepoint (bl->owner))
-	continue;
-
-      if ((bl->owner->type == bp_fast_tracepoint
+      if ((b->type == bp_fast_tracepoint
 	   ? !may_insert_fast_tracepoints
 	   : !may_insert_tracepoints))
 	continue;
 
-      /* In tracepoint, locations are _never_ duplicated, so
-	 should_be_inserted is equivalent to
-	 unduplicated_should_be_inserted.  */
-      if (!should_be_inserted (bl) || bl->inserted)
-	continue;
+      for (bl = b->loc; bl; bl = bl->next)
+	{
+	  /* In tracepoint, locations are _never_ duplicated, so
+	     should_be_inserted is equivalent to
+	     unduplicated_should_be_inserted.  */
+	  if (!should_be_inserted (bl) || bl->inserted)
+	    continue;
 
-      switch_to_program_space_and_thread (bl->pspace);
+	  switch_to_program_space_and_thread (bl->pspace);
 
-      target_download_tracepoint (bl);
+	  target_download_tracepoint (bl);
 
-      bl->inserted = 1;
-      t = (struct tracepoint *) bl->owner;
-      t->number_on_target = bl->owner->number;
+	  bl->inserted = 1;
+	}
+      t = (struct tracepoint *) b;
+      t->number_on_target = b->number;
     }
 
   do_cleanups (old_chain);
-- 
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 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 ` [PATCH 4/6] Notify breakpoint-modified when uploaded tracepoints are merged Yao Qi
2012-12-06 20:57   ` 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-04  4:45 ` Yao Qi [this message]
2012-12-06 20:56   ` [PATCH 2/6] Iterate over ALL_TRACEPOINTS first 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-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-3-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