public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 1/3] Change breakpoint_re_set_default to a method
Date: Fri, 27 May 2022 20:42:29 -0600	[thread overview]
Message-ID: <20220528024231.474534-2-tom@tromey.com> (raw)
In-Reply-To: <20220528024231.474534-1-tom@tromey.com>

breakpoint_re_set_default is only ever called from breakpoint re_set
methods, so make it a protected method on code_breakpoint.
---
 gdb/breakpoint.c | 18 ++++++++----------
 gdb/breakpoint.h |  5 +++++
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index ed932a19ed7..cc0d527fd30 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -87,8 +87,6 @@
 static void map_breakpoint_numbers (const char *,
 				    gdb::function_view<void (breakpoint *)>);
 
-static void breakpoint_re_set_default (code_breakpoint *);
-
 static void
   create_sals_from_location_default (struct event_location *location,
 				     struct linespec_result *canonical);
@@ -11496,7 +11494,7 @@ code_breakpoint::re_set ()
       return;
     }
 
-  breakpoint_re_set_default (this);
+  re_set_default ();
 }
 
 int
@@ -11932,7 +11930,7 @@ tracepoint_probe_create_sals_from_location
 void
 dprintf_breakpoint::re_set ()
 {
-  breakpoint_re_set_default (this);
+  re_set_default ();
 
   /* extra_string should never be non-NULL for dprintf.  */
   gdb_assert (extra_string != NULL);
@@ -12708,28 +12706,28 @@ location_to_sals (struct breakpoint *b, struct event_location *location,
    breakpoints.  Reevaluate the breakpoint and recreate its
    locations.  */
 
-static void
-breakpoint_re_set_default (code_breakpoint *b)
+void
+code_breakpoint::re_set_default ()
 {
   struct program_space *filter_pspace = current_program_space;
   std::vector<symtab_and_line> expanded, expanded_end;
 
   int found;
-  std::vector<symtab_and_line> sals = location_to_sals (b, b->location.get (),
+  std::vector<symtab_and_line> sals = location_to_sals (this, location.get (),
 							filter_pspace, &found);
   if (found)
     expanded = std::move (sals);
 
-  if (b->location_range_end != NULL)
+  if (location_range_end != NULL)
     {
       std::vector<symtab_and_line> sals_end
-	= location_to_sals (b, b->location_range_end.get (),
+	= location_to_sals (this, location_range_end.get (),
 			    filter_pspace, &found);
       if (found)
 	expanded_end = std::move (sals_end);
     }
 
-  update_breakpoint_locations (b, filter_pspace, expanded, expanded_end);
+  update_breakpoint_locations (this, filter_pspace, expanded, expanded_end);
 }
 
 /* Default method for creating SALs from an address string.  It basically
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 566f1285e46..4fdd50324e3 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -885,6 +885,11 @@ struct code_breakpoint : public breakpoint
   std::vector<symtab_and_line> decode_location
        (struct event_location *location,
 	struct program_space *search_pspace) override;
+
+protected:
+
+  /* Helper method that does the basic work of re_set.  */
+  void re_set_default ();
 };
 
 /* An instance of this type is used to represent a watchpoint,
-- 
2.34.1


  reply	other threads:[~2022-05-28  2:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-28  2:42 [PATCH 0/3] More minor breakpoint cleanups Tom Tromey
2022-05-28  2:42 ` Tom Tromey [this message]
2022-05-30 15:32   ` [PATCH 1/3] Change breakpoint_re_set_default to a method Pedro Alves
2022-05-28  2:42 ` [PATCH 2/3] Change location_to_sals " Tom Tromey
2022-05-30 15:32   ` Pedro Alves
2022-06-01  4:50     ` Tom Tromey
2022-06-01 16:38       ` Pedro Alves
2022-06-10 21:34         ` Tom Tromey
2022-06-13 14:36           ` Pedro Alves
2022-08-14  0:44     ` Tom Tromey
2022-05-28  2:42 ` [PATCH 3/3] Move decode_location to code_breakpoint Tom Tromey
2022-05-30 15:42   ` Pedro Alves
2022-08-14  0:41     ` Tom Tromey
2022-08-14  0:45 ` [PATCH 0/3] More minor breakpoint cleanups Tom Tromey

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=20220528024231.474534-2-tom@tromey.com \
    --to=tom@tromey.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).