Commit 5b88abbf authored by Roland McGrath's avatar Roland McGrath Committed by Ingo Molnar

ptrace: generic PTRACE_SINGLEBLOCK

This makes ptrace_request handle PTRACE_SINGLEBLOCK along with
PTRACE_CONT et al.  The new generic code makes use of the
arch_has_block_step macro and generic entry points on machines
that define them.

[ mingo@elte.hu: bugfix ]
Signed-off-by: default avatarRoland McGrath <roland@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent dc802c2d
...@@ -187,7 +187,7 @@ static inline void user_disable_single_step(struct task_struct *task) ...@@ -187,7 +187,7 @@ static inline void user_disable_single_step(struct task_struct *task)
* supports step-until-branch for user mode. It can be a constant or it * supports step-until-branch for user mode. It can be a constant or it
* can test a CPU feature bit. * can test a CPU feature bit.
*/ */
#define arch_has_single_step() (0) #define arch_has_block_step() (0)
/** /**
* user_enable_block_step - step until branch in user-mode task * user_enable_block_step - step until branch in user-mode task
......
...@@ -373,6 +373,12 @@ static int ptrace_setsiginfo(struct task_struct *child, siginfo_t __user * data) ...@@ -373,6 +373,12 @@ static int ptrace_setsiginfo(struct task_struct *child, siginfo_t __user * data)
#define is_singlestep(request) 0 #define is_singlestep(request) 0
#endif #endif
#ifdef PTRACE_SINGLEBLOCK
#define is_singleblock(request) ((request) == PTRACE_SINGLEBLOCK)
#else
#define is_singleblock(request) 0
#endif
#ifdef PTRACE_SYSEMU #ifdef PTRACE_SYSEMU
#define is_sysemu_singlestep(request) ((request) == PTRACE_SYSEMU_SINGLESTEP) #define is_sysemu_singlestep(request) ((request) == PTRACE_SYSEMU_SINGLESTEP)
#else #else
...@@ -396,7 +402,11 @@ static int ptrace_resume(struct task_struct *child, long request, long data) ...@@ -396,7 +402,11 @@ static int ptrace_resume(struct task_struct *child, long request, long data)
clear_tsk_thread_flag(child, TIF_SYSCALL_EMU); clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
#endif #endif
if (is_singlestep(request) || is_sysemu_singlestep(request)) { if (is_singleblock(request)) {
if (unlikely(!arch_has_block_step()))
return -EIO;
user_enable_block_step(child);
} else if (is_singlestep(request) || is_sysemu_singlestep(request)) {
if (unlikely(!arch_has_single_step())) if (unlikely(!arch_has_single_step()))
return -EIO; return -EIO;
user_enable_single_step(child); user_enable_single_step(child);
...@@ -438,6 +448,9 @@ int ptrace_request(struct task_struct *child, long request, ...@@ -438,6 +448,9 @@ int ptrace_request(struct task_struct *child, long request,
#ifdef PTRACE_SINGLESTEP #ifdef PTRACE_SINGLESTEP
case PTRACE_SINGLESTEP: case PTRACE_SINGLESTEP:
#endif #endif
#ifdef PTRACE_SINGLEBLOCK
case PTRACE_SINGLEBLOCK:
#endif
#ifdef PTRACE_SYSEMU #ifdef PTRACE_SYSEMU
case PTRACE_SYSEMU: case PTRACE_SYSEMU:
case PTRACE_SYSEMU_SINGLESTEP: case PTRACE_SYSEMU_SINGLESTEP:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment