On Tue, Oct 4, 2011 at 7:01 PM, Tom Tromey wrote: > > >>>>> "Kevin" == Kevin Pouget writes: > > Tom> Why not simply make the objfile object an attribute of the event? > Tom> That seems cleaner to me. > > Kevin> We already discussed this point, but it was at the end of ... March :) > > Thanks for the reminder. > I completely forgot about that. > > Kevin> I was ambivalent about this point too; I chose > Kevin> "gdb.current_objfile()" because autoloading > Kevin> (http://sourceware.org/gdb/current/onlinedocs/gdb/Auto_002dloading.html) > Kevin> already does it this way, and the two features are pretty similar. I > Kevin> felt that it would have been strange to access "gdb.current_objfile ()" > Kevin> in one case, and sth like "event.new_objfile" in the other case > > Ok, I see. > > I think it is best to pass it as part of the event. > It is ok with me if you also want to have it set the current objfile. > > Tom I got rid of the "gdb.current_objfile ()" access to the objfile and kept only the "NewObjFile.new_objfile" attribute of the Event object, which indeed makes more sense. I've updated the code and documentation accordingly; could you please tell me if it seems good for you? Thanks, Kevin 2011-10-05 Kevin Pouget Allow Python notification of new object-file loadings. * Makefile.in (SUBDIR_PYTHON_SRCS): Add py-newobjfilevent.c. (SUBDIR_PYTHON_OBS): Add py-newobjfileevent.o. Add build rule for this file. * python/py-event.h (emit_new_objfile_event): New prototype. (newobjfile): New Python event emitter. * python/py-evts.c (gdbpy_initialize_py_events): Add new_objfile to Python event registry. * python/py-inferior.c: Include objfiles.h (python_new_objfile): New function. (gdbpy_initialize_inferior): Add python_new_objfile to the new objfile observers. * python/py-newobjfileevent.c: New file. * python-internal.h (gdbpy_initialize_new_objfile_event): New prototype. (gdbpy_current_objfile): New global variable. * python/python.c (gdbpy_current_objfile): Make global. (_initialize_python): Add gdbpy_initialize_new_objfile_event call. * NEWS: Add item for new Python event "gdb.newobjfile" 2011-10-05 Kevin Pouget Allow Python notification of new object-file loadings. * gdb.texinfo (Events In Python): Document `gdb.NewObjFileEvent' event type. 2011-10-05 Kevin Pouget Allow Python notification of new object-file loadings. * gdb.python/py-events.exp: Test newobjfile event. * gdb.python/py-events.py: Register newobjfile callback. * gdb.python/py-events.c: Add call to shared library * gdb.python/py-events-shlib.c: New file.