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: [rfc/rfa] Use ARM exception tables as GDB unwinder


On Wed, Dec 01, 2010 at 05:45:31PM +0100, Ulrich Weigand wrote:
> Hmm, looking at DO_CALL a bit more I think this can actually be handled
> inline just fine:
> 
> #define DO_CALL(syscall_name, args)             \
>     DOARGS_##args;                              \
>     mov ip, r7;                                 \
>     cfi_register (r7, ip);                      \
>     ldr r7, =SYS_ify (syscall_name);            \
>     swi 0x0;                                    \
>     mov r7, ip;                                 \
>     cfi_restore (r7);                           \
>     UNDOARGS_##args
> 
> Note the calls to DOARGS_... / UNDOARGS_..., which actually save and
> restore registers on the stack anyway (just not r7).  Why not simply
> have (a variant) of [UN]DOARGS_... save r7 to the stack, and then
> provide both correct CFI and ARM unwind records for it?  [ Saving
> to IP would then be no longer necessary. ]
> 
> Am I missing something here?

I don't think you are missing anything, except a couple of cycles.

We save r7 in ip because it ought to be faster loading and storing it
on the stack.  But we already take the position that the system call
overhead is substantial compared to DO_CALL... so the extra two memory
ops do not seem like a huge loss to me, especially if we can save on
code size.

I haven't looked at this code in a while, but isn't
nptl/sysdep-cancel.h:PSEUDO broken for non-cancellable syscalls with
many arguments?  It calls DOARGS and then DO_CALL, but DO_CALL does
DOARGS again.  For 0-4 arguments it doesn't matter; I don't know if
any of the 5/6/7 argument calls have a used nocancel variant.

-- 
Daniel Jacobowitz
CodeSourcery


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