Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Michael Snyder <msnyder@vmware.com>
Subject: Re: [RFA] Resubmit reverse debugging [4/5]
Date: Thu, 09 Oct 2008 03:11:00 -0000	[thread overview]
Message-ID: <200810090411.17890.pedro@codesourcery.com> (raw)
In-Reply-To: <48ED70A2.7040509@vmware.com>

On Thursday 09 October 2008 03:46:58, Michael Snyder wrote:
> Pedro Alves wrote:

> > Wait, what does your remark about the frame #0 special
> > case mean then?
> 
> This stuff makes your head spin, eh?

Yeah, spins in reverse.

> OK, so this is the inverse of the example that I posted for Joel
> (about stepping into a function backward).  This is "what happens
> if I say "finish" and I'm going backward?"
> 
> So consider the function:
> 
> 18: int foo (int a)
> 19: {
> 20:    return a + 1;
> 21: }
> 
> Now if I'm at line 20 and I want to finish forward, I have to
> find the caller, set a bp AFTER the call, run to it, then
> extract the return value for printing.
> 
> If I want to "reverse-finish", I still find the caller, but
> now I want to set a breakpoint BEFORE (or at) the call insn.
> I'm going to execute backward thru the call, rather than
> execute forward thru the return.

Thanks for the explanations.

Ok, I had understood that correctly then. 

> My "special case" comment had nothing to do with frame #0.

Ok, it's probably too late here to be thinking, but I found this
frame #0 reference confusing:

+  Note that this can only happen at frame #0, since there's
+  no way that a function up the stack can have a return address
+  that's equal to its entry point.  */

> The special case is that, if I happen to be starting from
> the first instruction of the callee (the label or entry point),
> then there is no need to set a breakpoint.  I can just do
> a singlestep, and that will take me to the caller.
> 

Yep, that I got too.  That's what I was refering to when
I mentioned a "begin" command.  A "begin" would do:

- execute backward until I'm at the start of the function
  (after prologue)
- If I want to go to the caller (like your finish), I do
  another reverse "step" or "next".

No need for the extra single-step special case,

> Also, when I am going backward, there is no return value
> for me to extract when I get back to the caller, since the
> callee is not returning.

Or this special case.

> As for the command name, I'm still not gonna argue about that.  ;-)

So, it wasn't just about the command name.  ;-)

> I just figured that a logical starting place would be, we have to
> know what we're going to do in the case of each existing command
> if we need to do it backward.

Ok.

Thanks again for the explanations.

-- 
Pedro Alves


  reply	other threads:[~2008-10-09  3:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-08  2:22 Michael Snyder
2008-10-08 23:38 ` Pedro Alves
2008-10-08 23:55   ` Michael Snyder
2008-10-09  0:36 ` Pedro Alves
2008-10-09  1:20   ` Michael Snyder
2008-10-09  2:12     ` Pedro Alves
2008-10-09  2:39       ` Michael Snyder
2008-10-09  3:21         ` Pedro Alves
2008-10-09  2:49       ` Michael Snyder
2008-10-09  3:11         ` Pedro Alves [this message]
2008-10-17 19:47 ` Michael Snyder

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=200810090411.17890.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=msnyder@vmware.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