This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] reverse: Do not run-away on jmp-only instr. function
- From: Pedro Alves <palves at redhat dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 12 Sep 2012 19:18:45 +0100
- Subject: Re: [patch] reverse: Do not run-away on jmp-only instr. function
- References: <20120912142433.GA4699@host2.jankratochvil.net>
Looks good to me. Thanks.
> + /* Do not run away if we are already at function start - the
> + function contains only one (jump) instruction. */
> + if (ecs->stop_func_start != stop_pc)
Might I suggest:
/* If we're already at the start of the function, we've either
just stepped backward into a single instruction function,
or stepped back out of a signal handler to the first instruction
of the function. Just keep going, which will single-step back
to the caller.
There's this a bit below:
if (execution_direction == EXEC_REVERSE)
{
/* Set a breakpoint at callee's start address.
From there we can step once and be back in the caller. */
struct symtab_and_line sr_sal;
init_sal (&sr_sal);
sr_sal.pc = ecs->stop_func_start;
sr_sal.pspace = get_frame_program_space (frame);
insert_step_resume_breakpoint_at_sal (gdbarch,
sr_sal, null_frame_id);
}
Which looks like has the same problem. From reading the code, it seems
that to trigger it, we'd need to step backwards into the first instruction
of a function without line info.
--
Pedro Alves