This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: [discuss] Support for reverse-execution
- From: "Eli Zaretskii" <eliz at gnu dot org>
- To: Johan Rydberg <jrydberg at virtutech dot com>
- Cc: dan at shearer dot org, gdb at sources dot redhat dot com
- Date: Fri, 20 May 2005 13:32:47 +0300
- Subject: Re: [discuss] Support for reverse-execution
- References: <20050519012254.GZ19642@erizo.shearer.org> <428C8E04.3000305@virtutech.com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Thu, 19 May 2005 15:00:52 +0200
> From: Johan Rydberg <jrydberg@virtutech.com>
> Cc: gdb@sources.redhat.com
>
> Here's a patch against CVS that implements the following commands:
>
> - rstep, rstepi
> - rnext, rnexti
>
> The obvious commands "rcontinue" and "rfinished" are not yet
> implemented, and therefor not included in this patch. The command
> names are of course up for discussion.
I don't mind these names; reverse-next etc. seem awkward, but rnext
etc. are okay, I think. However, see my other comments in response to
Daniel.
> What I have done is add a new variable, step_direction, that can either
> be STEP_DIR_FORWARD or STEP_DIR_REVERSE.
I'd prefer STEP_FORWARD and STEP_BACKWARD.
> To implement "rnext" I had to add a new target-specific function that
> tries to figure out the address of the call instruction based on the
> last executed instruction and the instruction to be executed, IF the
> current instruction can be identified as a return insn.
Sorry, I'm confused. Isn't it right that if I'm stepping backwards
through code such as this:
i += 1;
foo (i);
=>i = 0;
where "=>" shows the current source line, then typing `rnext' once
will get me to this:
i += 1;
=>foo (i);
i = 0;
which means I'm now before the CALL insn that calls `foo'? If so,
what ``return insn'' were you talking about? If it's the return
instruction that returns from `foo', then that insn is inside the code
generatedfor `foo', which GDB won't see. What am I missing?
> + add_com ("rnext", class_run, rnext_command,
> + "Step program until it reaches the previous source line.\n\
"Go backwards until the program reaches the source line before the
current one."
> + add_com_alias ("rn", "rnext", class_run, 1);
Do we want another alias called "previous"?
> +extern enum step_direction_kind step_direction;
Yuk! a global variable!
> + if (step_direction == STEP_DIR_FORWARD)
> + target_resume (resume_ptid, step, sig);
> + else
> + {
> + target_reverse (resume_ptid, step);
> + }
I'd prefer that target_resume accepted the direction argument. Is
there something that I'm missing that makes this hard or impossible?