2004-03-01 Roland McGrath <roland@redhat.com>

* util.c [LINUX] (arg0_index, arg1_index): New macros.
	[S390 || S390X]: Define them with inverted values.
	(setbpt): Use them for u_arg indices.
This commit is contained in:
Roland McGrath 2004-03-01 20:57:09 +00:00
parent 24e8d31c21
commit c9dc3c1ea7

18
util.c
View File

@ -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: