1 /* Copyright (C) 2006, 2011, 2012
2 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 /* This is somewhat modelled after the file of the same name on SVR4
21 systems. It provides a definition of the core file format for ELF
22 used on Linux. It doesn't have anything to do with the /proc file
23 system, even though Linux has one.
25 Anyway, the whole purpose of this file is for GDB and GDB only.
26 Don't read too much into it. Don't use it for anything other than
27 GDB unless you know what you are doing. */
31 #include <sys/types.h>
33 /* We define here only the symbols differing from their 64-bit variant. */
34 #include <sys/procfs.h>
39 typedef unsigned int uint32_t;
40 typedef unsigned long long int uint64_t;
43 /* Unsigned 64-bit integer aligned to 8 bytes. */
44 typedef uint64_t __attribute__ ((__aligned__ (8))) a8_uint64_t
;
46 #undef HAVE_PRPSINFO32_T
47 #define HAVE_PRPSINFO32_T
48 #undef HAVE_PRPSINFO32_T_PR_PID
49 #define HAVE_PRPSINFO32_T_PR_PID
51 #undef HAVE_PRSTATUS32_T
52 #define HAVE_PRSTATUS32_T
54 /* These are the 32-bit x86 structures. */
56 struct user_regs32_struct
77 struct user_regs64_struct
108 /* Type for a general-purpose register. */
109 typedef uint32_t elf_greg32_t
;
110 typedef a8_uint64_t elf_greg64_t
;
112 /* And the whole bunch of them. We could have used `struct
113 user_regs_struct' directly in the typedef, but tradition says that
114 the register set is an array, which does have some peculiar
115 semantics, so leave it that way. */
116 #define ELF_NGREG32 (sizeof (struct user_regs32_struct) / sizeof(elf_greg32_t))
117 typedef elf_greg32_t elf_gregset32_t
[ELF_NGREG32
];
118 #define ELF_NGREG64 (sizeof (struct user_regs64_struct) / sizeof(elf_greg64_t))
119 typedef elf_greg64_t elf_gregset64_t
[ELF_NGREG64
];
121 /* Definitions to generate Intel SVR4-like core files. These mostly
122 have the same names as the SVR4 types with "elf_" tacked on the
123 front to prevent clashes with Linux definitions, and the typedef
124 forms have been avoided. This is mostly like the SVR4 structure,
125 but more Linuxy, with things that Linux does not support and which
126 GDB doesn't really use excluded. */
128 struct prstatus32_timeval
134 struct prstatus64_timeval
140 struct elf_prstatus32
142 struct elf_siginfo pr_info
; /* Info associated with signal. */
143 short int pr_cursig
; /* Current signal. */
144 unsigned int pr_sigpend
; /* Set of pending signals. */
145 unsigned int pr_sighold
; /* Set of held signals. */
150 struct prstatus32_timeval pr_utime
; /* User time. */
151 struct prstatus32_timeval pr_stime
; /* System time. */
152 struct prstatus32_timeval pr_cutime
; /* Cumulative user time. */
153 struct prstatus32_timeval pr_cstime
; /* Cumulative system time. */
154 elf_gregset32_t pr_reg
; /* GP registers. */
155 int pr_fpvalid
; /* True if math copro being used. */
158 struct elf_prstatusx32
160 struct elf_siginfo pr_info
; /* Info associated with signal. */
161 short int pr_cursig
; /* Current signal. */
162 unsigned int pr_sigpend
; /* Set of pending signals. */
163 unsigned int pr_sighold
; /* Set of held signals. */
168 struct prstatus32_timeval pr_utime
; /* User time. */
169 struct prstatus32_timeval pr_stime
; /* System time. */
170 struct prstatus32_timeval pr_cutime
; /* Cumulative user time. */
171 struct prstatus32_timeval pr_cstime
; /* Cumulative system time. */
172 elf_gregset64_t pr_reg
; /* GP registers. */
173 int pr_fpvalid
; /* True if math copro being used. */
176 struct elf_prstatus64
178 struct elf_siginfo pr_info
; /* Info associated with signal. */
179 short int pr_cursig
; /* Current signal. */
180 a8_uint64_t pr_sigpend
; /* Set of pending signals. */
181 a8_uint64_t pr_sighold
; /* Set of held signals. */
186 struct prstatus64_timeval pr_utime
; /* User time. */
187 struct prstatus64_timeval pr_stime
; /* System time. */
188 struct prstatus64_timeval pr_cutime
; /* Cumulative user time. */
189 struct prstatus64_timeval pr_cstime
; /* Cumulative system time. */
190 elf_gregset64_t pr_reg
; /* GP registers. */
191 int pr_fpvalid
; /* True if math copro being used. */
194 struct elf_prpsinfo32
196 char pr_state
; /* Numeric process state. */
197 char pr_sname
; /* Char for pr_state. */
198 char pr_zomb
; /* Zombie. */
199 char pr_nice
; /* Nice val. */
200 unsigned int pr_flag
; /* Flags. */
201 unsigned short int pr_uid
;
202 unsigned short int pr_gid
;
203 int pr_pid
, pr_ppid
, pr_pgrp
, pr_sid
;
205 char pr_fname
[16]; /* Filename of executable. */
206 char pr_psargs
[ELF_PRARGSZ
]; /* Initial part of arg list. */
209 struct elf_prpsinfo64
211 char pr_state
; /* Numeric process state. */
212 char pr_sname
; /* Char for pr_state. */
213 char pr_zomb
; /* Zombie. */
214 char pr_nice
; /* Nice val. */
215 a8_uint64_t pr_flag
; /* Flags. */
218 int pr_pid
, pr_ppid
, pr_pgrp
, pr_sid
;
220 char pr_fname
[16]; /* Filename of executable. */
221 char pr_psargs
[ELF_PRARGSZ
]; /* Initial part of arg list. */
224 /* The rest of this file provides the types for emulation of the
225 Solaris <proc_service.h> interfaces that should be implemented by
226 users of libthread_db. */
228 /* Process status and info. In the end we do provide typedefs for them. */
229 typedef struct elf_prstatus32 prstatus32_t
;
230 typedef struct elf_prstatusx32 prstatusx32_t
;
231 typedef struct elf_prstatus64 prstatus64_t
;
232 typedef struct elf_prpsinfo32 prpsinfo32_t
;
233 typedef struct elf_prpsinfo64 prpsinfo64_t
;