This change prevents scattering of ll-related hacks and simplifies pread/pwrite syscalls parsers' logic a bit.
* util.c (getllval): Add fixup for arg_no for SuperH when argument number is equal to 3 (see comment). * io.c (PREAD_OFFSET_ARG): Macro removed. (SYS_FUNC(pread)): Always use argument number 3 for "count" argument printing. (SYS_FUNC(pwrite)): Likewise. --- io.c | 15 ++------------- util.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/io.c b/io.c index 58323a7..ee84973 100644 --- a/io.c +++ b/io.c @@ -150,17 +150,6 @@ SYS_FUNC(writev) return RVAL_DECODED; } -/* The SH4 ABI does allow long longs in odd-numbered registers, but - does not allow them to be split between registers and memory - and - there are only four argument registers for normal functions. As a - result pread takes an extra padding argument before the offset. This - was changed late in the 2.4 series (around 2.4.20). */ -#if defined(SH) -#define PREAD_OFFSET_ARG 4 -#else -#define PREAD_OFFSET_ARG 3 -#endif - SYS_FUNC(pread) { if (entering(tcp)) { @@ -172,7 +161,7 @@ SYS_FUNC(pread) else printstr(tcp, tcp->u_arg[1], tcp->u_rval); tprintf(", %lu, ", tcp->u_arg[2]); - printllval(tcp, "%lld", PREAD_OFFSET_ARG); + printllval(tcp, "%lld", 3); } return 0; } @@ -183,7 +172,7 @@ SYS_FUNC(pwrite) tprints(", "); printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]); tprintf(", %lu, ", tcp->u_arg[2]); - printllval(tcp, "%lld", PREAD_OFFSET_ARG); + printllval(tcp, "%lld", 3); return RVAL_DECODED; } diff --git a/util.c b/util.c index afa3290..ea67606 100644 --- a/util.c +++ b/util.c @@ -275,7 +275,17 @@ getllval(struct tcb *tcp, unsigned long long *val, int arg_no) defined XTENSA /* Align arg_no to the next even number. */ arg_no = (arg_no + 1) & 0xe; -# endif +# elif defined SH + /* The SH4 ABI does allow long longs in odd-numbered registers, but + does not allow them to be split between registers and memory - and + there are only four argument registers for normal functions. As a + result, pread, for example, takes an extra padding argument before + the offset. This was changed late in the 2.4 series (around 2.4.20). + */ + if (arg_no == 3) + arg_no++; +# endif /* defined __ARM_EABI__ || defined LINUX_MIPSO32 || defined POWERPC || + defined XTENSA || defined SH */ *val = LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]); arg_no += 2; #endif -- 1.7.10.4 ------------------------------------------------------------------------------ _______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel