mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-19 10:14:23 +08:00
440e6ca79a
Use the generic ptrace_resume code for PTRACE_SYSCALL, PTRACE_CONT, PTRACE_KILL and PTRACE_SINGLESTEP. This implies defining arch_has_single_step in <asm/ptrace.h> and implementing the user_enable_single_step and user_disable_single_step functions, which also causes the breakpoint information to be cleared on fork, which could be considered a bug fix. Also the TIF_SYSCALL_TRACE thread flag is now cleared on PTRACE_KILL which it previously wasn't and the single stepping disable only happens if the tracee process isn't a zombie yet, which is consistent with all architectures using the modern ptrace code. Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Roland McGrath <roland@redhat.com> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
38 lines
939 B
C
38 lines
939 B
C
/*
|
|
* linux/arch/arm/kernel/ptrace.h
|
|
*
|
|
* Copyright (C) 2000-2003 Russell King
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
#include <linux/ptrace.h>
|
|
|
|
extern void ptrace_cancel_bpt(struct task_struct *);
|
|
extern void ptrace_set_bpt(struct task_struct *);
|
|
extern void ptrace_break(struct task_struct *, struct pt_regs *);
|
|
|
|
/*
|
|
* Send SIGTRAP if we're single-stepping
|
|
*/
|
|
static inline void single_step_trap(struct task_struct *task)
|
|
{
|
|
if (task->ptrace & PT_SINGLESTEP) {
|
|
ptrace_cancel_bpt(task);
|
|
send_sig(SIGTRAP, task, 1);
|
|
}
|
|
}
|
|
|
|
static inline void single_step_clear(struct task_struct *task)
|
|
{
|
|
if (task->ptrace & PT_SINGLESTEP)
|
|
ptrace_cancel_bpt(task);
|
|
}
|
|
|
|
static inline void single_step_set(struct task_struct *task)
|
|
{
|
|
if (task->ptrace & PT_SINGLESTEP)
|
|
ptrace_set_bpt(task);
|
|
}
|