[PATCH] Don't skip over return trampolines when instruction-stepping

Doug Evans dje@google.com
Wed Dec 7 01:55:00 GMT 2011


On Tue, Dec 6, 2011 at 2:25 PM, Maciej W. Rozycki
<macro@codesourcery.com> wrote:
> Hi,
>
>  I don't think "stepi" should ever execute more than one instruction
> (special cases like branch delay slots excepted).

Agreed.

> However the return
> trampoline code skips over such pieces in one go even in the
> instruction-stepping mode.
>
>  Here's a fix to address this problem.  Unfortunately this hook is
> currently only used by two platforms -- RS6000/AIX and PA-RISC/HP-UX --
> both of which are too exotic for me to test, but the change should be
> obvious anyway.
>
>  The test suite doesn't really cover instruction-stepping (being too
> architecture-specific for generic coverage), but this was noticed in
> manual MIPS16 testing with one of the followup changes that uses the
> return trampoline hook to handle MIPS16 return thunks.
>
>  OK to apply?
>
> 2011-12-06  Maciej W. Rozycki  <macro@mips.com>
>            Maciej W. Rozycki  <macro@codesourcery.com>
>
>        gdb/
>        * infrun.c (handle_inferior_event): Don't proceed through
>        shared library trampolines if stepping at the machine
>        instruction level.
>
>  Maciej
>
> gdb-return-trampoline-step.diff
> Index: gdb-fsf-trunk-quilt/gdb/infrun.c
> ===================================================================
> --- gdb-fsf-trunk-quilt.orig/gdb/infrun.c       2011-11-08 11:25:58.635899589 +0000
> +++ gdb-fsf-trunk-quilt/gdb/infrun.c    2011-11-08 11:26:07.545882458 +0000
> @@ -5009,7 +5009,8 @@ handle_inferior_event (struct execution_
>   /* If we're in the return path from a shared library trampoline,
>      we want to proceed through the trampoline when stepping.  */
>   if (gdbarch_in_solib_return_trampoline (gdbarch,
> -                                         stop_pc, ecs->stop_func_name))
> +                                         stop_pc, ecs->stop_func_name)
> +      && ecs->event_thread->control.step_over_calls != STEP_OVER_NONE)
>     {
>       /* Determine where this trampoline returns.  */
>       CORE_ADDR real_stop_pc;
>

I think it's ok but I'd give it a few more days to see if I missed something.



More information about the Gdb-patches mailing list