diff options
author | Roland McGrath <roland@redhat.com> | 2008-01-30 07:30:53 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:30:53 -0500 |
commit | 5b88abbf770a0e1975c668743100f42934f385e8 (patch) | |
tree | ae6af4df76e71682efb4d90620182bfaf541e9c8 | |
parent | dc802c2d2e66e2d1544e023bfd4be6cdee48d57b (diff) |
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: Roland McGrath <roland@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | include/linux/ptrace.h | 2 | ||||
-rw-r--r-- | kernel/ptrace.c | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index 1febc541dda5..515bff053de8 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
@@ -187,7 +187,7 @@ static inline void user_disable_single_step(struct task_struct *task) | |||
187 | * supports step-until-branch for user mode. It can be a constant or it | 187 | * supports step-until-branch for user mode. It can be a constant or it |
188 | * can test a CPU feature bit. | 188 | * can test a CPU feature bit. |
189 | */ | 189 | */ |
190 | #define arch_has_single_step() (0) | 190 | #define arch_has_block_step() (0) |
191 | 191 | ||
192 | /** | 192 | /** |
193 | * user_enable_block_step - step until branch in user-mode task | 193 | * user_enable_block_step - step until branch in user-mode task |
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index fad5f1e8511f..973d727f5e84 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -373,6 +373,12 @@ static int ptrace_setsiginfo(struct task_struct *child, siginfo_t __user * data) | |||
373 | #define is_singlestep(request) 0 | 373 | #define is_singlestep(request) 0 |
374 | #endif | 374 | #endif |
375 | 375 | ||
376 | #ifdef PTRACE_SINGLEBLOCK | ||
377 | #define is_singleblock(request) ((request) == PTRACE_SINGLEBLOCK) | ||
378 | #else | ||
379 | #define is_singleblock(request) 0 | ||
380 | #endif | ||
381 | |||
376 | #ifdef PTRACE_SYSEMU | 382 | #ifdef PTRACE_SYSEMU |
377 | #define is_sysemu_singlestep(request) ((request) == PTRACE_SYSEMU_SINGLESTEP) | 383 | #define is_sysemu_singlestep(request) ((request) == PTRACE_SYSEMU_SINGLESTEP) |
378 | #else | 384 | #else |
@@ -396,7 +402,11 @@ static int ptrace_resume(struct task_struct *child, long request, long data) | |||
396 | clear_tsk_thread_flag(child, TIF_SYSCALL_EMU); | 402 | clear_tsk_thread_flag(child, TIF_SYSCALL_EMU); |
397 | #endif | 403 | #endif |
398 | 404 | ||
399 | if (is_singlestep(request) || is_sysemu_singlestep(request)) { | 405 | if (is_singleblock(request)) { |
406 | if (unlikely(!arch_has_block_step())) | ||
407 | return -EIO; | ||
408 | user_enable_block_step(child); | ||
409 | } else if (is_singlestep(request) || is_sysemu_singlestep(request)) { | ||
400 | if (unlikely(!arch_has_single_step())) | 410 | if (unlikely(!arch_has_single_step())) |
401 | return -EIO; | 411 | return -EIO; |
402 | user_enable_single_step(child); | 412 | user_enable_single_step(child); |
@@ -438,6 +448,9 @@ int ptrace_request(struct task_struct *child, long request, | |||
438 | #ifdef PTRACE_SINGLESTEP | 448 | #ifdef PTRACE_SINGLESTEP |
439 | case PTRACE_SINGLESTEP: | 449 | case PTRACE_SINGLESTEP: |
440 | #endif | 450 | #endif |
451 | #ifdef PTRACE_SINGLEBLOCK | ||
452 | case PTRACE_SINGLEBLOCK: | ||
453 | #endif | ||
441 | #ifdef PTRACE_SYSEMU | 454 | #ifdef PTRACE_SYSEMU |
442 | case PTRACE_SYSEMU: | 455 | case PTRACE_SYSEMU: |
443 | case PTRACE_SYSEMU_SINGLESTEP: | 456 | case PTRACE_SYSEMU_SINGLESTEP: |