public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Phil Muldoon <pmuldoon@redhat.com>
To: Nick Bull <nicholaspbull@gmail.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2] Events when inferior is modified
Date: Mon, 25 Nov 2013 11:50:00 -0000	[thread overview]
Message-ID: <52931CEC.7040407@redhat.com> (raw)
In-Reply-To: <528A0A83.1080203@gmail.com>

On 18/11/13 12:39, Nick Bull wrote:

> This patch adds new observers, and corresponding Python events, for
> various actions on an inferior: calling a function (by hand),
> modifying registers or modifying memory.

Thanks just a few nits and some questions. I did not see tests for
these, and also, documentation?  In any case, both are needed.

Cheers,

Phil


> diff --git a/gdb/Makefile.in b/gdb/Makefile.in
> index 975edbf..7775bde 100644
> --- a/gdb/Makefile.in
> +++ b/gdb/Makefile.in
> @@ -297,6 +297,7 @@ SUBDIR_PYTHON_OBS = \
>      py-function.o \
>      py-gdb-readline.o \
>      py-inferior.o \
> +    py-infcallevent.o \

I'd appreciate if you kept the alphabetical ordering here.

>      py-infthread.o \
>      py-lazy-string.o \
>      py-linetable.o \
> @@ -333,6 +334,7 @@ SUBDIR_PYTHON_SRCS = \
>      python/py-function.c \
>      python/py-gdb-readline.c \
>      python/py-inferior.c \
> +    python/py-infcallevent.c \

And here.

> +py-infcallevent.o: $(srcdir)/python/py-infcallevent.c
> +    $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-infcallevent.c
> +    $(POSTCOMPILE)
> +
>  py-infthread.o: $(srcdir)/python/py-infthread.c
>      $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-infthread.c
>      $(POSTCOMPILE)

Ditto.

> diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi
> index f753965..ab15725 100644
> --- a/gdb/doc/observer.texi
> +++ b/gdb/doc/observer.texi
> @@ -253,6 +253,22 @@ The trace state variable @var{tsv} is deleted.  If @var{tsv} is

> diff --git a/gdb/python/py-event.h b/gdb/python/py-event.h
> index f0ff629..2f2da90 100644
> --- a/gdb/python/py-event.h
> +++ b/gdb/python/py-event.h
> @@ -105,6 +105,15 @@ typedef struct
>  extern int emit_continue_event (ptid_t ptid);
>  extern int emit_exited_event (const LONGEST *exit_code, struct inferior *inf);
> 
> +typedef enum
> +{
> +  inferior_altered_pre_call,
> +  inferior_altered_post_call,
> +  inferior_altered_register_change,
> +  inferior_altered_memory_change
> +} inferior_altered_kind;
> +

I'm kind of on the fence about the inferior_altered naming.  A lot of
things can alter an inferior which would make this a very broad event
category. Like single stepping I would consider altering the inferior.

With your memory changed event, would it fire on a breakpoint
insertion? GDB does a lot of installing/uninstalling of breakpoints
behind the scene in the inferior.

Also, it would be super if we could split up the register
and memory events with read/write events.  What do you think?


> diff --git a/gdb/python/py-infcallevent.c b/gdb/python/py-infcallevent.c
> new file mode 100644
> index 0000000..68e70f1
> --- /dev/null
> +++ b/gdb/python/py-infcallevent.c
> @@ -0,0 +1,98 @@
> +/* Python interface to inferior function events.
> +
> +   Copyright (C) 2009-2013 Free Software Foundation, Inc.
> +

If this is a new file, probably just 2013.


> +/* Callback function which notifies observers when a continue event occurs.
> +   This function will create a new Python continue event object.
> +   Return -1 if emit fails.  */
> +

This comment attached to the function below  looks pasted from another function?

> +int
> +emit_inferior_altered_event (inferior_altered_kind flag)
> +{
> +  PyObject *event;
> +
> +  if (evregpy_no_listeners_p (gdb_py_events.inferior_altered))
> +    return 0;
> +
> +  event = create_inferior_call_event_object (flag);
> +  if (event != NULL)
> +    return evpy_emit_event (event, gdb_py_events.inferior_altered);
> +  return -1;
> +}
> +


Cheers,

Phil

  parent reply	other threads:[~2013-11-25  9:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28 17:07 Nick Bull
2013-07-30 21:04 ` Tom Tromey
2013-08-01 15:47   ` Pedro Alves
2013-08-07 14:41   ` Nick Bull
2013-11-18 12:51     ` [PATCH v2] " Nick Bull
2013-11-18 15:15       ` Eli Zaretskii
2013-11-25 11:50       ` Phil Muldoon [this message]
2013-12-01 15:23         ` Nick Bull
2013-12-09 17:48           ` Nick Bull
2013-12-10 11:04             ` Phil Muldoon
2013-12-12 17:12               ` Nick Bull
2013-12-21 21:26                 ` Nick Bull

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=52931CEC.7040407@redhat.com \
    --to=pmuldoon@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nicholaspbull@gmail.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).