]> granicus.if.org Git - strace/commitdiff
Remove HAVE_STRUCT_TCB_EXT_ARG, ext_arg, and u_lrval
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 26 Dec 2016 02:59:36 +0000 (02:59 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 26 Dec 2016 10:43:35 +0000 (10:43 +0000)
After transition from long to kernel_ulong_t these fields
are no longer needed.

* defs.h (HAVE_STRUCT_TCB_EXT_ARG): Remove.
(struct tcb) [HAVE_STRUCT_TCB_EXT_ARG]: Remove.
[HAVE_STRUCT_TCB_EXT_ARG]: Remove.
(RVAL_MASK): Update.
* io.c (print_lld_from_low_high_val): Check
[SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
instead of [HAVE_STRUCT_TCB_EXT_ARG].
Use u_arg instead of ext_arg.
* linux/mips/get_error.c (get_error) [LINUX_MIPSN32]: Remove.
* linux/mips/get_syscall_args.c (get_syscall_args) [LINUX_MIPSN32]:
Remove.
[LINUX_MIPSN64]: Extend to [LINUX_MIPSN32].
* linux/x86_64/get_error.c (get_error) [X32]: Remove.
* linux/x86_64/get_syscall_args.c (get_syscall_args) [X32]: Remove.
* lseek.c: Check [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
instead of [HAVE_STRUCT_TCB_EXT_ARG].
[SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] (SYS_FUNC(lseek)): Use u_arg
instead of ext_arg.  Use RVAL_UDECIMAL instead of RVAL_LUDECIMAL.
* mem.c (SYS_FUNC(mmap)): Pass offset syscall argument directly
to print_mmap.
* syscall.c (trace_syscall_exiting) [HAVE_STRUCT_TCB_EXT_ARG]: Remove.
* times.c (SYS_FUNC(times)): Use RVAL_UDECIMAL instead
of RVAL_LUDECIMAL.
* util.c (getllval): Check [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
instead of [HAVE_STRUCT_TCB_EXT_ARG].  Use u_arg instead of ext_arg.

defs.h
io.c
linux/mips/get_error.c
linux/mips/get_syscall_args.c
linux/x86_64/get_error.c
linux/x86_64/get_syscall_args.c
lseek.c
mem.c
syscall.c
times.c
util.c

diff --git a/defs.h b/defs.h
index 71c1d7a10e0252807a9939580804b8ddb8637508..61a5e1200232c676cd4aab78c5f48ed6a6f8881c 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -220,12 +220,6 @@ struct fault_opts {
        uint16_t err;
 };
 
-#if defined LINUX_MIPSN32 || defined X32
-# define HAVE_STRUCT_TCB_EXT_ARG 1
-#else
-# define HAVE_STRUCT_TCB_EXT_ARG 0
-#endif
-
 /* Trace Control Block */
 struct tcb {
        int flags;              /* See below for TCB_ values */
@@ -234,10 +228,6 @@ struct tcb {
        unsigned long u_error;  /* Error code */
        kernel_ulong_t scno;    /* System call number */
        kernel_ulong_t u_arg[MAX_ARGS]; /* System call arguments */
-#if HAVE_STRUCT_TCB_EXT_ARG
-       unsigned long long ext_arg[MAX_ARGS];
-       long long u_lrval;      /* long long return value */
-#endif
        kernel_long_t u_rval;   /* Return value */
 #if SUPPORTED_PERSONALITIES > 1
        unsigned int currpers;  /* Personality at the time of scno update */
@@ -329,16 +319,8 @@ extern const struct xlat whence_codes[];
 #define RVAL_HEX       001     /* hex format */
 #define RVAL_OCTAL     002     /* octal format */
 #define RVAL_UDECIMAL  003     /* unsigned decimal format */
-#if HAVE_STRUCT_TCB_EXT_ARG
-# if 0 /* unused so far */
-#  define RVAL_LDECIMAL        004     /* long decimal format */
-#  define RVAL_LHEX    005     /* long hex format */
-#  define RVAL_LOCTAL  006     /* long octal format */
-# endif
-# define RVAL_LUDECIMAL        007     /* long unsigned decimal format */
-#endif /* HAVE_STRUCT_TCB_EXT_ARG */
 #define RVAL_FD                010     /* file descriptor */
-#define RVAL_MASK      017     /* mask for these values */
+#define RVAL_MASK      013     /* mask for these values */
 
 #define RVAL_STR       020     /* Print `auxstr' field after return val */
 #define RVAL_NONE      040     /* Print nothing */
diff --git a/io.c b/io.c
index 7088e856737f6ec13f8451d85f57e3eda152bb62..dbef2e65b83eb2f9bb28ed6d789f032136c92070 100644 (file)
--- a/io.c
+++ b/io.c
@@ -189,7 +189,7 @@ print_lld_from_low_high_val(struct tcb *tcp, int arg)
        }
 #elif SIZEOF_LONG > 4
 # error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
-#elif HAVE_STRUCT_TCB_EXT_ARG
+#elif SIZEOF_KERNEL_LONG_T > SIZEOF_LONG
 # ifndef current_klongsize
        if (current_klongsize < SIZEOF_LONG_LONG) {
                tprintf("%lld",
@@ -198,9 +198,9 @@ print_lld_from_low_high_val(struct tcb *tcp, int arg)
        } else
 # endif /* !current_klongsize */
        {
-               tprintf("%lld", tcp->ext_arg[arg]);
+               tprintf("%" PRI_kld, tcp->u_arg[arg]);
        }
-#else /* SIZEOF_LONG_LONG > SIZEOF_LONG && !HAVE_STRUCT_TCB_EXT_ARG */
+#else /* SIZEOF_LONG_LONG > SIZEOF_LONG && SIZEOF_KERNEL_LONG_T == SIZEOF_LONG */
        tprintf("%lld",
                (zero_extend_signed_to_ull(tcp->u_arg[arg + 1]) << sizeof(long) * 8)
                | zero_extend_signed_to_ull(tcp->u_arg[arg]));
index 42a282b45266176197610bb55eb9a7f218340f88..4096de26ae7dadd143191bf0856892e6125efac4 100644 (file)
@@ -6,9 +6,5 @@ get_error(struct tcb *tcp, const bool check_errno)
                tcp->u_error = mips_REG_V0;
        } else {
                tcp->u_rval = mips_REG_V0;
-#ifdef LINUX_MIPSN32
-               /* tcp->u_rval contains a truncated value */
-               tcp->u_lrval = mips_REG_V0;
-#endif
        }
 }
index a20be8dee1ea89e5eb7c5d736ade06350abf5387..ca2819bf375fe1207308cf85070de6d4988db5be 100644 (file)
@@ -2,20 +2,13 @@
 static int
 get_syscall_args(struct tcb *tcp)
 {
-#if defined LINUX_MIPSN64
+#if defined LINUX_MIPSN64 || defined LINUX_MIPSN32
        tcp->u_arg[0] = mips_REG_A0;
        tcp->u_arg[1] = mips_REG_A1;
        tcp->u_arg[2] = mips_REG_A2;
        tcp->u_arg[3] = mips_REG_A3;
        tcp->u_arg[4] = mips_REG_A4;
        tcp->u_arg[5] = mips_REG_A5;
-#elif defined LINUX_MIPSN32
-       tcp->u_arg[0] = tcp->ext_arg[0] = mips_REG_A0;
-       tcp->u_arg[1] = tcp->ext_arg[1] = mips_REG_A1;
-       tcp->u_arg[2] = tcp->ext_arg[2] = mips_REG_A2;
-       tcp->u_arg[3] = tcp->ext_arg[3] = mips_REG_A3;
-       tcp->u_arg[4] = tcp->ext_arg[4] = mips_REG_A4;
-       tcp->u_arg[5] = tcp->ext_arg[5] = mips_REG_A5;
 #elif defined LINUX_MIPSO32
        tcp->u_arg[0] = mips_REG_A0;
        tcp->u_arg[1] = mips_REG_A1;
index ddf78b7cae509e2c72492373b6d5942f6bd93a4c..9411625b9948220e5be7a0626048eaa44fd14bf1 100644 (file)
@@ -19,9 +19,5 @@ get_error(struct tcb *tcp, const bool check_errno)
                tcp->u_error = -rax;
        } else {
                tcp->u_rval = rax;
-#ifdef X32
-               /* tcp->u_rval contains a truncated value */
-               tcp->u_lrval = rax;
-#endif
        }
 }
index 51d03f5df2f6a6fce30f6efd995a554969330dc4..df3691a66ba70c62aa84dabec9ce62ebce1cca00 100644 (file)
@@ -10,37 +10,19 @@ get_syscall_args(struct tcb *tcp)
                         * Use widen_to_long(tcp->u_arg[N]) in syscall handlers
                         * if you need to use *sign-extended* parameter.
                         */
-#ifdef X32
-                       tcp->u_arg[0] = tcp->ext_arg[0] = (uint32_t) x86_64_regs.rdi;
-                       tcp->u_arg[1] = tcp->ext_arg[1] = (uint32_t) x86_64_regs.rsi;
-                       tcp->u_arg[2] = tcp->ext_arg[2] = (uint32_t) x86_64_regs.rdx;
-                       tcp->u_arg[3] = tcp->ext_arg[3] = (uint32_t) x86_64_regs.r10;
-                       tcp->u_arg[4] = tcp->ext_arg[4] = (uint32_t) x86_64_regs.r8;
-                       tcp->u_arg[5] = tcp->ext_arg[5] = (uint32_t) x86_64_regs.r9;
-#else
                        tcp->u_arg[0] = (uint32_t) x86_64_regs.rdi;
                        tcp->u_arg[1] = (uint32_t) x86_64_regs.rsi;
                        tcp->u_arg[2] = (uint32_t) x86_64_regs.rdx;
                        tcp->u_arg[3] = (uint32_t) x86_64_regs.r10;
                        tcp->u_arg[4] = (uint32_t) x86_64_regs.r8;
                        tcp->u_arg[5] = (uint32_t) x86_64_regs.r9;
-#endif
                } else {
-#ifdef X32
-                       tcp->u_arg[0] = tcp->ext_arg[0] = x86_64_regs.rdi;
-                       tcp->u_arg[1] = tcp->ext_arg[1] = x86_64_regs.rsi;
-                       tcp->u_arg[2] = tcp->ext_arg[2] = x86_64_regs.rdx;
-                       tcp->u_arg[3] = tcp->ext_arg[3] = x86_64_regs.r10;
-                       tcp->u_arg[4] = tcp->ext_arg[4] = x86_64_regs.r8;
-                       tcp->u_arg[5] = tcp->ext_arg[5] = x86_64_regs.r9;
-#else
                        tcp->u_arg[0] = x86_64_regs.rdi;
                        tcp->u_arg[1] = x86_64_regs.rsi;
                        tcp->u_arg[2] = x86_64_regs.rdx;
                        tcp->u_arg[3] = x86_64_regs.r10;
                        tcp->u_arg[4] = x86_64_regs.r8;
                        tcp->u_arg[5] = x86_64_regs.r9;
-#endif
                }
        } else {
                /*
diff --git a/lseek.c b/lseek.c
index f23708e63711f9f6ce169e70a882841d9606a505..cc0b375fd2351b7824f7f470156163d0329565dd 100644 (file)
--- a/lseek.c
+++ b/lseek.c
  * which means that on x32 we need to use tcp->ext_arg[N] to get offset argument.
  * Use test/x32_lseek.c to test lseek decoding.
  */
-#if HAVE_STRUCT_TCB_EXT_ARG
+#if SIZEOF_KERNEL_LONG_T > SIZEOF_LONG
 SYS_FUNC(lseek)
 {
        printfd(tcp, tcp->u_arg[0]);
 
        long long offset;
 # ifndef current_klongsize
-       /* tcp->ext_arg is not initialized for compat personality */
-       if (current_klongsize < sizeof(*tcp->ext_arg)) {
+       if (current_klongsize < sizeof(*tcp->u_arg)) {
                offset = (long) tcp->u_arg[1];
        } else
 # endif /* !current_klongsize */
        {
-               offset = tcp->ext_arg[1];
+               offset = tcp->u_arg[1];
        }
        int whence = tcp->u_arg[2];
 
        tprintf(", %lld, ", offset);
        printxval(whence_codes, whence, "SEEK_???");
 
-       return RVAL_DECODED | RVAL_LUDECIMAL;
+       return RVAL_DECODED | RVAL_UDECIMAL;
 }
 #else
 SYS_FUNC(lseek)
diff --git a/mem.c b/mem.c
index 350475da7ef51f58cdec78373de5e75e767802dc..6a541cfb6b39afc0406c643364c1b784eb023d30 100644 (file)
--- a/mem.c
+++ b/mem.c
@@ -135,18 +135,12 @@ SYS_FUNC(old_mmap_pgoff)
 /* Params are passed directly, offset is in bytes */
 SYS_FUNC(mmap)
 {
-       unsigned long long offset =
-#if HAVE_STRUCT_TCB_EXT_ARG
-               tcp->ext_arg[5];        /* try test/x32_mmap.c */
-#else
-               tcp->u_arg[5];
-#endif
        /* Example of kernel-side handling of this variety of mmap:
         * arch/x86/kernel/sys_x86_64.c::SYSCALL_DEFINE6(mmap, ...) calls
         * sys_mmap_pgoff(..., off >> PAGE_SHIFT); i.e. off is in bytes,
         * since the above code converts off to pages.
         */
-       print_mmap(tcp, tcp->u_arg, offset);
+       print_mmap(tcp, tcp->u_arg, tcp->u_arg[5]);
 
        return RVAL_DECODED | RVAL_HEX;
 }
index bc92e5672fd2cc5c070b38c618437aa004e721f4..6178fdab3958d052795336d94d4b8b524ee241df 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -933,24 +933,6 @@ trace_syscall_exiting(struct tcb *tcp)
                                else
                                        tprintf("= %" PRI_kld, tcp->u_rval);
                                break;
-#if HAVE_STRUCT_TCB_EXT_ARG
-                       /*
-                       case RVAL_LHEX:
-                               tprintf("= %#llx", tcp->u_lrval);
-                               break;
-                       case RVAL_LOCTAL:
-                               tprintf("= %#llo", tcp->u_lrval);
-                               break;
-                       */
-                       case RVAL_LUDECIMAL:
-                               tprintf("= %llu", tcp->u_lrval);
-                               break;
-                       /*
-                       case RVAL_LDECIMAL:
-                               tprintf("= %lld", tcp->u_lrval);
-                               break;
-                       */
-#endif /* HAVE_STRUCT_TCB_EXT_ARG */
                        default:
                                error_msg("invalid rval format");
                                break;
diff --git a/times.c b/times.c
index 6af4f95a06351e63ca21de8224abc40127dd513c..b165a2b0d566903f93413d7f1a9ef515426caf98 100644 (file)
--- a/times.c
+++ b/times.c
@@ -53,10 +53,5 @@ SYS_FUNC(times)
                        zero_extend_signed_to_ull(tbuf.tms_cstime));
        }
 
-       return syserror(tcp) ? RVAL_DECIMAL :
-#if defined(RVAL_LUDECIMAL) && !defined(IN_MPERS)
-                              RVAL_LUDECIMAL;
-#else
-                              RVAL_UDECIMAL;
-#endif
+       return syserror(tcp) ? RVAL_DECIMAL : RVAL_UDECIMAL;
 }
diff --git a/util.c b/util.c
index 49a5c4b7ad3d4d1034fb85d053d4db8a142e931b..73c8fd491aec71f390d99c9d57a872600c8d737f 100644 (file)
--- a/util.c
+++ b/util.c
@@ -313,15 +313,15 @@ getllval(struct tcb *tcp, unsigned long long *val, int arg_no)
        }
 #elif SIZEOF_LONG > 4
 #  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
-#elif HAVE_STRUCT_TCB_EXT_ARG
+#elif SIZEOF_KERNEL_LONG_T > SIZEOF_LONG
 # ifndef current_klongsize
-       if (current_klongsize < SIZEOF_LONG_LONG) {
+       if (current_klongsize < SIZEOF_KERNEL_LONG_T) {
                *val = ULONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]);
                arg_no += 2;
        } else
 # endif /* !current_klongsize */
        {
-               *val = tcp->ext_arg[arg_no];
+               *val = tcp->u_arg[arg_no];
                arg_no++;
        }
 #else