public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pedro Alves <palves@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] ranged_breakpoint: use install_breakpoint
Date: Fri, 20 May 2022 19:42:43 +0000 (GMT)	[thread overview]
Message-ID: <20220520194243.9F7A63856DEA@sourceware.org> (raw)

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

commit 27a62b4359a2718012eaf86bbeedb8662ec9f41b
Author: Pedro Alves <pedro@palves.net>
Date:   Fri May 6 22:45:21 2022 +0100

    ranged_breakpoint: use install_breakpoint
    
    This commit replaces a chunk of code in break_range_command by an
    equivalent call to install_breakpoint.
    
    Change-Id: I31c06cabd36f5be91740aab029265f678aa78e35

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

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index f9332e1f998..ced976ca39d 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -9356,7 +9356,6 @@ break_range_command (const char *arg, int from_tty)
   struct linespec_result canonical_start, canonical_end;
   int bp_count, can_use_bp, length;
   CORE_ADDR end;
-  struct breakpoint *b;
 
   /* We don't support software ranged breakpoints.  */
   if (target_ranged_break_num_registers () < 0)
@@ -9440,18 +9439,12 @@ break_range_command (const char *arg, int from_tty)
   /* Now set up the breakpoint.  */
   std::unique_ptr<breakpoint> br (new ranged_breakpoint (get_current_arch ()));
   br->add_location (sal_start);
-  b = add_to_breakpoint_chain (std::move (br));
-
-  set_breakpoint_count (breakpoint_count + 1);
-  b->number = breakpoint_count;
-  b->disposition = disp_donttouch;
-  b->location = std::move (start_location);
-  b->location_range_end = std::move (end_location);
-  b->loc->length = length;
+  br->disposition = disp_donttouch;
+  br->location = std::move (start_location);
+  br->location_range_end = std::move (end_location);
+  br->loc->length = length;
 
-  mention (b);
-  gdb::observers::breakpoint_created.notify (b);
-  update_global_location_list (UGLL_MAY_INSERT);
+  install_breakpoint (false, std::move (br), true);
 }
 
 /*  Return non-zero if EXP is verified as constant.  Returned zero


                 reply	other threads:[~2022-05-20 19:42 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=20220520194243.9F7A63856DEA@sourceware.org \
    --to=palves@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).