Commit c91d2220 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

[PATCH] uml: generic singlestepping

From: Bodo Stroesser - Make singlestepping() generic.
Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent fc476464
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "linux/vmalloc.h" #include "linux/vmalloc.h"
#include "linux/spinlock.h" #include "linux/spinlock.h"
#include "linux/proc_fs.h" #include "linux/proc_fs.h"
#include "linux/ptrace.h"
#include "asm/unistd.h" #include "asm/unistd.h"
#include "asm/mman.h" #include "asm/mman.h"
#include "asm/segment.h" #include "asm/segment.h"
...@@ -454,6 +455,15 @@ int __init make_proc_sysemu(void) ...@@ -454,6 +455,15 @@ int __init make_proc_sysemu(void)
late_initcall(make_proc_sysemu); late_initcall(make_proc_sysemu);
int singlestepping(void * t)
{
struct task_struct *task = t ? t : current;
if (task->thread.singlestep_syscall)
return(0);
return(task->ptrace & PT_DTRACE);
}
/* /*
* Overrides for Emacs so that we follow Linus's tabbing style. * Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically * Emacs will notice this stuff at the end of the file and automatically
......
...@@ -28,7 +28,6 @@ extern int unmap(int fd, void *addr, int len); ...@@ -28,7 +28,6 @@ extern int unmap(int fd, void *addr, int len);
extern int protect(int fd, unsigned long addr, unsigned long len, extern int protect(int fd, unsigned long addr, unsigned long len,
int r, int w, int x, int must_succeed); int r, int w, int x, int must_succeed);
extern void user_signal(int sig, union uml_pt_regs *regs); extern void user_signal(int sig, union uml_pt_regs *regs);
extern int singlestepping_skas(void);
extern int new_mm(int from); extern int new_mm(int from);
extern void save_registers(union uml_pt_regs *regs); extern void save_registers(union uml_pt_regs *regs);
extern void restore_registers(union uml_pt_regs *regs); extern void restore_registers(union uml_pt_regs *regs);
......
...@@ -190,7 +190,7 @@ void userspace(union uml_pt_regs *regs) ...@@ -190,7 +190,7 @@ void userspace(union uml_pt_regs *regs)
local_using_sysemu = get_using_sysemu(); local_using_sysemu = get_using_sysemu();
pt_syscall_parm = local_using_sysemu ? PTRACE_SYSEMU : PTRACE_SYSCALL; pt_syscall_parm = local_using_sysemu ? PTRACE_SYSEMU : PTRACE_SYSCALL;
op = singlestepping_skas() ? PTRACE_SINGLESTEP : op = singlestepping(NULL) ? PTRACE_SINGLESTEP :
pt_syscall_parm; pt_syscall_parm;
err = ptrace(op, pid, 0, 0); err = ptrace(op, pid, 0, 0);
......
...@@ -24,14 +24,6 @@ ...@@ -24,14 +24,6 @@
#include "mode.h" #include "mode.h"
#include "proc_mm.h" #include "proc_mm.h"
int singlestepping_skas(void)
{
int ret = current->ptrace & PT_DTRACE;
current->ptrace &= ~PT_DTRACE;
return(ret);
}
void *switch_to_skas(void *prev, void *next) void *switch_to_skas(void *prev, void *next)
{ {
struct task_struct *from, *to; struct task_struct *from, *to;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
*/ */
#include "linux/sys.h" #include "linux/sys.h"
#include "linux/ptrace.h"
#include "asm/errno.h" #include "asm/errno.h"
#include "asm/unistd.h" #include "asm/unistd.h"
#include "asm/ptrace.h" #include "asm/ptrace.h"
...@@ -27,6 +28,12 @@ long execute_syscall_skas(void *r) ...@@ -27,6 +28,12 @@ long execute_syscall_skas(void *r)
res = -ENOSYS; res = -ENOSYS;
else res = EXECUTE_SYSCALL(syscall, regs); else res = EXECUTE_SYSCALL(syscall, regs);
if(current->thread.singlestep_syscall){
current->thread.singlestep_syscall = 0;
current->ptrace &= ~PT_DTRACE;
force_sig(SIGTRAP, current);
}
return(res); return(res);
} }
......
...@@ -24,7 +24,6 @@ extern void set_init_pid(int pid); ...@@ -24,7 +24,6 @@ extern void set_init_pid(int pid);
extern int set_user_mode(void *task); extern int set_user_mode(void *task);
extern void set_tracing(void *t, int tracing); extern void set_tracing(void *t, int tracing);
extern int is_tracing(void *task); extern int is_tracing(void *task);
extern int singlestepping_tt(void *t);
extern void clear_singlestep(void *t); extern void clear_singlestep(void *t);
extern void syscall_handler(int sig, union uml_pt_regs *regs); extern void syscall_handler(int sig, union uml_pt_regs *regs);
extern void exit_kernel(int pid, void *task); extern void exit_kernel(int pid, void *task);
......
...@@ -523,15 +523,6 @@ void set_init_pid(int pid) ...@@ -523,15 +523,6 @@ void set_init_pid(int pid)
-err); -err);
} }
int singlestepping_tt(void *t)
{
struct task_struct *task = t;
if(task->thread.singlestep_syscall)
return(0);
return(task->ptrace & PT_DTRACE);
}
void clear_singlestep(void *t) void clear_singlestep(void *t)
{ {
struct task_struct *task = t; struct task_struct *task = t;
......
...@@ -373,7 +373,7 @@ int tracer(int (*init_proc)(void *), void *sp) ...@@ -373,7 +373,7 @@ int tracer(int (*init_proc)(void *), void *sp)
} }
if(tracing){ if(tracing){
if(singlestepping_tt(task)) if(singlestepping(task))
cont_type = PTRACE_SINGLESTEP; cont_type = PTRACE_SINGLESTEP;
else cont_type = pt_syscall_parm; else cont_type = pt_syscall_parm;
} }
......
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