]> git.ipfire.org Git - thirdparty/glibc.git/blame - misc/ptrace.c
AArch64: Rename IS_ARES to IS_NEOVERSE_N1
[thirdparty/glibc.git] / misc / ptrace.c
CommitLineData
688903eb 1/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
478b92f0
UD
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
41bdb6e2
AJ
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
478b92f0
UD
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
41bdb6e2 12 Lesser General Public License for more details.
478b92f0 13
41bdb6e2 14 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
28f540f4 17
28f540f4
RM
18#include <errno.h>
19#include <sys/ptrace.h>
20#include <sys/types.h>
21#include <stdarg.h>
22
23/* Perform process tracing functions. REQUEST is one of the values
24 in <sys/ptrace.h>, and determines the action to be taken.
25 For all requests except PTRACE_TRACEME, PID specifies the process to be
26 traced.
27
28 PID and the other arguments described above for the various requests should
29 appear (those that are used for the particular request) as:
30 pid_t PID, void *ADDR, int DATA, void *ADDR2
31 after PID. */
32int
4bee4cd9 33ptrace (enum __ptrace_request request, ...)
28f540f4
RM
34{
35 pid_t pid;
c4029823
UD
36 void *addr;
37 void *addr2;
28f540f4
RM
38 int data;
39 va_list ap;
40
41 switch (request)
42 {
43 case PTRACE_TRACEME:
44 case PTRACE_CONT:
45 case PTRACE_KILL:
46 case PTRACE_SINGLESTEP:
47 case PTRACE_ATTACH:
48 case PTRACE_DETACH:
49 break;
50
51 case PTRACE_PEEKTEXT:
52 case PTRACE_PEEKDATA:
53 case PTRACE_PEEKUSER:
54 case PTRACE_GETREGS:
55 case PTRACE_SETREGS:
56#ifdef PTRACE_GETFPREGS
57 case PTRACE_GETFPGEGS:
58#endif
59 case PTRACE_SETFPREGS:
60 case PTRACE_GETFPAREGS:
61 case PTRACE_SETFPAREGS:
4bee4cd9
RM
62 va_start (ap, request);
63 pid = va_arg (ap, pid_t);
64 addr = va_arg (ap, void *);
65 va_end (ap);
66 ignore_value (pid);
67 ignore_value (addr);
28f540f4
RM
68 break;
69
70 case PTRACE_POKETEXT:
71 case PTRACE_POKEDATA:
72 case PTRACE_POKEUSER:
4bee4cd9
RM
73 va_start (ap, request);
74 pid = va_arg (ap, pid_t);
75 addr = va_arg (ap, void *);
76 data = va_arg (ap, int);
77 va_end (ap);
78 ignore_value (pid);
79 ignore_value (addr);
80 ignore_value (data);
28f540f4
RM
81 break;
82
83 case PTRACE_READDATA:
84 case PTRACE_WRITEDATA:
85 case PTRACE_READTEXT:
86 case PTRACE_WRITETEXT:
4bee4cd9
RM
87 va_start (ap, request);
88 pid = va_arg (ap, pid_t);
89 addr = va_arg (ap, void *);
90 data = va_arg (ap, int);
91 addr2 = va_arg (ap, void *);
92 va_end (ap);
93 ignore_value (pid);
94 ignore_value (addr);
95 ignore_value (data);
96 ignore_value (addr2);
28f540f4
RM
97 break;
98
99 default:
c4029823 100 __set_errno (EINVAL);
28f540f4
RM
101 return -1;
102 }
103
c4029823 104 __set_errno (ENOSYS);
28f540f4
RM
105 return -1;
106}
107
3f33a4ce 108stub_warning (ptrace)