From e9feb8a0104f7b21ee1c70535d8c07f0447a5b0c Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Tue, 17 Mar 2026 14:53:48 +0000 Subject: gdb: change new_objfile observer to take an objfile reference I was looking at the new_objfile observer and noticed a comment in reread_symbols (symfile.c) that seemed out of date, it talked about calling the new objfile observer with a NULL objfile argument. A little digging indicates that the comment is indeed out of date, and that we never call the new_objfile observer with a NULL argument any more. So in this commit I have: 1. Updated the out of date comment in reread_symbols. 2. Changed the argument type for the new_objfile observer from 'objfile *' to 'objfile &'. Passing a NULL pointer is no longer an option. 3. Updated the existing new_objfile observers to take 'objfile &' and updated their implementations as needed. There should be no user visible changes after this commit. Approved-By: Simon Marchi --- gdb/python/py-inferior.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'gdb/python') diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c index ea9f884a397..1a30f4ee378 100644 --- a/gdb/python/py-inferior.c +++ b/gdb/python/py-inferior.c @@ -163,19 +163,18 @@ python_inferior_exit (struct inferior *inf) gdbpy_print_stack (); } -/* Callback used to notify Python listeners about new objfiles loaded in the - inferior. OBJFILE may be NULL which means that the objfile list has been - cleared (emptied). */ +/* Callback used to notify Python listeners that OBJFILE has been loaded in + to the current inferior. */ static void -python_new_objfile (struct objfile *objfile) +python_new_objfile (struct objfile &objfile) { if (!gdb_python_initialized) return; - gdbpy_enter enter_py (objfile->arch ()); + gdbpy_enter enter_py (objfile.arch ()); - if (emit_new_objfile_event (objfile) < 0) + if (emit_new_objfile_event (&objfile) < 0) gdbpy_print_stack (); } -- cgit v1.2.3