From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 1/5] gdb: add program_space parameter to mark_breakpoints_out
Date: Tue, 6 Feb 2024 12:14:23 -0500 [thread overview]
Message-ID: <20240206171514.119244-2-simon.marchi@efficios.com> (raw)
In-Reply-To: <20240206171514.119244-1-simon.marchi@efficios.com>
Make the current_program_space reference bubble up one level.
Change-Id: Idc8ed78d23bf3bb2969f6963d8cc049f26901c29
---
gdb/breakpoint.c | 8 ++++----
gdb/breakpoint.h | 5 +++--
gdb/infrun.c | 2 +-
gdb/target.c | 2 +-
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 7d1171ec35eb..d844ef7baf25 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -4216,13 +4216,13 @@ remove_breakpoint (struct bp_location *bl)
return remove_breakpoint_1 (bl, REMOVE_BREAKPOINT);
}
-/* Clear the "inserted" flag in all breakpoints. */
+/* See breakpoint.h. */
void
-mark_breakpoints_out (void)
+mark_breakpoints_out (program_space *pspace)
{
for (bp_location *bl : all_bp_locations ())
- if (bl->pspace == current_program_space)
+ if (bl->pspace == pspace)
bl->inserted = 0;
}
@@ -4248,7 +4248,7 @@ breakpoint_init_inferior (enum inf_context context)
if (gdbarch_has_global_breakpoints (current_inferior ()->arch ()))
return;
- mark_breakpoints_out ();
+ mark_breakpoints_out (pspace);
for (breakpoint &b : all_breakpoints_safe ())
{
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 93c49520e8ce..e7bebed2725d 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1764,8 +1764,9 @@ extern void breakpoint_set_inferior (struct breakpoint *b, int inferior);
extern void breakpoint_set_task (struct breakpoint *b, int task);
-/* Clear the "inserted" flag in all breakpoints. */
-extern void mark_breakpoints_out (void);
+/* Clear the "inserted" flag in all breakpoints locations in PSPACE. */
+
+extern void mark_breakpoints_out (program_space *pspace);
extern struct breakpoint *create_jit_event_breakpoint (struct gdbarch *,
CORE_ADDR);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 87965fb12742..d00a98906d71 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1247,7 +1247,7 @@ follow_exec (ptid_t ptid, const char *exec_file_target)
value that was overwritten with a TRAP instruction). Since
we now have a new a.out, those shadow contents aren't valid. */
- mark_breakpoints_out ();
+ mark_breakpoints_out (current_program_space);
/* The target reports the exec event to the main thread, even if
some other thread does the exec, and even if the main thread was
diff --git a/gdb/target.c b/gdb/target.c
index ec75f952ea20..e72e22da69a3 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3628,7 +3628,7 @@ generic_mourn_inferior (void)
/* Mark breakpoints uninserted in case something tries to delete a
breakpoint while we delete the inferior's threads (which would
fail, since the inferior is long gone). */
- mark_breakpoints_out ();
+ mark_breakpoints_out (inf->pspace);
if (inf->pid != 0)
exit_inferior (inf);
--
2.43.0
next prev parent reply other threads:[~2024-02-06 17:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-06 17:14 [PATCH 0/5] Random cleanup patches Simon Marchi
2024-02-06 17:14 ` Simon Marchi [this message]
2024-02-06 17:14 ` [PATCH 2/5] gdb: add inferior parameter to breakpoint_init_inferior Simon Marchi
2024-02-06 17:14 ` [PATCH 3/5] gdb: add program_space parameter to disable_breakpoints_in_shlibs Simon Marchi
2024-02-06 17:14 ` [PATCH 4/5] gdb: add program_space parameter to clear_solib Simon Marchi
2024-02-07 3:37 ` Simon Marchi
2024-02-06 17:14 ` [PATCH 5/5] gdb: remove unnecessary nullptr check in remove_user_added_objfile Simon Marchi
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=20240206171514.119244-2-simon.marchi@efficios.com \
--to=simon.marchi@efficios.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).