[RFC - Python] New ObjFile event

Kevin Pouget kevin.pouget@gmail.com
Thu Sep 1 11:09:00 GMT 2011


On Thu, Sep 1, 2011 at 12:18 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Kevin Pouget <kevin.pouget@gmail.com>
>> Date: Thu, 1 Sep 2011 11:17:51 +0200
>> Cc: pmuldoon@redhat.com, gdb-patches@sourceware.org
>>
>>  This event indicates that the inferior or one of its threads has received as
>>  signal.  @code{gdb.SignalEvent} has the following attributes:
>>
>> +@item events.newobjfile
>> +Emits @code{gdb.NewObjFileEvent} which indicates that a new object-file has
>> +been loaded by @value{GDBN}.
>> +
>> +During the callback, ``current objfile'' will be set to the new object file.
>> +
>>  @table @code
>>  @defivar SignalEvent stop_signal
>>  A string representing the signal received by the inferior.  A list of possible
>> @@ -22949,10 +22955,10 @@ The following objfile-related functions are available in the
>
> The addition doesn't look right: shouldn't it be _after_ the following
> @table line?  events.newobjfile is an attribute of the same object as
> stop_signal, right?


sorry; I moved the paragraph to the right place.

>> +When auto-loading a Python script (@pxref{Auto-loading}) and during new
>> +object-file callbacks, @value{GDBN} sets the ``current objfile'' to the
>
> Why did you use "new" here?  New in relation to what?

"new" here refers to object-file, but I'm not sure I can write "during
new-object-file callbacks", can I?

I also added a label reference to make things clearer here:

> During the callback, ``current objfile'' will be set to the new object file
> (@pxref{Objfiles In Python}).

(I'm not sure why there is no `_' between 'current' and 'objfile', I
copied it from another place --- @value{GDBN} sets the ``current
objfile'' to the
corresponding objfile.)


Many thanks,

Kevin

2011-09-01  Kevin Pouget  <kevin.pouget@st.com>

	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 newobjfile 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.

2011-09-01  Kevin Pouget  <kevin.pouget@st.com>

	Allow Python notification of new object-file loadings.
	* gdb.texinfo (Events In Python): Document `gdb.NewObjFileEvent'
	events emitter.
	(Objfiles In Python): Indicate that `gdb.current_objfile' is also set
	during new object-file callbacks.

2011-09-01  Kevin Pouget  <kevin.pouget@st.com>

	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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-New-ObjFile-event.patch
Type: text/x-patch
Size: 14688 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20110901/33045ac1/attachment.bin>


More information about the Gdb-patches mailing list