forked from luck/tmp_suning_uos_patched
s390/ptrace: add support for PTRACE_SINGLEBLOCK
The PTRACE_SINGLEBLOCK option is used to get control whenever the inferior has executed a successful branch. The PER option to implement block stepping is successful-branching event, bit 32 in the PER-event mask. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
443fc8a3e0
commit
818a330c4e
@ -83,6 +83,7 @@ struct per_struct_kernel {
|
|||||||
* These are defined as per linux/ptrace.h, which see.
|
* These are defined as per linux/ptrace.h, which see.
|
||||||
*/
|
*/
|
||||||
#define arch_has_single_step() (1)
|
#define arch_has_single_step() (1)
|
||||||
|
#define arch_has_block_step() (1)
|
||||||
|
|
||||||
#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0)
|
#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0)
|
||||||
#define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN)
|
#define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN)
|
||||||
|
@ -92,6 +92,7 @@ static inline struct thread_info *current_thread_info(void)
|
|||||||
#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
|
#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
|
||||||
#define TIF_RESTORE_SIGMASK 19 /* restore signal mask in do_signal() */
|
#define TIF_RESTORE_SIGMASK 19 /* restore signal mask in do_signal() */
|
||||||
#define TIF_SINGLE_STEP 20 /* This task is single stepped */
|
#define TIF_SINGLE_STEP 20 /* This task is single stepped */
|
||||||
|
#define TIF_BLOCK_STEP 21 /* This task is block stepped */
|
||||||
|
|
||||||
#define _TIF_SYSCALL (1<<TIF_SYSCALL)
|
#define _TIF_SYSCALL (1<<TIF_SYSCALL)
|
||||||
#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
|
#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
|
||||||
|
@ -402,6 +402,12 @@ typedef struct
|
|||||||
#define PTRACE_DISABLE_TE 0x5010
|
#define PTRACE_DISABLE_TE 0x5010
|
||||||
#define PTRACE_TE_ABORT_RAND 0x5011
|
#define PTRACE_TE_ABORT_RAND 0x5011
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The numbers chosen here are somewhat arbitrary but absolutely MUST
|
||||||
|
* not overlap with any of the number assigned in <linux/ptrace.h>.
|
||||||
|
*/
|
||||||
|
#define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PT_PROT definition is loosely based on hppa bsd definition in
|
* PT_PROT definition is loosely based on hppa bsd definition in
|
||||||
* gdb/hppab-nat.c
|
* gdb/hppab-nat.c
|
||||||
|
@ -85,7 +85,10 @@ void update_cr_regs(struct task_struct *task)
|
|||||||
|
|
||||||
/* merge TIF_SINGLE_STEP into user specified PER registers. */
|
/* merge TIF_SINGLE_STEP into user specified PER registers. */
|
||||||
if (test_tsk_thread_flag(task, TIF_SINGLE_STEP)) {
|
if (test_tsk_thread_flag(task, TIF_SINGLE_STEP)) {
|
||||||
new.control |= PER_EVENT_IFETCH;
|
if (test_tsk_thread_flag(task, TIF_BLOCK_STEP))
|
||||||
|
new.control |= PER_EVENT_BRANCH;
|
||||||
|
else
|
||||||
|
new.control |= PER_EVENT_IFETCH;
|
||||||
#ifdef CONFIG_64BIT
|
#ifdef CONFIG_64BIT
|
||||||
new.control |= PER_CONTROL_SUSPENSION;
|
new.control |= PER_CONTROL_SUSPENSION;
|
||||||
new.control |= PER_EVENT_TRANSACTION_END;
|
new.control |= PER_EVENT_TRANSACTION_END;
|
||||||
@ -107,14 +110,22 @@ void update_cr_regs(struct task_struct *task)
|
|||||||
|
|
||||||
void user_enable_single_step(struct task_struct *task)
|
void user_enable_single_step(struct task_struct *task)
|
||||||
{
|
{
|
||||||
|
clear_tsk_thread_flag(task, TIF_BLOCK_STEP);
|
||||||
set_tsk_thread_flag(task, TIF_SINGLE_STEP);
|
set_tsk_thread_flag(task, TIF_SINGLE_STEP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void user_disable_single_step(struct task_struct *task)
|
void user_disable_single_step(struct task_struct *task)
|
||||||
{
|
{
|
||||||
|
clear_tsk_thread_flag(task, TIF_BLOCK_STEP);
|
||||||
clear_tsk_thread_flag(task, TIF_SINGLE_STEP);
|
clear_tsk_thread_flag(task, TIF_SINGLE_STEP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void user_enable_block_step(struct task_struct *task)
|
||||||
|
{
|
||||||
|
set_tsk_thread_flag(task, TIF_SINGLE_STEP);
|
||||||
|
set_tsk_thread_flag(task, TIF_BLOCK_STEP);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called by kernel/ptrace.c when detaching..
|
* Called by kernel/ptrace.c when detaching..
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user