Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 187246
b: refs/heads/master
c: 6d75ca1
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig authored and Linus Torvalds committed Mar 12, 2010
1 parent 0284caa commit eab63d8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 46 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: 1bd095083558928cc3b36b826422d69bcd743dca
refs/heads/master: 6d75ca10225be4c7509026f9b61c740b22e734e4
1 change: 1 addition & 0 deletions trunk/arch/xtensa/include/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ struct pt_regs {

#include <variant/core.h>

# define arch_has_single_step() (1)
# define task_pt_regs(tsk) ((struct pt_regs*) \
(task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1)
# define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
Expand Down
56 changes: 11 additions & 45 deletions trunk/arch/xtensa/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@
#include <asm/elf.h>
#include <asm/coprocessor.h>


void user_enable_single_step(struct task_struct *child)
{
child->ptrace |= PT_SINGLESTEP;
}

void user_disable_single_step(struct task_struct *child)
{
child->ptrace &= ~PT_SINGLESTEP;
}

/*
* Called by kernel/ptrace.c when detaching to disable single stepping.
*/
Expand Down Expand Up @@ -268,51 +279,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
ret = ptrace_pokeusr(child, addr, data);
break;

/* continue and stop at next (return from) syscall */

case PTRACE_SYSCALL:
case PTRACE_CONT: /* restart after signal. */
{
ret = -EIO;
if (!valid_signal(data))
break;
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;
/* Make sure the single step bit is not set. */
child->ptrace &= ~PT_SINGLESTEP;
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;
child->exit_code = SIGKILL;
child->ptrace &= ~PT_SINGLESTEP;
wake_up_process(child);
break;

case PTRACE_SINGLESTEP:
ret = -EIO;
if (!valid_signal(data))
break;
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
child->ptrace |= PT_SINGLESTEP;
child->exit_code = data;
wake_up_process(child);
ret = 0;
break;

case PTRACE_GETREGS:
ret = ptrace_getregs(child, (void __user *) data);
break;
Expand Down

0 comments on commit eab63d8

Please sign in to comment.