This is the mail archive of the gdb@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]

Re: Exposing inferior_created in Python


On Thu, Mar 14, 2013 at 10:43 PM, Phil Muldoon <pmuldoon@redhat.com> wrote:
>> I'm interested in having the inferior_created observer exposed as a
>> Python event
>
> I think it is fine to create event and observers in GDB/Python that
> you have identified a need for.
>
> That being said, what do you mean by inferior_created event?

I was referring to the inferior_created observer documented in the
GDB Internals Manual, Appendix A.

What I want it to have a callback called just after the 'vAttach' or 'vRun'
packet has been sent to the remote server, and the stop reply has been
received, but before execution is resumed with 'vCont' or 'c'.  I would like to
read and write inferior memory from this callback.

> Currently we have observers in the Python API for:
>
> * Breakpoint events
> * Continue events.
> * Exiting events
> * New object file events
> * Signal events
> * Inferior halting/stopping events
> * Thread events
>
> Would the thread event/observer satisfy your use-case? I am pretty
> much guessing, though, until you can expand on the inferior_created
> case.

I had considered trying to use the events.cont and events.exited
callbacks, hoping the first cont after an exited would be where I want it,
but as I understand the continue event is only called after the target
is resumed.  Is there an observer exposed that will be called as I
describe above?  If I can achieve this without modifying GDB that would
be great.

In my working copy I now have it doing what I want, but I've used the
inferior_appeared observer rather than inferior_created, because it
provided the inferior as a parameter rather than the target_ops.  For my
purposes it is probably sufficient to call gdb.selected_inferior() in the
callback to get the inferior, as there will only be one.  I'm not too familiar
with the GDB internals; which would be the better observer to expose?

Cheers,
Gareth

-- 
Black Sphere Technologies Ltd.

Web: www.blacksphere.co.nz
Mobile: +64 27 777 2182
Tel: +64 9 478 8885
Skype: gareth.mcmullin
LinkedIn: http://nz.linkedin.com/in/gsmcmullin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]