public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Nick Bull <nicholaspbull@gmail.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Events when inferior is modified
Date: Wed, 07 Aug 2013 14:41:00 -0000	[thread overview]
Message-ID: <CABbKtXsh+BG6=s6ZmaoEFYeiFR-9SAWqMYk3DqP-Ej047zd7LQ@mail.gmail.com> (raw)
In-Reply-To: <87k3k7kbdy.fsf@fleche.redhat.com>

Tom,

Thanks for your comments: I'll modify and resubmit.

On 30 July 2013 22:04, Tom Tromey <tromey@redhat.com> wrote:
>
> I'm curious to know why you wanted pre- and post-observers for inferior
> calls, but not anything else.
[...]
>
> It seem to me that this may just be an approximation of "dirty" in the
> remote case.  E.g., gdbserver may write a breakpoint and otherwise
> modify things without notifying gdb.
>
> On the other hand, maybe you want to rule out breakpoints from being
> considered "dirty".  But then the change has to be more complicated in
> another way.

The sense of "dirty" that I'm using is "the user has interfered with
program state", and not for example "gdb has some cached data which is
now stale".

For context, I'm using this patch in a system with a lot of Python
scripting around gdb to support the user in various ways. I'm also
only concerned with the remote gdbserver case, should that be
relevant.

The motivation behind this work is that the user, sitting at the gdb
command line trying to debug their program, has the ability to modify
the program's state under its feet and hence change its future
behaviour. Which is potentially useful in exploring fixes without
recompiling, but carries the risk that you leave a change in and carry
on, forgetting that you're not debugging the real system any more. I
don't want to totally prevent that kind of modification, but I do want
to know that it has happened. Various UI options are possible at that
point, such as emitting warnings, changing the prompt etc, but those
choices can all be made in the scripting layer.

Breakpoints aren't a modification for these purposes, as they don't
cause the debugged program to generate different results. Well, I hope
not.

Inferior function calls are useful in conditional breakpoints and for
interrogating data structures, but sometimes they perturb the program
state and sometimes they don't. Ignoring the synthesized stack frame
on which they were called, of course. By receiving observer events
before and after the call, we can work behind the user's back to check
for differences. Again, what we do about that---issuing a warning, or
maybe even reverting the changes---can be decided at a higher level.

Picking up changes to registers and memory is a bonus feature for me,
rather than essential, as it's an explicit choice to change state
whereas a fn call may just read state. And per Pedro's comment, other
ways to modify program state are possible, but haven't tripped me up
yet; so in that respect the itch is sufficiently scratched for now.

Nick

  parent reply	other threads:[~2013-08-07 14:41 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 [this message]
2013-11-18 12:51     ` [PATCH v2] " Nick Bull
2013-11-18 15:15       ` Eli Zaretskii
2013-11-25 11:50       ` Phil Muldoon
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='CABbKtXsh+BG6=s6ZmaoEFYeiFR-9SAWqMYk3DqP-Ej047zd7LQ@mail.gmail.com' \
    --to=nicholaspbull@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --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).