Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Exposing inferior_created in Python
@ 2013-03-14  4:19 Gareth McMullin
  2013-03-14  9:43 ` Phil Muldoon
  0 siblings, 1 reply; 4+ messages in thread
From: Gareth McMullin @ 2013-03-14  4:19 UTC (permalink / raw)
  To: gdb

Hi

I'm interested in having the inferior_created observer exposed as a
Python event.

The application I intend to work on is trace port capture on ARM
Cortex microcontrollers using a Python GDB extension.  I have this at
a proof-of-concept level[1], but a problem that I have is that the
trace port registers in the target are reset with the target on say a
GDB 'run' command. It would be convenient if a Python event was
available on which I can configure the appropriate registers.

I'm happy to do the work to make this happen, but I'm interested if
this change would be considered for inclusion.  I am happy to sign the
copyright assignment to the FSF.

Cheers,
Gareth

[1] https://github.com/gsmcmullin/magictpa

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Exposing inferior_created in Python
  2013-03-14  4:19 Exposing inferior_created in Python Gareth McMullin
@ 2013-03-14  9:43 ` Phil Muldoon
  2013-03-14 11:13   ` Gareth McMullin
  0 siblings, 1 reply; 4+ messages in thread
From: Phil Muldoon @ 2013-03-14  9:43 UTC (permalink / raw)
  To: Gareth McMullin; +Cc: gdb

On 14/03/13 04:18, Gareth McMullin wrote:
> Hi
> 
> 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?

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.

Cheers

Phil


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Exposing inferior_created in Python
  2013-03-14  9:43 ` Phil Muldoon
@ 2013-03-14 11:13   ` Gareth McMullin
  2013-03-20 20:40     ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Gareth McMullin @ 2013-03-14 11:13 UTC (permalink / raw)
  To: Phil Muldoon; +Cc: gdb

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Exposing inferior_created in Python
  2013-03-14 11:13   ` Gareth McMullin
@ 2013-03-20 20:40     ` Tom Tromey
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2013-03-20 20:40 UTC (permalink / raw)
  To: Gareth McMullin; +Cc: Phil Muldoon, gdb

>>>>> "Gareth" == Gareth McMullin <gareth@blacksphere.co.nz> writes:

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

I think adding an event for this would be fine.
I probably wouldn't call it "inferior_created" though.

Tom


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-20 20:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-14  4:19 Exposing inferior_created in Python Gareth McMullin
2013-03-14  9:43 ` Phil Muldoon
2013-03-14 11:13   ` Gareth McMullin
2013-03-20 20:40     ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox