Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
2 | * Copyright 2003 PathScale, Inc. | ||||
3 | * | ||||
4 | * Licensed under the GPL | ||||
5 | */ | ||||
6 | |||||
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | #include <errno.h> |
8 | #include "ptrace_user.h" | ||||
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | |
10 | int ptrace_getregs(long pid, unsigned long *regs_out) | ||||
11 | { | ||||
Jeff Dike | 95906b2 | 2008-02-04 22:31:20 -0800 | [diff] [blame] | 12 | if (ptrace(PTRACE_GETREGS, pid, 0, regs_out) < 0) |
Jeff Dike | e2216fe | 2006-02-07 12:58:43 -0800 | [diff] [blame] | 13 | return -errno; |
Jeff Dike | 95906b2 | 2008-02-04 22:31:20 -0800 | [diff] [blame] | 14 | return(0); |
Jeff Dike | e2216fe | 2006-02-07 12:58:43 -0800 | [diff] [blame] | 15 | } |
16 | |||||
Jeff Dike | 95906b2 | 2008-02-04 22:31:20 -0800 | [diff] [blame] | 17 | int ptrace_setregs(long pid, unsigned long *regs_out) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | { |
Jeff Dike | 95906b2 | 2008-02-04 22:31:20 -0800 | [diff] [blame] | 19 | if (ptrace(PTRACE_SETREGS, pid, 0, regs_out) < 0) |
20 | return -errno; | ||||
21 | return(0); | ||||
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | } |