This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello, following this discussion at http://sourceware.org/ml/gdb/2011-03/msg00136.html, I would like to suggest a patch for the Python event system. Based on the ''exited", "cont", ... events, this patch allows a python script to register an interest to the loading of new object files in the debuggee. GDB observer "observer_attach_new_objfile" is used to trigger the Python callback. This patch completes the auto-loading feature (http://sourceware.org/gdb/current/onlinedocs/gdb/objfile_002dgdb_002epy-file.html#objfile_002dgdb_002epy-file), and, likewise, allows Python's "gdb.current_objfile ()" to return the current object file. Here is an example of it utilization: > def obj_handler (event): > ? ? ? if gdb.current_objfile () is not None: > ? ? ? ? ? ? ? print "-->",gdb.current_objfile ().filename > ? ? ? else: > ? ? ? ? ? ? ? print "---------------->Cleanup" > > gdb.events.newobjfile.connect (obj_handler) There is still one thing I'm not happy with in the code, it's how to 'properly' access "gdbpy_current_objfile" ? I commented out "static" and declared it "extern" when I needed it, but that's certainly not the best way: gdb/python/python.c /*static*/ struct objfile *gdbpy_current_objfile; gdb/python/py-inferior.c extern struct objfile *gdbpy_current_objfile; please let me know what you thing about it Cordially, Kevin
Attachment:
gdb-newobjfile.diff
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |