This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ping][RFA] Return trampoline generic pieces


On 04/20/2012 01:54 PM, Maciej W. Rozycki wrote:

> Hi,
> 
>  Would anyone please have a look at the infrun.c changes made as a part of 
> this submission:
> 
> http://sourceware.org/ml/gdb-patches/2012-04/msg00197.html
> 
> and tell me if they are all right or not?  Here's the relevant excerpt 
> from the full patch description:
> 
> "4. A handler is now installed to skip over return thunks while
>    single-stepping at the source level, reusing the shared library return
>    trampoline hook.  As per the comment included, there is no overlap here
>    as no MIPS ABI uses shared library return trampolines.
> 
>    This modification, however, requires a change to generic code -- in
>    handle_inferior_event (infrun.c).  This is because a return thunk is
>    called like an ordinary function and therefore once reached, things
>    looks as if a new frame has been created.  As a result code that checks
>    for subroutine calls triggers, at which point there is no way to back
>    out -- while the trampoline handler may still be used there (like for
>    call thunks) to skip over the return thunk, the subroutine call handler
>    insists on skipping over code further, to the next source line.
>    Which, given that we're about to return from a function, means the
>    point after the return instruction.  Now placing the single-stepping
>    breakpoint there -- doesn't quite work as expected.
> 
>    Therefore my proposal is to reverse the order of the checks made in
>    handle_inferior_event -- it looks to me there have been no particular
>    reason for why they have been put in the current order, except that one
>    must have been chosen.  Currently there are two users of the shared
>    library return trampoline hook: hppa-hpux-tdep.c and rs6000-tdep.c.
>    The latter is rather trivial and makes me almost sure that the order of
>    the checks does not matter.  The former is less obvious to me, but I
>    think it does not care either.  Input from people knowledgeable on
>    these platforms will be appreciated."


I'm not a knowledgeable person on those platforms, but it also looks to
me that changing the order would be okay.

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]