This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Reverse Debugging, 3/5
- From: Michael Snyder <msnyder at vmware dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, Daniel Jacobowitz <drow at false dot org>, Pedro Alves <pedro at codesourcery dot com>, teawater <teawater at gmail dot com>
- Date: Mon, 06 Oct 2008 14:31:25 -0700
- Subject: Re: [RFA] Reverse Debugging, 3/5
- References: <48E3CD0B.8020003@vmware.com> <20081006212132.GB21853@adacore.com>
Joel Brobecker wrote:
I had some comments, too, but Pedro made most of them. Here are mine
that don't overlap with his...
+ /* OK, we're just gonna keep stepping here. */
I would prefer if we kept slang out of the comments. Can we use
"going to" instead?
Sure.
+ if (stop_func_sal.pc == stop_pc)
+ {
+ /* We're there already. Just stop stepping now. */
+ ecs->event_thread->stop_step = 1;
+ print_stop_reason (END_STEPPING_RANGE, 0);
+ stop_stepping (ecs);
+ return;
+ }
+ /* Else just reset the step range and keep going.
+ No step-resume breakpoint, they don't work for
+ epilogues, which can have multiple entry paths. */
+ ecs->event_thread->step_range_start = stop_func_sal.pc;
+ ecs->event_thread->step_range_end = stop_func_sal.end;
+ keep_going (ecs);
+ return;
+ }>
Regarding this hunk, it really took me a long time to understand
what we're supposed to do when execution is reverse. I think it
was a combination of the function name together with the fact that
we're not trying to undo what the function does, but instead implement
whatever command the user has issued which caused us to call this
function. I am thinking, for the sake of clarity, to implement this
in a separate function and call the appropriate function from
handle_inferior_event. The function name can then be used to explain
at a glance what it's supposed to do...
You lost me. You're right, of course, it's quite difficult
to follow the flow of control here (it's infrun, what can I
say?). The damn thing's a state machine, you know...
But I didn't follow exactly what you're saying here.
On the one hand, this function ("step_into_function") is
called from only one place (for now), so it wouldn't be too
difficult for me to test exec_direction BEFORE calling it
(and branch off to a different "step_backwards_into_function").
But on the other hand, this is exactly what we are doing here.
We are stepping into a function. Only we're doing it in
reverse, so we're coming in thru a return, not thru a call.
You still think I should split them up?