]> sourceware.org Git - glibc.git/blame - sysdeps/generic/ptrace.c
Update.
[glibc.git] / sysdeps / generic / ptrace.c
CommitLineData
478b92f0
UD
1/* Copyright (C) 1991, 92, 93, 95, 96, 97 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
28f540f4 18
28f540f4
RM
19#include <errno.h>
20#include <sys/ptrace.h>
21#include <sys/types.h>
22#include <stdarg.h>
23
24/* Perform process tracing functions. REQUEST is one of the values
25 in <sys/ptrace.h>, and determines the action to be taken.
26 For all requests except PTRACE_TRACEME, PID specifies the process to be
27 traced.
28
29 PID and the other arguments described above for the various requests should
30 appear (those that are used for the particular request) as:
31 pid_t PID, void *ADDR, int DATA, void *ADDR2
32 after PID. */
33int
c4029823
UD
34ptrace (request)
35 enum __ptrace_request request;
28f540f4
RM
36{
37 pid_t pid;
c4029823
UD
38 void *addr;
39 void *addr2;
28f540f4
RM
40 int data;
41 va_list ap;
42
43 switch (request)
44 {
45 case PTRACE_TRACEME:
46 case PTRACE_CONT:
47 case PTRACE_KILL:
48 case PTRACE_SINGLESTEP:
49 case PTRACE_ATTACH:
50 case PTRACE_DETACH:
51 break;
52
53 case PTRACE_PEEKTEXT:
54 case PTRACE_PEEKDATA:
55 case PTRACE_PEEKUSER:
56 case PTRACE_GETREGS:
57 case PTRACE_SETREGS:
58#ifdef PTRACE_GETFPREGS
59 case PTRACE_GETFPGEGS:
60#endif
61 case PTRACE_SETFPREGS:
62 case PTRACE_GETFPAREGS:
63 case PTRACE_SETFPAREGS:
64 va_start(ap, request);
65 pid = va_arg(ap, pid_t);
c4029823 66 addr = va_arg(ap, void *);
28f540f4
RM
67 va_end(ap);
68 break;
69
70 case PTRACE_POKETEXT:
71 case PTRACE_POKEDATA:
72 case PTRACE_POKEUSER:
73 va_start(ap, request);
74 pid = va_arg(ap, pid_t);
c4029823 75 addr = va_arg(ap, void *);
28f540f4
RM
76 data = va_arg(ap, int);
77 va_end(ap);
78 break;
79
80 case PTRACE_READDATA:
81 case PTRACE_WRITEDATA:
82 case PTRACE_READTEXT:
83 case PTRACE_WRITETEXT:
84 va_start(ap, request);
85 pid = va_arg(ap, pid_t);
c4029823 86 addr = va_arg(ap, void *);
28f540f4 87 data = va_arg(ap, int);
c4029823 88 addr2 = va_arg(ap, void *);
28f540f4
RM
89 va_end(ap);
90 break;
91
92 default:
c4029823 93 __set_errno (EINVAL);
28f540f4
RM
94 return -1;
95 }
96
c4029823 97 __set_errno (ENOSYS);
28f540f4
RM
98 return -1;
99}
100
101
3f33a4ce 102stub_warning (ptrace)
f2ea0f5b 103#include <stub-tag.h>
This page took 0.084439 seconds and 5 git commands to generate.