public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 03/12] gdb: constify breakpoint::print_it parameter
Date: Thu, 11 May 2023 10:48:23 -0400	[thread overview]
Message-ID: <20230511144832.17974-4-simon.marchi@efficios.com> (raw)
In-Reply-To: <20230511144832.17974-1-simon.marchi@efficios.com>

The print_it method itself is const.  In a subsequent patch, the
locations that come out of a const breakpoint will be const as well.  It
will therefore be needed to make the last_loc output parameter const as
well.  Make that change now to reduce the size of the following patches.

Change-Id: I7ed962950bc9582646e31e2e42beca2a1c9c5105
---
 gdb/ada-lang.c            |  4 ++--
 gdb/break-catch-exec.c    |  4 ++--
 gdb/break-catch-fork.c    |  4 ++--
 gdb/break-catch-load.c    |  4 ++--
 gdb/break-catch-sig.c     |  4 ++--
 gdb/break-catch-syscall.c |  4 ++--
 gdb/break-catch-throw.c   |  4 ++--
 gdb/breakpoint.c          | 14 ++++++--------
 gdb/breakpoint.h          |  2 +-
 9 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 50d5c6f96971..d7316c845d6d 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12165,7 +12165,7 @@ struct ada_catchpoint : public code_breakpoint
   void re_set () override;
   void check_status (struct bpstat *bs) override;
   enum print_stop_action print_it (const bpstat *bs) const override;
-  bool print_one (bp_location **) const override;
+  bool print_one (const bp_location **) const override;
   void print_mention () const override;
   void print_recreate (struct ui_file *fp) const override;
 
@@ -12430,7 +12430,7 @@ ada_catchpoint::print_it (const bpstat *bs) const
    catchpoint kinds.  */
 
 bool
-ada_catchpoint::print_one (bp_location **last_loc) const
+ada_catchpoint::print_one (const bp_location **last_loc) const
 { 
   struct ui_out *uiout = current_uiout;
   struct value_print_options opts;
diff --git a/gdb/break-catch-exec.c b/gdb/break-catch-exec.c
index 6cd498517aff..2e4ce59f49c5 100644
--- a/gdb/break-catch-exec.c
+++ b/gdb/break-catch-exec.c
@@ -49,7 +49,7 @@ struct exec_catchpoint : public catchpoint
 		      CORE_ADDR bp_addr,
 		      const target_waitstatus &ws) override;
   enum print_stop_action print_it (const bpstat *bs) const override;
-  bool print_one (bp_location **) const override;
+  bool print_one (const bp_location **) const override;
   void print_mention () const override;
   void print_recreate (struct ui_file *fp) const override;
 
@@ -110,7 +110,7 @@ exec_catchpoint::print_it (const bpstat *bs) const
 }
 
 bool
-exec_catchpoint::print_one (bp_location **last_loc) const
+exec_catchpoint::print_one (const bp_location **last_loc) const
 {
   struct value_print_options opts;
   struct ui_out *uiout = current_uiout;
diff --git a/gdb/break-catch-fork.c b/gdb/break-catch-fork.c
index 1b1dace99d1d..fc761bcaa2b8 100644
--- a/gdb/break-catch-fork.c
+++ b/gdb/break-catch-fork.c
@@ -49,7 +49,7 @@ struct fork_catchpoint : public catchpoint
 		      CORE_ADDR bp_addr,
 		      const target_waitstatus &ws) override;
   enum print_stop_action print_it (const bpstat *bs) const override;
-  bool print_one (bp_location **) const override;
+  bool print_one (const bp_location **) const override;
   void print_mention () const override;
   void print_recreate (struct ui_file *fp) const override;
 
@@ -136,7 +136,7 @@ fork_catchpoint::print_it (const bpstat *bs) const
 /* Implement the "print_one" method for fork catchpoints.  */
 
 bool
-fork_catchpoint::print_one (bp_location **last_loc) const
+fork_catchpoint::print_one (const bp_location **last_loc) const
 {
   struct value_print_options opts;
   struct ui_out *uiout = current_uiout;
diff --git a/gdb/break-catch-load.c b/gdb/break-catch-load.c
index e01f6450fd76..d33313a1d989 100644
--- a/gdb/break-catch-load.c
+++ b/gdb/break-catch-load.c
@@ -56,7 +56,7 @@ struct solib_catchpoint : public catchpoint
 		      const target_waitstatus &ws) override;
   void check_status (struct bpstat *bs) override;
   enum print_stop_action print_it (const bpstat *bs) const override;
-  bool print_one (bp_location **) const override;
+  bool print_one (const bp_location **) const override;
   void print_mention () const override;
   void print_recreate (struct ui_file *fp) const override;
 
@@ -158,7 +158,7 @@ solib_catchpoint::print_it (const bpstat *bs) const
 }
 
 bool
-solib_catchpoint::print_one (bp_location **locs) const
+solib_catchpoint::print_one (const bp_location **locs) const
 {
   struct value_print_options opts;
   struct ui_out *uiout = current_uiout;
diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c
index 8c1fcbd69eef..10c8b81f8e83 100644
--- a/gdb/break-catch-sig.c
+++ b/gdb/break-catch-sig.c
@@ -57,7 +57,7 @@ struct signal_catchpoint : public catchpoint
 		      CORE_ADDR bp_addr,
 		      const target_waitstatus &ws) override;
   enum print_stop_action print_it (const bpstat *bs) const override;
-  bool print_one (bp_location **) const override;
+  bool print_one (const bp_location **) const override;
   void print_mention () const override;
   void print_recreate (struct ui_file *fp) const override;
   bool explains_signal (enum gdb_signal) override;
@@ -213,7 +213,7 @@ signal_catchpoint::print_it (const bpstat *bs) const
 /* Implement the "print_one" method for signal catchpoints.  */
 
 bool
-signal_catchpoint::print_one (bp_location **last_loc) const
+signal_catchpoint::print_one (const bp_location **last_loc) const
 {
   struct value_print_options opts;
   struct ui_out *uiout = current_uiout;
diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c
index 6475f4aa172a..18e2b20c1385 100644
--- a/gdb/break-catch-syscall.c
+++ b/gdb/break-catch-syscall.c
@@ -52,7 +52,7 @@ struct syscall_catchpoint : public catchpoint
 		      CORE_ADDR bp_addr,
 		      const target_waitstatus &ws) override;
   enum print_stop_action print_it (const bpstat *bs) const override;
-  bool print_one (bp_location **) const override;
+  bool print_one (const bp_location **) const override;
   void print_mention () const override;
   void print_recreate (struct ui_file *fp) const override;
 
@@ -236,7 +236,7 @@ syscall_catchpoint::print_it (const bpstat *bs) const
 /* Implement the "print_one" method for syscall catchpoints.  */
 
 bool
-syscall_catchpoint::print_one (bp_location **last_loc) const
+syscall_catchpoint::print_one (const bp_location **last_loc) const
 {
   struct value_print_options opts;
   struct ui_out *uiout = current_uiout;
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index 604c1855c0de..47d534c5ee88 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -87,7 +87,7 @@ struct exception_catchpoint : public code_breakpoint
 
   void re_set () override;
   enum print_stop_action print_it (const bpstat *bs) const override;
-  bool print_one (bp_location **) const override;
+  bool print_one (const bp_location **) const override;
   void print_mention () const override;
   void print_recreate (struct ui_file *fp) const override;
   void print_one_detail (struct ui_out *) const override;
@@ -259,7 +259,7 @@ exception_catchpoint::print_it (const bpstat *bs) const
 }
 
 bool
-exception_catchpoint::print_one (bp_location **last_loc) const
+exception_catchpoint::print_one (const bp_location **last_loc) const
 {
   struct value_print_options opts;
   struct ui_out *uiout = current_uiout;
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 1fdd5c3767f9..0ca4528faef2 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -369,7 +369,7 @@ struct ranged_breakpoint : public ordinary_breakpoint
 		      const target_waitstatus &ws) override;
   int resources_needed (const struct bp_location *) override;
   enum print_stop_action print_it (const bpstat *bs) const override;
-  bool print_one (bp_location **) const override;
+  bool print_one (const bp_location **) const override;
   void print_one_detail (struct ui_out *) const override;
   void print_mention () const override;
   void print_recreate (struct ui_file *fp) const override;
@@ -6340,7 +6340,7 @@ static bool
 print_one_breakpoint_location (struct breakpoint *b,
 			       struct bp_location *loc,
 			       int loc_number,
-			       struct bp_location **last_loc,
+			       const bp_location **last_loc,
 			       int allflag, bool raw_loc)
 {
   struct command_line *l;
@@ -6703,9 +6703,7 @@ print_one_breakpoint_location (struct breakpoint *b,
 bool fix_multi_location_breakpoint_output_globally = false;
 
 static void
-print_one_breakpoint (struct breakpoint *b,
-		      struct bp_location **last_loc, 
-		      int allflag)
+print_one_breakpoint (breakpoint *b, const bp_location **last_loc, int allflag)
 {
   struct ui_out *uiout = current_uiout;
   bool use_fixed_output
@@ -6789,7 +6787,7 @@ breakpoint_address_bits (struct breakpoint *b)
 void
 print_breakpoint (breakpoint *b)
 {
-  struct bp_location *dummy_loc = NULL;
+  const bp_location *dummy_loc = nullptr;
   print_one_breakpoint (b, &dummy_loc, 0);
 }
 
@@ -6827,7 +6825,7 @@ static int
 breakpoint_1 (const char *bp_num_list, bool show_internal,
 	      bool (*filter) (const struct breakpoint *))
 {
-  struct bp_location *last_loc = NULL;
+  const bp_location *last_loc = nullptr;
   int nr_printable_breakpoints;
   struct value_print_options opts;
   int print_address_bits = 0;
@@ -9407,7 +9405,7 @@ ranged_breakpoint::print_it (const bpstat *bs) const
 /* Implement the "print_one" method for ranged breakpoints.  */
 
 bool
-ranged_breakpoint::print_one (bp_location **last_loc) const
+ranged_breakpoint::print_one (const bp_location **last_loc) const
 {
   struct bp_location *bl = loc;
   struct value_print_options opts;
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 7c5cf3f2bef4..80cb91b1a911 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -684,7 +684,7 @@ struct breakpoint
   /* Display information about this breakpoint, for "info
      breakpoints".  Returns false if this method should use the
      default behavior.  */
-  virtual bool print_one (bp_location **) const
+  virtual bool print_one (const bp_location **) const
   {
     return false;
   }
-- 
2.40.1


  parent reply	other threads:[~2023-05-11 14:48 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-11 14:48 [PATCH 00/12] Use intrusive_list for breakpoints and breakpoint locations Simon Marchi
2023-05-11 14:48 ` [PATCH 01/12] gdb: get gdbarch from syscall_catchpoint instead of location Simon Marchi
2023-05-15  9:12   ` Alexandra Petlanova Hajkova
2023-05-11 14:48 ` [PATCH 02/12] gdb: make some breakpoint methods use `this` Simon Marchi
2023-05-15 13:12   ` Alexandra Petlanova Hajkova
2023-05-15 18:25     ` Simon Marchi
2023-05-11 14:48 ` Simon Marchi [this message]
2023-05-11 14:48 ` [PATCH 04/12] gdb: add breakpoint "has locations" methods Simon Marchi
2023-05-11 14:48 ` [PATCH 05/12] gdb: add breakpoint::first_loc methods Simon Marchi
2023-05-18 12:50   ` Andrew Burgess
2023-05-18 17:55     ` Simon Marchi
2023-05-24 13:00       ` Andrew Burgess
2023-05-11 14:48 ` [PATCH 06/12] gdbsupport: add missing increment/decrement operators to reference_to_pointer_iterator Simon Marchi
2023-05-11 14:48 ` [PATCH 07/12] gdb: link breakpoint locations with intrusive_list Simon Marchi
2023-05-18 14:44   ` Andrew Burgess
2023-05-18 18:40     ` Simon Marchi
2023-05-24 13:04       ` Andrew Burgess
2023-05-11 14:48 ` [PATCH 08/12] gdb: remove bp_location_pointer_iterator Simon Marchi
2023-05-11 14:48 ` [PATCH 09/12] gdb: link breakpoints with intrusive_list Simon Marchi
2023-05-11 14:48 ` [PATCH 10/12] gdbsupport: make basic_safe_iterator::operator* return the same thing as underlying iterator Simon Marchi
2023-05-11 14:48 ` [PATCH 11/12] gdbsupport: make filtered_iterator::operator* " Simon Marchi
2023-05-11 14:48 ` [PATCH 12/12] gdb: remove breakpoint_pointer_iterator Simon Marchi
2023-05-18 15:53   ` Andrew Burgess
2023-05-18 18:44     ` Simon Marchi
2023-05-18 20:59       ` Simon Marchi
2023-05-18 15:54 ` [PATCH 00/12] Use intrusive_list for breakpoints and breakpoint locations Andrew Burgess
2023-05-18 21:01   ` Simon Marchi
2023-05-25 14:01     ` Simon Marchi

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=20230511144832.17974-4-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.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).