Commit | Line | Data |
---|---|---|
2351cae0 L |
1 | /* Copyright (C) 2006, 2011 |
2 | Free Software Foundation, Inc. | |
8bc7f138 L |
3 | This file is part of the GNU C Library. |
4 | ||
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. | |
9 | ||
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. | |
14 | ||
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 | |
18 | 02111-1307 USA. */ | |
19 | ||
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. | |
24 | ||
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. */ | |
28 | ||
29 | #include <features.h> | |
30 | #include <sys/time.h> | |
31 | #include <sys/types.h> | |
32 | ||
33 | /* We define here only the symbols differing from their 64-bit variant. */ | |
34 | #include <sys/procfs.h> | |
35 | ||
36 | #ifdef HAVE_STDINT_H | |
37 | #include <stdint.h> | |
38 | #else | |
39 | typedef unsigned int uint32_t; | |
40 | #endif | |
41 | ||
fe50f439 | 42 | #undef HAVE_PRPSINFO32_T |
8bc7f138 | 43 | #define HAVE_PRPSINFO32_T |
fe50f439 L |
44 | |
45 | #undef HAVE_PRSTATUS32_T | |
8bc7f138 L |
46 | #define HAVE_PRSTATUS32_T |
47 | ||
48 | /* These are the 32-bit x86 structures. */ | |
49 | ||
50 | struct user_fpregs32_struct | |
51 | { | |
52 | int32_t cwd; | |
53 | int32_t swd; | |
54 | int32_t twd; | |
55 | int32_t fip; | |
56 | int32_t fcs; | |
57 | int32_t foo; | |
58 | int32_t fos; | |
59 | int32_t st_space [20]; | |
60 | }; | |
61 | ||
62 | struct user_fpxregs32_struct | |
63 | { | |
64 | unsigned short int cwd; | |
65 | unsigned short int swd; | |
66 | unsigned short int twd; | |
67 | unsigned short int fop; | |
68 | int32_t fip; | |
69 | int32_t fcs; | |
70 | int32_t foo; | |
71 | int32_t fos; | |
72 | int32_t mxcsr; | |
73 | int32_t reserved; | |
74 | int32_t st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ | |
75 | int32_t xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */ | |
76 | int32_t padding[56]; | |
77 | }; | |
78 | ||
79 | struct user_regs32_struct | |
80 | { | |
81 | int32_t ebx; | |
82 | int32_t ecx; | |
83 | int32_t edx; | |
84 | int32_t esi; | |
85 | int32_t edi; | |
86 | int32_t ebp; | |
87 | int32_t eax; | |
88 | int32_t xds; | |
89 | int32_t xes; | |
90 | int32_t xfs; | |
91 | int32_t xgs; | |
92 | int32_t orig_eax; | |
93 | int32_t eip; | |
94 | int32_t xcs; | |
95 | int32_t eflags; | |
96 | int32_t esp; | |
97 | int32_t xss; | |
98 | }; | |
99 | ||
100 | struct user32 | |
101 | { | |
102 | struct user_regs32_struct regs; | |
103 | int u_fpvalid; | |
104 | struct user_fpregs32_struct i387; | |
105 | uint32_t u_tsize; | |
106 | uint32_t u_dsize; | |
107 | uint32_t u_ssize; | |
108 | uint32_t start_code; | |
109 | uint32_t start_stack; | |
110 | int32_t signal; | |
111 | int reserved; | |
112 | struct user_regs32_struct* u_ar0; | |
113 | struct user_fpregs32_struct* u_fpstate; | |
114 | uint32_t magic; | |
115 | char u_comm [32]; | |
116 | int u_debugreg [8]; | |
117 | }; | |
118 | ||
119 | /* Type for a general-purpose register. */ | |
120 | typedef unsigned int elf_greg32_t; | |
121 | ||
122 | /* And the whole bunch of them. We could have used `struct | |
123 | user_regs_struct' directly in the typedef, but tradition says that | |
124 | the register set is an array, which does have some peculiar | |
125 | semantics, so leave it that way. */ | |
126 | #define ELF_NGREG32 (sizeof (struct user_regs32_struct) / sizeof(elf_greg32_t)) | |
127 | typedef elf_greg32_t elf_gregset32_t[ELF_NGREG32]; | |
128 | ||
129 | /* Register set for the floating-point registers. */ | |
130 | typedef struct user_fpregs32_struct elf_fpregset32_t; | |
131 | ||
132 | /* Register set for the extended floating-point registers. Includes | |
133 | the Pentium III SSE registers in addition to the classic | |
134 | floating-point stuff. */ | |
135 | typedef struct user_fpxregs32_struct elf_fpxregset32_t; | |
136 | ||
137 | ||
138 | /* Definitions to generate Intel SVR4-like core files. These mostly | |
139 | have the same names as the SVR4 types with "elf_" tacked on the | |
140 | front to prevent clashes with Linux definitions, and the typedef | |
141 | forms have been avoided. This is mostly like the SVR4 structure, | |
142 | but more Linuxy, with things that Linux does not support and which | |
143 | GDB doesn't really use excluded. */ | |
144 | ||
145 | struct prstatus32_timeval | |
146 | { | |
147 | int tv_sec; | |
148 | int tv_usec; | |
149 | }; | |
150 | ||
151 | struct elf_prstatus32 | |
152 | { | |
153 | struct elf_siginfo pr_info; /* Info associated with signal. */ | |
154 | short int pr_cursig; /* Current signal. */ | |
155 | unsigned int pr_sigpend; /* Set of pending signals. */ | |
156 | unsigned int pr_sighold; /* Set of held signals. */ | |
2351cae0 L |
157 | pid_t pr_pid; |
158 | pid_t pr_ppid; | |
159 | pid_t pr_pgrp; | |
160 | pid_t pr_sid; | |
8bc7f138 L |
161 | struct prstatus32_timeval pr_utime; /* User time. */ |
162 | struct prstatus32_timeval pr_stime; /* System time. */ | |
163 | struct prstatus32_timeval pr_cutime; /* Cumulative user time. */ | |
164 | struct prstatus32_timeval pr_cstime; /* Cumulative system time. */ | |
165 | elf_gregset32_t pr_reg; /* GP registers. */ | |
166 | int pr_fpvalid; /* True if math copro being used. */ | |
167 | }; | |
168 | ||
169 | ||
170 | struct elf_prpsinfo32 | |
171 | { | |
172 | char pr_state; /* Numeric process state. */ | |
173 | char pr_sname; /* Char for pr_state. */ | |
174 | char pr_zomb; /* Zombie. */ | |
175 | char pr_nice; /* Nice val. */ | |
176 | unsigned int pr_flag; /* Flags. */ | |
177 | unsigned short int pr_uid; | |
178 | unsigned short int pr_gid; | |
179 | int pr_pid, pr_ppid, pr_pgrp, pr_sid; | |
180 | /* Lots missing */ | |
181 | char pr_fname[16]; /* Filename of executable. */ | |
182 | char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ | |
183 | }; | |
184 | ||
185 | ||
186 | /* The rest of this file provides the types for emulation of the | |
187 | Solaris <proc_service.h> interfaces that should be implemented by | |
188 | users of libthread_db. */ | |
189 | ||
190 | /* Register sets. Linux has different names. */ | |
191 | typedef elf_gregset_t prgregset32_t; | |
192 | typedef elf_fpregset_t prfpregset32_t; | |
193 | ||
194 | /* Process status and info. In the end we do provide typedefs for them. */ | |
195 | typedef struct elf_prstatus32 prstatus32_t; | |
196 | typedef struct elf_prpsinfo32 prpsinfo32_t; |