Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86f2552b authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Martin Schwidefsky
Browse files

[S390] add breaking event address for user space



Copy the last breaking event address from the lowcore to a new
field in the thread_struct on each system entry. Add a new
ptrace request PTRACE_GET_LAST_BREAK and a new utrace regset
REGSET_LAST_BREAK to query the last breaking event.

This is useful for debugging wild branches in user space code.

Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent cd3b70f5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -328,8 +328,8 @@ struct pt_regs
	psw_t psw;
	unsigned long gprs[NUM_GPRS];
	unsigned long orig_gpr2;
	unsigned short svcnr;
	unsigned short ilc;
	unsigned short svcnr;
};
#endif

@@ -436,6 +436,7 @@ typedef struct
#define PTRACE_PEEKDATA_AREA	      0x5003
#define PTRACE_POKETEXT_AREA	      0x5004
#define PTRACE_POKEDATA_AREA 	      0x5005
#define PTRACE_GET_LAST_BREAK	      0x5006

/*
 * PT_PROT definition is loosely based on hppa bsd definition in
+1 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ struct thread_info {
	struct restart_block	restart_block;
	__u64			user_timer;
	__u64			system_timer;
	unsigned long		last_break;	/* last breaking-event-address. */
};

/*
+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ int main(void)
	DEFINE(__TI_precount, offsetof(struct thread_info, preempt_count));
	DEFINE(__TI_user_timer, offsetof(struct thread_info, user_timer));
	DEFINE(__TI_system_timer, offsetof(struct thread_info, system_timer));
	DEFINE(__TI_last_break, offsetof(struct thread_info, last_break));
	BLANK();
	DEFINE(__PT_ARGS, offsetof(struct pt_regs, args));
	DEFINE(__PT_PSW, offsetof(struct pt_regs, psw));
+2 −2
Original line number Diff line number Diff line
@@ -180,9 +180,9 @@ STACK_SIZE = 1 << STACK_SHIFT
	s	%r15,BASED(.Lc_spsize)	# make room for registers & psw
	mvc	SP_PSW(8,%r15),0(%r12)	# move user PSW to stack
	st	%r2,SP_ORIG_R2(%r15)	# store original content of gpr 2
	icm	%r12,3,__LC_SVC_ILC
	icm	%r12,12,__LC_SVC_ILC
	stm	%r0,%r11,SP_R0(%r15)	# store gprs %r0-%r11 to kernel stack
	st	%r12,SP_SVCNR(%r15)
	st	%r12,SP_ILC(%r15)
	mvc	SP_R12(16,%r15),\savearea # move %r12-%r15 to stack
	la	%r12,0
	st	%r12,__SF_BACKCHAIN(%r15)	# clear back chain
+146 −124

File changed.

Preview size limit exceeded, changes collapsed.

Loading