Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Gareth McMullin <gareth@blacksphere.co.nz>
To: Phil Muldoon <pmuldoon@redhat.com>
Cc: gdb@sourceware.org
Subject: Re: Exposing inferior_created in Python
Date: Thu, 14 Mar 2013 11:13:00 -0000	[thread overview]
Message-ID: <CAL8qUbr8nUY-Zui6FBLaL6Zi=30VEQ8WfffbE-V87DZ9M8K4Sw@mail.gmail.com> (raw)
In-Reply-To: <51419BBB.1030800@redhat.com>

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


  reply	other threads:[~2013-03-14 11:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-14  4:19 Gareth McMullin
2013-03-14  9:43 ` Phil Muldoon
2013-03-14 11:13   ` Gareth McMullin [this message]
2013-03-20 20:40     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAL8qUbr8nUY-Zui6FBLaL6Zi=30VEQ8WfffbE-V87DZ9M8K4Sw@mail.gmail.com' \
    --to=gareth@blacksphere.co.nz \
    --cc=gdb@sourceware.org \
    --cc=pmuldoon@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox