Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 54311
b: refs/heads/master
c: f30c2c9
h: refs/heads/master
i:
  54309: 3ed8af1
  54307: 104d83d
  54303: eb75cd3
v: v3
  • Loading branch information
Jeff Dike authored and Linus Torvalds committed May 7, 2007
1 parent b2cf6fb commit ef9aa0d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 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: 2e3f5251ac716879df6b6271f243f657c6e02e9a
refs/heads/master: f30c2c983e09470446ee00472f9d4a927fe2e9cb
37 changes: 25 additions & 12 deletions trunk/arch/um/os-Linux/skas/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ int is_skas_winch(int pid, int fd, void *data)
return(1);
}

static int ptrace_dump_regs(int pid)
{
unsigned long regs[MAX_REG_NR];
int i;

if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
return -errno;
else {
printk("Stub registers -\n");
for(i = 0; i < ARRAY_SIZE(regs); i++)
printk("\t%d - %lx\n", i, regs[i]);
}

return 0;
}

void wait_stub_done(int pid, int sig, char * fname)
{
int n, status, err;
Expand All @@ -67,18 +83,10 @@ void wait_stub_done(int pid, int sig, char * fname)

if((n < 0) || !WIFSTOPPED(status) ||
(WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){
unsigned long regs[MAX_REG_NR];

if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
err = ptrace_dump_regs(pid);
if(err)
printk("Failed to get registers from stub, "
"errno = %d\n", errno);
else {
int i;

printk("Stub registers -\n");
for(i = 0; i < ARRAY_SIZE(regs); i++)
printk("\t%d - %lx\n", i, regs[i]);
}
"errno = %d\n", -err);
panic("%s : failed to wait for SIGUSR1/SIGTRAP, "
"pid = %d, n = %d, errno = %d, status = 0x%x\n",
fname, pid, n, errno, status);
Expand Down Expand Up @@ -142,9 +150,14 @@ static void handle_trap(int pid, union uml_pt_regs *regs, int local_using_sysemu

CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));
if((err < 0) || !WIFSTOPPED(status) ||
(WSTOPSIG(status) != SIGTRAP + 0x80))
(WSTOPSIG(status) != SIGTRAP + 0x80)){
err = ptrace_dump_regs(pid);
if(err)
printk("Failed to get registers from process, "
"errno = %d\n", -err);
panic("handle_trap - failed to wait at end of syscall, "
"errno = %d, status = %d\n", errno, status);
}
}

handle_syscall(regs);
Expand Down

0 comments on commit ef9aa0d

Please sign in to comment.