small strace fix
Hi Don,
Attached below is a small fix for strace. It makes strace work across inlined system calls. Actually, you also need a one-line fix to the kernel for this to really work:
ia64/kernel/ivt.S renamed from ia64/kernel/ivt.S~ +1 -1
@@ -702,7 +702,7 @@ st8 [r16]=r18 // store new value for cr.isr (p8) br.call.sptk.many b6¶ // ignore this return addr - br.call.sptk.many rp=ia64_trace_syscall // rp will be overwritten (ignored) + br.cond.sptk.many ia64_trace_syscall // NOT REACHED END(break_fault)
--david
ChangeLog
2001-04-11 David Mosberger <[email protected]>
* syscall.c (syscall_enter): Use PT_RBS_END instead of deprecated PT_AR_BSP. Pick up arguments starting with out0, which is not always the same as r32 (e.g., consider inlined syscalls).
Index: syscall.c
=================================RCS file: /cvsroot/strace/strace/syscall.c,v retrieving revision 1.25.2.3
syscall.c +10 -5
@@ -1190,21 +1190,26 @@ }#elif defined (IA64 ) { -unsigned long *bsp, cfm, i; +unsigned long *out0, *rbs_end, cfm, sof, sol, i; +#ifndef PT_RBS_END +# define PT_RBS_END PT_AR_BSP/* be backwards compatible with kernels before 2.4.4... */ +#endif -if (upeek (pid,PT_AR_BSP , (long *) &bsp) <0 ) +if (upeek (pid,PT_RBS_END , (long *) &rbs_end) <0 )return -1 ;if (upeek (pid,PT_CFM , (long *) &cfm) <0 )return -1 ; - bsp =ia64_rse_skip_regs (bsp, -(cfm &0x7f )); + sof = (cfm >>0 ) &0x7f ; + sol = (cfm >>7 ) &0x7f ; + out0 =ia64_rse_skip_regs (rbs_end, -sof + sol);if (tcp->scno >=0 && tcp->scno < nsyscalls && sysent[tcp->scno].nargs !=-1 ) tcp->u_nargs = sysent[tcp->scno].nargs; -else +else tcp->u_nargs =MAX_ARGS ;for (i =0 ; i < tcp->u_nargs; ++i) { -if (umoven (tcp, (unsigned long )ia64_rse_skip_regs (bsp, i),sizeof (long ), +if (umoven (tcp, (unsigned long )ia64_rse_skip_regs (out0, i),sizeof (long ), (char *) &tcp->u_arg[i]) <0 )return -1 ;