public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 3/5] gdb: add program_space parameter to disable_breakpoints_in_shlibs
Date: Tue,  6 Feb 2024 12:14:25 -0500	[thread overview]
Message-ID: <20240206171514.119244-4-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: Ide917aa306bff1872d961244901d79f65d2da62e
---
 gdb/breakpoint.c  | 7 +++----
 gdb/breakpoint.h  | 5 ++++-
 gdb/solib.c       | 2 +-
 gdb/windows-nat.c | 2 +-
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 8d8e97400e37..5f05657a8b3e 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -7972,11 +7972,10 @@ create_and_insert_solib_event_breakpoint (struct gdbarch *gdbarch, CORE_ADDR add
   return b;
 }
 
-/* Disable any breakpoints that are on code in shared libraries.  Only
-   apply to enabled breakpoints, disabled ones can just stay disabled.  */
+/* See breakpoint.h.  */
 
 void
-disable_breakpoints_in_shlibs (void)
+disable_breakpoints_in_shlibs (program_space *pspace)
 {
   for (bp_location *loc : all_bp_locations ())
     {
@@ -7992,7 +7991,7 @@ disable_breakpoints_in_shlibs (void)
 	   || (b->type == bp_jit_event)
 	   || (b->type == bp_hardware_breakpoint)
 	   || (is_tracepoint (b)))
-	  && loc->pspace == current_program_space
+	  && loc->pspace == pspace
 	  && !loc->shlib_disabled
 	  && solib_name_from_address (loc->pspace, loc->address)
 	  )
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 8530a7127945..226e4d06993e 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1802,7 +1802,10 @@ extern void remove_solib_event_breakpoints (void);
    delete at next stop disposition.  */
 extern void remove_solib_event_breakpoints_at_next_stop (void);
 
-extern void disable_breakpoints_in_shlibs (void);
+/* Disable any breakpoints that are on code in shared libraries in PSPACE.
+   Only apply to enabled breakpoints, disabled ones can just stay disabled.  */
+
+extern void disable_breakpoints_in_shlibs (program_space *pspace);
 
 /* This function returns true if B is a catchpoint.  */
 
diff --git a/gdb/solib.c b/gdb/solib.c
index 0a888430cf9b..98cda039a833 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1187,7 +1187,7 @@ clear_solib (void)
 {
   const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
 
-  disable_breakpoints_in_shlibs ();
+  disable_breakpoints_in_shlibs (current_program_space);
 
   current_program_space->so_list.clear_and_dispose ([] (solib *so) {
     notify_solib_unloaded (current_program_space, *so);
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 48b0d10d24c7..7f3044fc61de 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1906,7 +1906,7 @@ windows_nat_target::do_initial_windows_stuff (DWORD pid, bool attaching)
   inf = current_inferior ();
   if (!inf->target_is_pushed (this))
     inf->push_target (this);
-  disable_breakpoints_in_shlibs ();
+  disable_breakpoints_in_shlibs (current_program_space);
   windows_clear_solib ();
   clear_proceed_status (0);
   init_wait_for_inferior ();
-- 
2.43.0


  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 ` [PATCH 1/5] gdb: add program_space parameter to mark_breakpoints_out Simon Marchi
2024-02-06 17:14 ` [PATCH 2/5] gdb: add inferior parameter to breakpoint_init_inferior Simon Marchi
2024-02-06 17:14 ` Simon Marchi [this message]
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-4-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).