]> granicus.if.org Git - strace/commitdiff
2004-03-01 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@redhat.com>
Mon, 1 Mar 2004 20:57:09 +0000 (20:57 +0000)
committerRoland McGrath <roland@redhat.com>
Mon, 1 Mar 2004 20:57:09 +0000 (20:57 +0000)
* util.c [LINUX] (arg0_index, arg1_index): New macros.
[S390 || S390X]: Define them with inverted values.
(setbpt): Use them for u_arg indices.

util.c

diff --git a/util.c b/util.c
index 4663bc9c8435d3fc6aa7a40a49afc57a9f81fa37..3a3db0a290aed62b00c9cb122703f26aac762db9 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1272,6 +1272,8 @@ typedef struct regs arg_setup_state;
 #  define arg1_offset  PT_ORIGGPR2
 #  define restore_arg0(tcp, state, val) ((void) (state), 0)
 #  define restore_arg1(tcp, state, val) ((void) (state), 0)
+#  define arg0_index   1
+#  define arg1_index   0
 # elif defined (ALPHA) || defined (MIPS)
 #  define arg0_offset  REG_A0
 #  define arg1_offset  (REG_A0+1)
@@ -1301,6 +1303,11 @@ typedef struct regs arg_setup_state;
 #  endif
 # endif
 
+# ifndef arg0_index
+#  define arg0_index 0
+#  define arg1_index 1
+# endif
+
 typedef int arg_setup_state;
 
 # define arg_setup(tcp, state) (0)
@@ -1359,8 +1366,8 @@ struct tcb *tcp;
                    || set_arg1 (tcp, &state, 0) < 0
                    || arg_finish_change (tcp, &state) < 0)
                        return -1;
-               tcp->u_arg[0] = CLONE_PTRACE|SIGCHLD;
-               tcp->u_arg[1] = 0;
+               tcp->u_arg[arg0_index] = CLONE_PTRACE|SIGCHLD;
+               tcp->u_arg[arg1_index] = 0;
                tcp->flags |= TCB_BPTSET;
                return 0;
 #endif
@@ -1371,12 +1378,13 @@ struct tcb *tcp;
 #endif
                if ((tcp->u_arg[0] & CLONE_PTRACE) == 0
                    && (arg_setup (tcp, &state) < 0
-                       || set_arg0 (tcp, &state, tcp->u_arg[0] | CLONE_PTRACE) < 0
+                       || set_arg0 (tcp, &state,
+                                    tcp->u_arg[arg0_index] | CLONE_PTRACE) < 0
                        || arg_finish_change (tcp, &state) < 0))
                        return -1;
                tcp->flags |= TCB_BPTSET;
-               tcp->inst[0] = tcp->u_arg[0];
-               tcp->inst[1] = tcp->u_arg[1];
+               tcp->inst[0] = tcp->u_arg[arg0_index];
+               tcp->inst[1] = tcp->u_arg[arg1_index];
                return 0;
 
        default: