From: Matt Rice <ratmice@gmail.com>
To: Tom Tromey <tromey@redhat.com>
Cc: Oguz Kayral <oguzkayral@gmail.com>,
Phil Muldoon <pmuldoon@redhat.com>,
archer@sourceware.org
Subject: Re: Python inferior control
Date: Mon, 20 Sep 2010 16:13:00 -0000 [thread overview]
Message-ID: <AANLkTikE85MG4_Bp1ghPwqO7kEjvog0yVrxuznvH1uAF@mail.gmail.com> (raw)
In-Reply-To: <m3zkw9unia.fsf@fleche.redhat.com>
On Thu, Aug 26, 2010 at 1:28 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Oguz" == Oguz Kayral <oguzkayral@gmail.com> writes:
>
> Oguz> What can we do to make this easier?
>
> I came up with two ideas. Maybe there are more.
>
>
> One is to just have a generic gdb.Event type. It would act as a basic
> wrapper around a dictionary. A module in gdb that wants to generate an
> event would make a dictionary and wrap an Event around it.
>
> This would mean that different kinds of events would not be
> differentiated by type. To make this less troublesome we could add a
> "type" field that would describe the event.
I like this approach,
> Tom> I see new attributes like "stop_eventregistry". I think we should drop
> Tom> the "registry" part of these names.
>
> Oguz> (not specific to stop, applies for all events.)
> Oguz> A stop_eventregistry is not a stop_event. A stop_eventregistry
> Oguz> contains the functions to be called when the inferior stops, a
> Oguz> stop_event contains information about the event(stop_reason etc.). We
> Oguz> can drop it if we can find a way to avoid confusion.
>
> I don't think there will be much confusion if the registry name is
> similar to the class name of the event that it emits. I think this is
> pretty typical in other frameworks.
>
> In Gtk you write something like:
>
> object.connect ("clicked", method)
>
> In GDB you will write something like:
>
> object.stop_event.connect (method)
>
> Or am I confused about how this works?
i'm late to the party, nor do i really know python,
with the simplified event dictionary tromey describes, and the type
flag to go with it, you could just use a single stack/linked list to
push/pop all types of events onto,
and maybe a way to mask which events get pushed if frequency of
events is a problem, maybe incrementing/decrementing a per-event type
counter when events are added/removed so it could avoid looking for
events that aren't there.
this would allow you to easily add and remove event types without
creating a specific registry and allow one to easily figure out which
order the events occured in, (e.g. was the last stopped || running
event a stopped or a running event?) or serialize the event stream so
you could e.g. check if subsequent runs produce the same events
without implementing all of the callbacks.
so in general what i was thinking would look like this
head->filter (list of event types that will be added or that will be ignored)
head->bill_of_materials (event type/count to be incremented when
pushing/popping)
head->list_of_events or something...
a callback mechanism could be added on top of this,
and filter/bill_of_materials need only be implemented if (event
frequency-event desire) is high
i'd think it'd need to be walkable in order to implement peeking of
events without removing.
is this stuff on a branch somewhere?
next prev parent reply other threads:[~2010-09-20 16:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-13 14:54 Phil Muldoon
2010-08-13 19:49 ` Tom Tromey
2010-08-26 15:02 ` Oguz Kayral
2010-08-26 20:28 ` Tom Tromey
2010-09-20 16:13 ` Matt Rice [this message]
2010-09-21 21:48 ` Tom Tromey
2010-08-15 17:42 ` Richard Ward
2010-08-26 20:23 ` Tom Tromey
2010-08-25 16:10 ` Phil Muldoon
2010-12-01 18:58 ` sami wagiaalla
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=AANLkTikE85MG4_Bp1ghPwqO7kEjvog0yVrxuznvH1uAF@mail.gmail.com \
--to=ratmice@gmail.com \
--cc=archer@sourceware.org \
--cc=oguzkayral@gmail.com \
--cc=pmuldoon@redhat.com \
--cc=tromey@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).