[PUSHED] gdb: use 'const' more in a couple of small breakpoint functions

Message ID ae2a96659a0960b850f3a368702cb3b8d3f38d2e.1733741928.git.aburgess@redhat.com
State New
Headers
Series [PUSHED] gdb: use 'const' more in a couple of small breakpoint functions |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply

Commit Message

Andrew Burgess Dec. 9, 2024, 10:59 a.m. UTC
  Make the 'struct breakpoint *' argument 'const' in user_breakpoint_p
and pending_breakpoint_p.  And make the 'struct bp_location *'
argument 'const' in bl_address_is_meaningful.

There should be no user visible changes after this commit.
---
 gdb/breakpoint.c | 8 ++++----
 gdb/breakpoint.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)


base-commit: 3d75969bd0e2608dc2c23aeee3f2f597b44fa7cc
  

Comments

Tom Tromey Dec. 9, 2024, 7:42 p.m. UTC | #1
>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:

Andrew> Make the 'struct breakpoint *' argument 'const' in user_breakpoint_p
Andrew> and pending_breakpoint_p.  And make the 'struct bp_location *'
Andrew> argument 'const' in bl_address_is_meaningful.

Looks good to me, thank you.
Approved-By: Tom Tromey <tom@tromey.com>

Tom
  

Patch

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index bfe4da996e1..8dafb0a0c75 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -167,7 +167,7 @@  static std::vector<symtab_and_line> bkpt_probe_decode_location_spec
       location_spec *locspec,
       struct program_space *search_pspace);
 
-static bool bl_address_is_meaningful (bp_location *loc);
+static bool bl_address_is_meaningful (const bp_location *loc);
 
 static int find_loc_num_by_location (const bp_location *loc);
 
@@ -6995,7 +6995,7 @@  print_breakpoint (breakpoint *b)
    internal or momentary.  */
 
 int
-user_breakpoint_p (struct breakpoint *b)
+user_breakpoint_p (const breakpoint *b)
 {
   return b->number > 0;
 }
@@ -7003,7 +7003,7 @@  user_breakpoint_p (struct breakpoint *b)
 /* See breakpoint.h.  */
 
 int
-pending_breakpoint_p (struct breakpoint *b)
+pending_breakpoint_p (const breakpoint *b)
 {
   return !b->has_locations ();
 }
@@ -7300,7 +7300,7 @@  describe_other_breakpoints (struct gdbarch *gdbarch,
    zero.  */
 
 static bool
-bl_address_is_meaningful (bp_location *loc)
+bl_address_is_meaningful (const bp_location *loc)
 {
   return loc->loc_type != bp_loc_other;
 }
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 1c890f75693..be127a9e4e6 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -2029,10 +2029,10 @@  extern int pc_at_non_inline_function (const address_space *aspace,
 				      CORE_ADDR pc,
 				      const target_waitstatus &ws);
 
-extern int user_breakpoint_p (struct breakpoint *);
+extern int user_breakpoint_p (const breakpoint *);
 
 /* Return true if this breakpoint is pending, false if not.  */
-extern int pending_breakpoint_p (struct breakpoint *);
+extern int pending_breakpoint_p (const breakpoint *);
 
 /* Attempt to determine architecture of location identified by SAL.  */
 extern struct gdbarch *get_sal_arch (struct symtab_and_line sal);