Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 187245
b: refs/heads/master
c: 1bd0950
h: refs/heads/master
i:
  187243: 3968c3b
v: v3
  • Loading branch information
Christoph Hellwig authored and Linus Torvalds committed Mar 12, 2010
1 parent e0a8d00 commit 0284caa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 55 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 55436c91652b45be576b91ec96a8d65f6b7447fa
refs/heads/master: 1bd095083558928cc3b36b826422d69bcd743dca
2 changes: 2 additions & 0 deletions trunk/arch/um/include/asm/ptrace-generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ struct pt_regs {
struct uml_pt_regs regs;
};

#define arch_has_single_step() (1)

#define EMPTY_REGS { .regs = EMPTY_UML_PT_REGS }

#define PT_REGS_IP(r) UPT_IP(&(r)->regs)
Expand Down
70 changes: 16 additions & 54 deletions trunk/arch/um/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,25 @@
#endif
#include "skas_ptrace.h"

static inline void set_singlestepping(struct task_struct *child, int on)


void user_enable_single_step(struct task_struct *child)
{
if (on)
child->ptrace |= PT_DTRACE;
else
child->ptrace &= ~PT_DTRACE;
child->ptrace |= PT_DTRACE;
child->thread.singlestep_syscall = 0;

#ifdef SUBARCH_SET_SINGLESTEPPING
SUBARCH_SET_SINGLESTEPPING(child, on);
SUBARCH_SET_SINGLESTEPPING(child, 1);
#endif
}

void user_disable_single_step(struct task_struct *child)
{
child->ptrace &= ~PT_DTRACE;
child->thread.singlestep_syscall = 0;

#ifdef SUBARCH_SET_SINGLESTEPPING
SUBARCH_SET_SINGLESTEPPING(child, 0);
#endif
}

Expand All @@ -30,7 +39,7 @@ static inline void set_singlestepping(struct task_struct *child, int on)
*/
void ptrace_disable(struct task_struct *child)
{
set_singlestepping(child,0);
user_disable_single_step(child);
}

extern int peek_user(struct task_struct * child, long addr, long data);
Expand Down Expand Up @@ -69,53 +78,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
ret = -EIO;
break;

/* continue and stop at next (return from) syscall */
case PTRACE_SYSCALL:
/* restart after signal. */
case PTRACE_CONT: {
ret = -EIO;
if (!valid_signal(data))
break;

set_singlestepping(child, 0);
if (request == PTRACE_SYSCALL)
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
else clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
child->exit_code = data;
wake_up_process(child);
ret = 0;
break;
}

/*
* make the child exit. Best I can do is send it a sigkill.
* perhaps it should be put in the status that it wants to
* exit.
*/
case PTRACE_KILL: {
ret = 0;
if (child->exit_state == EXIT_ZOMBIE) /* already dead */
break;

set_singlestepping(child, 0);
child->exit_code = SIGKILL;
wake_up_process(child);
break;
}

case PTRACE_SINGLESTEP: { /* set the trap flag. */
ret = -EIO;
if (!valid_signal(data))
break;
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
set_singlestepping(child, 1);
child->exit_code = data;
/* give it a chance to run. */
wake_up_process(child);
ret = 0;
break;
}

#ifdef PTRACE_GETREGS
case PTRACE_GETREGS: { /* Get all gp regs from the child. */
if (!access_ok(VERIFY_WRITE, p, MAX_REG_OFFSET)) {
Expand Down

0 comments on commit 0284caa

Please sign in to comment.