From aa9be61e7d4097f62813c216b4dc2288b8b402d5 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 3 Oct 2023 22:20:18 -0400 Subject: [PATCH] gdb: add program_space parameter to emit_clear_objfiles_event 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 Approved-By: Tom Tromey --- 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 01386dde84c..b9e9af4d732 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 906d402827c..e7a9d822409 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 34e8e4923b5..2068d39353a 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.30.2