1 /* Copyright (C) 2006-2017 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
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.
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 Lesser General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
17 MA 02110-1301, USA. */
19 /* This is somewhat modelled after the file of the same name on SVR4
20 systems. It provides a definition of the core file format for ELF
21 used on Linux. It doesn't have anything to do with the /proc file
22 system, even though Linux has one.
24 Anyway, the whole purpose of this file is for GDB and GDB only.
25 Don't read too much into it. Don't use it for anything other than
26 GDB unless you know what you are doing. */
30 #include <sys/types.h>
32 /* We define here only the symbols differing from their 64-bit variant. */
33 #include <sys/procfs.h>
38 typedef unsigned int uint32_t;
39 typedef unsigned long long int uint64_t;
42 /* Unsigned 64-bit integer aligned to 8 bytes. */
43 typedef uint64_t __attribute__ ((__aligned__ (8))) a8_uint64_t;
45 #undef HAVE_PRPSINFO32_T
46 #define HAVE_PRPSINFO32_T
47 #undef HAVE_PRPSINFO32_T_PR_PID
48 #define HAVE_PRPSINFO32_T_PR_PID
50 #undef HAVE_PRSTATUS32_T
51 #define HAVE_PRSTATUS32_T
53 /* These are the 32-bit x86 structures. */
55 struct user_regs32_struct
76 struct user_regs64_struct
107 /* Type for a general-purpose register. */
108 typedef uint32_t elf_greg32_t;
109 typedef a8_uint64_t elf_greg64_t;
111 /* And the whole bunch of them. We could have used `struct
112 user_regs_struct' directly in the typedef, but tradition says that
113 the register set is an array, which does have some peculiar
114 semantics, so leave it that way. */
115 #define ELF_NGREG32 (sizeof (struct user_regs32_struct) / sizeof(elf_greg32_t))
116 typedef elf_greg32_t elf_gregset32_t[ELF_NGREG32];
117 #define ELF_NGREG64 (sizeof (struct user_regs64_struct) / sizeof(elf_greg64_t))
118 typedef elf_greg64_t elf_gregset64_t[ELF_NGREG64];
120 /* Definitions to generate Intel SVR4-like core files. These mostly
121 have the same names as the SVR4 types with "elf_" tacked on the
122 front to prevent clashes with Linux definitions, and the typedef
123 forms have been avoided. This is mostly like the SVR4 structure,
124 but more Linuxy, with things that Linux does not support and which
125 GDB doesn't really use excluded. */
127 struct prstatus32_timeval
133 struct prstatus64_timeval
139 struct elf_prstatus32
141 struct elf_siginfo pr_info; /* Info associated with signal. */
142 short int pr_cursig; /* Current signal. */
143 unsigned int pr_sigpend; /* Set of pending signals. */
144 unsigned int pr_sighold; /* Set of held signals. */
149 struct prstatus32_timeval pr_utime; /* User time. */
150 struct prstatus32_timeval pr_stime; /* System time. */
151 struct prstatus32_timeval pr_cutime; /* Cumulative user time. */
152 struct prstatus32_timeval pr_cstime; /* Cumulative system time. */
153 elf_gregset32_t pr_reg; /* GP registers. */
154 int pr_fpvalid; /* True if math copro being used. */
157 struct elf_prstatusx32
159 struct elf_siginfo pr_info; /* Info associated with signal. */
160 short int pr_cursig; /* Current signal. */
161 unsigned int pr_sigpend; /* Set of pending signals. */
162 unsigned int pr_sighold; /* Set of held signals. */
167 struct prstatus32_timeval pr_utime; /* User time. */
168 struct prstatus32_timeval pr_stime; /* System time. */
169 struct prstatus32_timeval pr_cutime; /* Cumulative user time. */
170 struct prstatus32_timeval pr_cstime; /* Cumulative system time. */
171 elf_gregset64_t pr_reg; /* GP registers. */
172 int pr_fpvalid; /* True if math copro being used. */
175 struct elf_prstatus64
177 struct elf_siginfo pr_info; /* Info associated with signal. */
178 short int pr_cursig; /* Current signal. */
179 a8_uint64_t pr_sigpend; /* Set of pending signals. */
180 a8_uint64_t pr_sighold; /* Set of held signals. */
185 struct prstatus64_timeval pr_utime; /* User time. */
186 struct prstatus64_timeval pr_stime; /* System time. */
187 struct prstatus64_timeval pr_cutime; /* Cumulative user time. */
188 struct prstatus64_timeval pr_cstime; /* Cumulative system time. */
189 elf_gregset64_t pr_reg; /* GP registers. */
190 int pr_fpvalid; /* True if math copro being used. */
193 struct elf_prpsinfo32
195 char pr_state; /* Numeric process state. */
196 char pr_sname; /* Char for pr_state. */
197 char pr_zomb; /* Zombie. */
198 char pr_nice; /* Nice val. */
199 unsigned int pr_flag; /* Flags. */
200 unsigned short int pr_uid;
201 unsigned short int pr_gid;
202 int pr_pid, pr_ppid, pr_pgrp, pr_sid;
204 char pr_fname[16]; /* Filename of executable. */
205 char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
208 struct elf_prpsinfo64
210 char pr_state; /* Numeric process state. */
211 char pr_sname; /* Char for pr_state. */
212 char pr_zomb; /* Zombie. */
213 char pr_nice; /* Nice val. */
214 a8_uint64_t pr_flag; /* Flags. */
217 int pr_pid, pr_ppid, pr_pgrp, pr_sid;
219 char pr_fname[16]; /* Filename of executable. */
220 char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
223 /* The rest of this file provides the types for emulation of the
224 Solaris <proc_service.h> interfaces that should be implemented by
225 users of libthread_db. */
227 /* Process status and info. In the end we do provide typedefs for them. */
228 typedef struct elf_prstatus32 prstatus32_t;
229 typedef struct elf_prstatusx32 prstatusx32_t;
230 typedef struct elf_prstatus64 prstatus64_t;
231 typedef struct elf_prpsinfo32 prpsinfo32_t;
232 typedef struct elf_prpsinfo64 prpsinfo64_t;