Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 9/9] gdb: remove iterate_over_bp_locations function
Date: Thu, 27 May 2021 11:35:58 -0400	[thread overview]
Message-ID: <20210527153558.3016335-10-simon.marchi@polymtl.ca> (raw)
In-Reply-To: <20210527153558.3016335-1-simon.marchi@polymtl.ca>

Remove it, change users (well, a single one) to use all_bp_locations.
This requires moving all_bp_locations to breakpoint.h to expose it.

gdb/ChangeLog:

	* breakpoint.h (iterate_over_bp_locations): Remove.  Update
	users to use all_bp_locations.
	(all_bp_locations): New.
	* breakpoint.c (all_bp_locations): Make non-static.
	(iterate_over_bp_locations): Remove.

Change-Id: Iaf1f716d6c2c5b2975579b3dc113a86f5d0975be
---
 gdb/breakpoint.c  | 13 +++----------
 gdb/breakpoint.h  |  7 ++++---
 gdb/record-full.c | 26 ++++++++++----------------
 3 files changed, 17 insertions(+), 29 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 751ed51cc7d3..225294f2bb26 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -521,7 +521,9 @@ all_tracepoints ()
 
 static std::vector<bp_location *> bp_locations;
 
-static const std::vector<bp_location *> &
+/* See breakpoint.h.  */
+
+const std::vector<bp_location *> &
 all_bp_locations ()
 {
   return bp_locations;
@@ -2913,15 +2915,6 @@ insert_breakpoints (void)
   update_global_location_list (UGLL_INSERT);
 }
 
-/* Invoke CALLBACK for each of bp_location.  */
-
-void
-iterate_over_bp_locations (gdb::function_view<void (bp_location *)> callback)
-{
-  for (bp_location *loc : all_bp_locations ())
-    callback (loc);
-}
-
 /* This is used when we need to synch breakpoint conditions between GDB and the
    target.  It is the case with deleting and disabling of breakpoints when using
    always-inserted mode.  */
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index ffe042459eef..e40504f14ed3 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1313,9 +1313,6 @@ extern void breakpoint_init_inferior (enum inf_context);
 
 extern void breakpoint_auto_delete (bpstat);
 
-extern void iterate_over_bp_locations
-  (gdb::function_view<void (bp_location *)> callback);
-
 /* Return the chain of command lines to execute when this breakpoint
    is hit.  */
 extern struct command_line *breakpoint_commands (struct breakpoint *b);
@@ -1755,6 +1752,10 @@ using tracepoint_range = next_adapter<breakpoint, tracepoint_iterator>;
 
 tracepoint_range all_tracepoints ();
 
+/* Return a range to iterate over all breakpoint locations.  */
+
+const std::vector<bp_location *> &all_bp_locations ();
+
 /* Nonzero if the specified PC cannot be a location where functions
    have been inlined.  */
 
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 91da1076194f..98d48e677443 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -1719,21 +1719,6 @@ struct record_full_breakpoint
    active.  */
 static std::vector<record_full_breakpoint> record_full_breakpoints;
 
-static void
-record_full_sync_record_breakpoints (struct bp_location *loc)
-{
-  if (loc->loc_type != bp_loc_software_breakpoint)
-      return;
-
-  if (loc->inserted)
-    {
-      record_full_breakpoints.emplace_back
-	(loc->target_info.placed_address_space,
-	 loc->target_info.placed_address,
-	 1);
-    }
-}
-
 /* Sync existing breakpoints to record_full_breakpoints.  */
 
 static void
@@ -1741,7 +1726,16 @@ record_full_init_record_breakpoints (void)
 {
   record_full_breakpoints.clear ();
 
-  iterate_over_bp_locations (record_full_sync_record_breakpoints);
+  for (bp_location *loc : all_bp_locations ())
+    {
+      if (loc->loc_type != bp_loc_software_breakpoint)
+	continue;
+
+      if (loc->inserted)
+	record_full_breakpoints.emplace_back
+	  (loc->target_info.placed_address_space,
+	   loc->target_info.placed_address, 1);
+    }
 }
 
 /* Behavior is conditional on RECORD_FULL_IS_REPLAY.  We will not actually
-- 
2.31.1


  parent reply	other threads:[~2021-05-27 15:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27 15:35 [PATCH 0/9] Convert breakpoint iteration macros to ranges Simon Marchi via Gdb-patches
2021-05-27 15:35 ` [PATCH 1/9] gdb: add all_breakpoints function Simon Marchi via Gdb-patches
2021-05-27 15:35 ` [PATCH 2/9] gdb: add all_breakpoints_safe function Simon Marchi via Gdb-patches
2021-05-27 17:35   ` Tom Tromey
2021-05-27 17:58     ` Simon Marchi via Gdb-patches
2021-05-27 18:15       ` Tom Tromey
2021-05-27 15:35 ` [PATCH 3/9] gdb: add all_tracepoints function Simon Marchi via Gdb-patches
2021-05-27 15:35 ` [PATCH 4/9] gdb: add breakpoint::locations method Simon Marchi via Gdb-patches
2021-05-27 15:35 ` [PATCH 5/9] gdb: make bp_locations an std::vector Simon Marchi via Gdb-patches
2021-05-27 15:35 ` [PATCH 6/9] gdb: add all_bp_locations function Simon Marchi via Gdb-patches
2021-05-27 15:35 ` [PATCH 7/9] gdb: add all_bp_locations_at_addr function Simon Marchi via Gdb-patches
2021-05-27 18:04   ` Tom Tromey
2021-05-27 18:13     ` Simon Marchi via Gdb-patches
2021-05-27 15:35 ` [PATCH 8/9] gdb: remove iterate_over_breakpoints function Simon Marchi via Gdb-patches
2021-10-21 10:20   ` Tom de Vries via Gdb-patches
2021-10-21 11:29     ` [PATCH, master + 11][gdb/tui] Fix breakpoint display functionality Tom de Vries via Gdb-patches
2021-10-21 12:10       ` Tom de Vries via Gdb-patches
2021-10-21 14:28         ` Simon Marchi via Gdb-patches
2021-05-27 15:35 ` Simon Marchi via Gdb-patches [this message]
2021-05-27 18:14 ` [PATCH 0/9] Convert breakpoint iteration macros to ranges Tom Tromey
2021-05-27 18:59   ` Simon Marchi via Gdb-patches

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=20210527153558.3016335-10-simon.marchi@polymtl.ca \
    --to=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /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