public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Remove allocate_bp_location
Date: Fri, 29 Apr 2022 22:24:47 +0000 (GMT)	[thread overview]
Message-ID: <20220429222447.03DDA3857C49@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ee89d0a4e82399e6e857a67e8bef81bfbe6e7df4

commit ee89d0a4e82399e6e857a67e8bef81bfbe6e7df4
Author: Tom Tromey <tom@tromey.com>
Date:   Sun Jan 16 19:28:19 2022 -0700

    Remove allocate_bp_location
    
    allocate_bp_location is just a small wrapper for a method call, so
    inline it everywhere.

Diff:
---
 gdb/breakpoint.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index c3568883ea9..17ab0f030cd 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -175,8 +175,6 @@ static void enable_breakpoint_disp (struct breakpoint *, enum bpdisp,
 
 static void decref_bp_location (struct bp_location **loc);
 
-static struct bp_location *allocate_bp_location (struct breakpoint *bpt);
-
 static std::vector<symtab_and_line> bkpt_probe_decode_location
      (struct breakpoint *b,
       struct event_location *location,
@@ -1829,7 +1827,7 @@ software_watchpoint_add_no_memory_location (struct breakpoint *b,
 {
   gdb_assert (b->type == bp_watchpoint && b->loc == NULL);
 
-  b->loc = allocate_bp_location (b);
+  b->loc = b->allocate_location ();
   b->loc->pspace = pspace;
   b->loc->address = -1;
   b->loc->length = -1;
@@ -2082,7 +2080,7 @@ update_watchpoint (struct watchpoint *b, int reparse)
 		  else if (b->type == bp_access_watchpoint)
 		    type = hw_access;
 
-		  loc = allocate_bp_location (b);
+		  loc = b->allocate_location ();
 		  for (tmp = &(b->loc); *tmp != NULL; tmp = &((*tmp)->next))
 		    ;
 		  *tmp = loc;
@@ -7196,14 +7194,6 @@ bp_location::bp_location (breakpoint *owner)
 {
 }
 
-/* Allocate a struct bp_location.  */
-
-static struct bp_location *
-allocate_bp_location (struct breakpoint *bpt)
-{
-  return bpt->allocate_location ();
-}
-
 /* Decrement reference count.  If the reference count reaches 0,
    destroy the bp_location.  Sets *BLP to NULL.  */
 
@@ -8034,7 +8024,7 @@ momentary_breakpoint_from_master (struct breakpoint *orig,
   struct breakpoint *copy;
 
   copy = set_raw_breakpoint_without_location (orig->gdbarch, type, ops);
-  copy->loc = allocate_bp_location (copy);
+  copy->loc = copy->allocate_location ();
   set_breakpoint_location_function (copy->loc);
 
   copy->loc->gdbarch = orig->loc->gdbarch;
@@ -8165,7 +8155,7 @@ add_location_to_breakpoint (struct breakpoint *b,
     loc_gdbarch = b->gdbarch;
 
   /* Adjust the breakpoint's address prior to allocating a location.
-     Once we call allocate_bp_location(), that mostly uninitialized
+     Once we call allocate_location(), that mostly uninitialized
      location will be placed on the location chain.  Adjustment of the
      breakpoint may cause target_read_memory() to be called and we do
      not want its scan of the location chain to find a breakpoint and
@@ -8174,7 +8164,7 @@ add_location_to_breakpoint (struct breakpoint *b,
 						sal->pc, b->type);
 
   /* Sort the locations by their ADDRESS.  */
-  loc = allocate_bp_location (b);
+  loc = b->allocate_location ();
   for (tmp = &(b->loc); *tmp != NULL && (*tmp)->address <= adjusted_address;
        tmp = &((*tmp)->next))
     ;


                 reply	other threads:[~2022-04-29 22:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220429222447.03DDA3857C49@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@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).