From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCHv6 08/10] gdb: remove breakpoint_re_set_one
Date: Mon, 30 Oct 2023 16:11:12 +0000 [thread overview]
Message-ID: <ff6a98837e883cd538c89ae2bb2788c8619de435.1698682161.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1698682161.git.aburgess@redhat.com>
During a later patch I wanted to reset a single breakpoint, so I
called breakpoint_re_set_one. However, this is not the right thing to
do. If we look at breakpoint_re_set then we see that there's a whole
bunch of state that needs to be preserved prior to calling
breakpoint_re_set_one, and after calling breakpoint_re_set_one we
still need to call update_global_location_list.
I could just update the comment on breakpoint_re_set_one to make it
clearer how the function should be used -- or more likely to warn that
the function should only be used as a helper from breakpoint_re_set.
However, breakpoint_re_set_one is only 3 lines long. So I figure it
might actually be easier to just fold breakpoint_re_set_one into
breakpoint_re_set, then there's no risk of accidentally calling
breakpoint_re_set_one when we shouldn't.
There should be no user visible changes after this commit.
---
gdb/breakpoint.c | 26 ++++++++------------------
1 file changed, 8 insertions(+), 18 deletions(-)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 6370c17c4e0..34dd7c320b1 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -13015,17 +13015,6 @@ create_sals_from_location_spec_default (location_spec *locspec,
parse_breakpoint_sals (locspec, canonical);
}
-/* Reset a breakpoint. */
-
-static void
-breakpoint_re_set_one (breakpoint *b)
-{
- input_radix = b->input_radix;
- set_language (b->language);
-
- b->re_set ();
-}
-
/* Re-set breakpoint locations for the current program space.
Locations bound to other program spaces are left untouched. */
@@ -13037,12 +13026,11 @@ breakpoint_re_set (void)
scoped_restore save_input_radix = make_scoped_restore (&input_radix);
scoped_restore_current_pspace_and_thread restore_pspace_thread;
- /* breakpoint_re_set_one sets the current_language to the language
- of the breakpoint it is resetting (see prepare_re_set_context)
- before re-evaluating the breakpoint's location. This change can
- unfortunately get undone by accident if the language_mode is set
- to auto, and we either switch frames, or more likely in this context,
- we select the current frame.
+ /* To ::re_set each breakpoint we set the current_language to the
+ language of the breakpoint before re-evaluating the breakpoint's
+ location. This change can unfortunately get undone by accident if
+ the language_mode is set to auto, and we either switch frames, or
+ more likely in this context, we select the current frame.
We prevent this by temporarily turning the language_mode to
language_mode_manual. We restore it once all breakpoints
@@ -13059,7 +13047,9 @@ breakpoint_re_set (void)
{
try
{
- breakpoint_re_set_one (&b);
+ input_radix = b.input_radix;
+ set_language (b.language);
+ b.re_set ();
}
catch (const gdb_exception &ex)
{
--
2.25.4
next prev parent reply other threads:[~2023-10-30 16:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <id:cover.1696368409.git.aburgess@redhat.com>
2023-10-30 16:11 ` [PATCHv6 00/10] thread-specific breakpoints in just some inferiors Andrew Burgess
2023-10-30 16:11 ` [PATCHv6 01/10] gdb: create_breakpoint: add asserts and additional comments Andrew Burgess
2023-10-30 16:11 ` [PATCHv6 02/10] gdb: create_breakpoint: asserts relating to extra_string/parse_extra Andrew Burgess
2023-10-30 16:11 ` [PATCHv6 03/10] gdb: change 'if' to gdb_assert in update_dprintf_command_list Andrew Burgess
2023-10-30 16:11 ` [PATCHv6 04/10] gdb: build dprintf commands just once in code_breakpoint constructor Andrew Burgess
2023-10-30 16:11 ` [PATCHv6 05/10] gdb: don't display inferior list for pending breakpoints Andrew Burgess
2023-10-30 16:11 ` [PATCHv6 06/10] gdb: parse pending breakpoint thread/task immediately Andrew Burgess
2023-10-30 16:11 ` [PATCHv6 07/10] gdb: don't set breakpoint::pspace for in create_breakpoint Andrew Burgess
2023-10-30 16:11 ` Andrew Burgess [this message]
2023-10-30 16:11 ` [PATCHv6 09/10] gdb: remove tracepoint_probe_create_sals_from_location_spec Andrew Burgess
2023-10-30 16:11 ` [PATCHv6 10/10] gdb: only insert thread-specific breakpoints in the relevant inferior Andrew Burgess
2023-10-03 21:29 [PATCHv5 00/10] thread-specific breakpoints in just some inferiors Andrew Burgess
2023-12-02 10:42 ` [PATCHv6 " Andrew Burgess
2023-12-02 10:42 ` [PATCHv6 08/10] gdb: remove breakpoint_re_set_one 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=ff6a98837e883cd538c89ae2bb2788c8619de435.1698682161.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).