public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 3/8] gdb: add program_space parameter to emit_clear_objfiles_event
Date: Tue,  3 Oct 2023 22:20:18 -0400	[thread overview]
Message-ID: <20231004022305.298534-4-simon.marchi@polymtl.ca> (raw)
In-Reply-To: <20231004022305.298534-1-simon.marchi@polymtl.ca>

From: Simon Marchi <simon.marchi@efficios.com>

Add program_space space parameters to emit_clear_objfiles_event and
create_clear_objfiles_event_object, making the reference to
current_program_space bubble up a bit.

Change-Id: I5fde2071712781e5d45971fa0ab34d85d3a49a71
---
 gdb/python/py-event.h           | 2 +-
 gdb/python/py-inferior.c        | 2 +-
 gdb/python/py-newobjfileevent.c | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gdb/python/py-event.h b/gdb/python/py-event.h
index 01386dde84cd..b9e9af4d7329 100644
--- a/gdb/python/py-event.h
+++ b/gdb/python/py-event.h
@@ -78,7 +78,7 @@ extern gdbpy_ref<> create_thread_event_object (PyTypeObject *py_type,
 
 extern int emit_new_objfile_event (struct objfile *objfile);
 extern int emit_free_objfile_event (struct objfile *objfile);
-extern int emit_clear_objfiles_event (void);
+extern int emit_clear_objfiles_event (program_space *pspace);
 
 extern void evpy_dealloc (PyObject *self);
 extern int evpy_add_attribute (PyObject *event,
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index 906d402827ce..e7a9d822409b 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -196,7 +196,7 @@ python_new_objfile (struct objfile *objfile)
 
   if (objfile == NULL)
     {
-      if (emit_clear_objfiles_event () < 0)
+      if (emit_clear_objfiles_event (current_program_space) < 0)
 	gdbpy_print_stack ();
     }
   else
diff --git a/gdb/python/py-newobjfileevent.c b/gdb/python/py-newobjfileevent.c
index 34e8e4923b58..2068d39353a4 100644
--- a/gdb/python/py-newobjfileevent.c
+++ b/gdb/python/py-newobjfileevent.c
@@ -93,14 +93,14 @@ emit_free_objfile_event (struct objfile *objfile)
 /* Subroutine of emit_clear_objfiles_event to simplify it.  */
 
 static gdbpy_ref<>
-create_clear_objfiles_event_object (void)
+create_clear_objfiles_event_object (program_space *pspace)
 {
   gdbpy_ref<> objfile_event
     = create_event_object (&clear_objfiles_event_object_type);
   if (objfile_event == NULL)
     return NULL;
 
-  gdbpy_ref<> py_progspace = pspace_to_pspace_object (current_program_space);
+  gdbpy_ref<> py_progspace = pspace_to_pspace_object (pspace);
   if (py_progspace == NULL || evpy_add_attribute (objfile_event.get (),
 						  "progspace",
 						  py_progspace.get ()) < 0)
@@ -115,12 +115,12 @@ create_clear_objfiles_event_object (void)
    Return -1 if emit fails.  */
 
 int
-emit_clear_objfiles_event (void)
+emit_clear_objfiles_event (program_space *pspace)
 {
   if (evregpy_no_listeners_p (gdb_py_events.clear_objfiles))
     return 0;
 
-  gdbpy_ref<> event = create_clear_objfiles_event_object ();
+  gdbpy_ref<> event = create_clear_objfiles_event_object (pspace);
   if (event != NULL)
     return evpy_emit_event (event.get (), gdb_py_events.clear_objfiles);
   return -1;
-- 
2.42.0


  parent reply	other threads:[~2023-10-04  2:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-04  2:20 [PATCH 0/8] Split new_objfile observable Simon Marchi
2023-10-04  2:20 ` [PATCH 1/8] gdb: add program_space parameter to ada_clear_symbol_cache Simon Marchi
2023-10-04  2:20 ` [PATCH 2/8] gdb: add program_space parameters to some functions in symtab.c Simon Marchi
2023-10-04  2:20 ` Simon Marchi [this message]
2023-10-04  2:20 ` [PATCH 4/8] gdb: use objfile->pspace in auto-load.c Simon Marchi
2023-10-04  2:20 ` [PATCH 5/8] gdb: add program_space parameters to some auto-load functions Simon Marchi
2023-10-04  2:20 ` [PATCH 6/8] gdb: add all_objfiles_removed observer Simon Marchi
2023-10-05 16:35   ` Tom Tromey
2023-10-05 17:13     ` Simon Marchi
2023-10-04  2:20 ` [PATCH 7/8] gdb: remove unnecessary nullptr check in free_objfile observers Simon Marchi
2023-10-04  2:20 ` [PATCH 8/8] gdb: use objfile->pspace " Simon Marchi
2023-10-05 16:36 ` [PATCH 0/8] Split new_objfile observable Tom Tromey
2023-10-05 17:23   ` 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=20231004022305.298534-4-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    /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).