public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCHv2 1/4] gdb: make some bp_location arguments const in breakpoint.c
Date: Wed, 19 Oct 2022 14:07:07 +0100	[thread overview]
Message-ID: <5562b126ab70b130659a6b972d1e1874a4bea768.1666184729.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1666184729.git.aburgess@redhat.com>

I spotted a few places where I could make some 'bp_location *'
arguments constant in breakpoint.c.

There should be no user visible changes after this commit.
---
 gdb/breakpoint.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 91e13a03360..e80a46cb01e 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -121,11 +121,11 @@ static CORE_ADDR adjust_breakpoint_address (struct gdbarch *gdbarch,
 					    enum bptype bptype,
 					    struct program_space *pspace);
 
-static int watchpoint_locations_match (struct bp_location *loc1,
-				       struct bp_location *loc2);
+static int watchpoint_locations_match (const struct bp_location *loc1,
+				       const struct bp_location *loc2);
 
-static int breakpoint_locations_match (struct bp_location *loc1,
-				       struct bp_location *loc2,
+static int breakpoint_locations_match (const struct bp_location *loc1,
+				       const struct bp_location *loc2,
 				       bool sw_hw_bps_match = false);
 
 static int breakpoint_location_address_match (struct bp_location *bl,
@@ -2641,7 +2641,7 @@ build_target_command_list (struct bp_location *bl)
    registers state.  */
 
 static int
-breakpoint_kind (struct bp_location *bl, CORE_ADDR *addr)
+breakpoint_kind (const struct bp_location *bl, CORE_ADDR *addr)
 {
   if (bl->owner->type == bp_single_step)
     {
@@ -4227,7 +4227,7 @@ moribund_breakpoint_here_p (const address_space *aspace, CORE_ADDR pc)
    ASPACE.  */
 
 static int
-bp_location_inserted_here_p (struct bp_location *bl,
+bp_location_inserted_here_p (const struct bp_location *bl,
 			     const address_space *aspace, CORE_ADDR pc)
 {
   if (bl->inserted
@@ -5453,7 +5453,7 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread)
    on the current target.  */
 
 static int
-need_moribund_for_location_type (struct bp_location *loc)
+need_moribund_for_location_type (const struct bp_location *loc)
 {
   return ((loc->loc_type == bp_loc_software_breakpoint
 	   && !target_supports_stopped_by_sw_breakpoint ())
@@ -5987,7 +5987,7 @@ bp_condition_evaluator (const breakpoint *b)
    similar to bp_condition_evaluator, but for locations.  */
 
 static const char *
-bp_location_condition_evaluator (struct bp_location *bl)
+bp_location_condition_evaluator (const struct bp_location *bl)
 {
   if (bl && !is_breakpoint (bl->owner))
     return NULL;
@@ -6946,8 +6946,8 @@ bl_address_is_meaningful (bp_location *loc)
    true if LOC1 and LOC2 represent the same watchpoint location.  */
 
 static int
-watchpoint_locations_match (struct bp_location *loc1, 
-			    struct bp_location *loc2)
+watchpoint_locations_match (const struct bp_location *loc1,
+			    const struct bp_location *loc2)
 {
   struct watchpoint *w1 = (struct watchpoint *) loc1->owner;
   struct watchpoint *w2 = (struct watchpoint *) loc2->owner;
@@ -7058,8 +7058,8 @@ breakpoint_location_address_range_overlap (struct bp_location *bl,
    true, otherwise returns false.  */
 
 static int
-tracepoint_locations_match (struct bp_location *loc1,
-			    struct bp_location *loc2)
+tracepoint_locations_match (const struct bp_location *loc1,
+			    const struct bp_location *loc2)
 {
   if (is_tracepoint (loc1->owner) && is_tracepoint (loc2->owner))
     /* Since tracepoint locations are never duplicated with others', tracepoint
@@ -7077,8 +7077,8 @@ tracepoint_locations_match (struct bp_location *loc1,
    otherwise they don't.  */
 
 static int
-breakpoint_locations_match (struct bp_location *loc1,
-			    struct bp_location *loc2,
+breakpoint_locations_match (const struct bp_location *loc1,
+			    const struct bp_location *loc2,
 			    bool sw_hw_bps_match)
 {
   int hw_point1, hw_point2;
-- 
2.25.4


  reply	other threads:[~2022-10-19 13:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-05  9:32 [PATCH 0/4] Const args, int->bool, and scoped_restore " Andrew Burgess
2022-10-05  9:32 ` [PATCH 1/4] gdb: make some bp_location arguments const " Andrew Burgess
2022-10-18 13:46   ` Bruno Larsen
2022-10-05  9:32 ` [PATCH 2/4] gdb: used scoped_restore_frame in update_watchpoint Andrew Burgess
2022-10-05  9:32 ` [PATCH 3/4] gdb: make use of scoped_restore in unduplicated_should_be_inserted Andrew Burgess
2022-10-05  9:32 ` [PATCH 4/4] gdb: some int to bool conversion in breakpoint.c Andrew Burgess
2022-10-19 13:07 ` [PATCHv2 0/4] Const args, int->bool, and scoped_restore " Andrew Burgess
2022-10-19 13:07   ` Andrew Burgess [this message]
2022-10-19 13:07   ` [PATCHv2 2/4] gdb: used scoped_restore_frame in update_watchpoint Andrew Burgess
2022-10-19 13:07   ` [PATCHv2 3/4] gdb: make use of scoped_restore in unduplicated_should_be_inserted Andrew Burgess
2022-10-19 13:07   ` [PATCHv2 4/4] gdb: some int to bool conversion in breakpoint.c Andrew Burgess
2022-10-19 20:03     ` Simon Marchi
2022-10-20 15:48       ` Andrew Burgess

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=5562b126ab70b130659a6b972d1e1874a4bea768.1666184729.git.aburgess@redhat.com \
    --to=aburgess@redhat.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).