[patch] reverse: Do not run-away on jmp-only instr. function

Pedro Alves palves@redhat.com
Wed Sep 12 18:19:00 GMT 2012


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



More information about the Gdb-patches mailing list