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; | |
8fd79e71 | 40 | typedef unsigned long long int uint64_t; |
8bc7f138 L |
41 | #endif |
42 | ||
fe50f439 | 43 | #undef HAVE_PRPSINFO32_T |
8bc7f138 | 44 | #define HAVE_PRPSINFO32_T |
335e41d4 JK |
45 | #undef HAVE_PRPSINFO32_T_PR_PID |
46 | #define HAVE_PRPSINFO32_T_PR_PID | |
fe50f439 L |
47 | |
48 | #undef HAVE_PRSTATUS32_T | |
8bc7f138 L |
49 | #define HAVE_PRSTATUS32_T |
50 | ||
51 | /* These are the 32-bit x86 structures. */ | |
52 | ||
8bc7f138 L |
53 | struct user_regs32_struct |
54 | { | |
55 | int32_t ebx; | |
56 | int32_t ecx; | |
57 | int32_t edx; | |
58 | int32_t esi; | |
59 | int32_t edi; | |
60 | int32_t ebp; | |
61 | int32_t eax; | |
62 | int32_t xds; | |
63 | int32_t xes; | |
64 | int32_t xfs; | |
65 | int32_t xgs; | |
66 | int32_t orig_eax; | |
67 | int32_t eip; | |
68 | int32_t xcs; | |
69 | int32_t eflags; | |
70 | int32_t esp; | |
71 | int32_t xss; | |
72 | }; | |
73 | ||
8fd79e71 | 74 | struct user_regsx32_struct |
8bc7f138 | 75 | { |
8fd79e71 L |
76 | uint64_t r15; |
77 | uint64_t r14; | |
78 | uint64_t r13; | |
79 | uint64_t r12; | |
80 | uint64_t rbp; | |
81 | uint64_t rbx; | |
82 | uint64_t r11; | |
83 | uint64_t r10; | |
84 | uint64_t r9; | |
85 | uint64_t r8; | |
86 | uint64_t rax; | |
87 | uint64_t rcx; | |
88 | uint64_t rdx; | |
89 | uint64_t rsi; | |
90 | uint64_t rdi; | |
91 | uint64_t orig_rax; | |
92 | uint64_t rip; | |
93 | uint64_t cs; | |
94 | uint64_t eflags; | |
95 | uint64_t rsp; | |
96 | uint64_t ss; | |
97 | uint64_t fs_base; | |
98 | uint64_t gs_base; | |
99 | uint64_t ds; | |
100 | uint64_t es; | |
101 | uint64_t fs; | |
102 | uint64_t gs; | |
8bc7f138 L |
103 | }; |
104 | ||
105 | /* Type for a general-purpose register. */ | |
8fd79e71 L |
106 | typedef uint32_t elf_greg32_t; |
107 | typedef uint64_t elf_gregx32_t; | |
8bc7f138 L |
108 | |
109 | /* And the whole bunch of them. We could have used `struct | |
110 | user_regs_struct' directly in the typedef, but tradition says that | |
111 | the register set is an array, which does have some peculiar | |
112 | semantics, so leave it that way. */ | |
113 | #define ELF_NGREG32 (sizeof (struct user_regs32_struct) / sizeof(elf_greg32_t)) | |
114 | typedef elf_greg32_t elf_gregset32_t[ELF_NGREG32]; | |
8fd79e71 L |
115 | #define ELF_NGREGX32 (sizeof (struct user_regsx32_struct) / sizeof(elf_gregx32_t)) |
116 | typedef elf_gregx32_t elf_gregsetx32_t[ELF_NGREGX32]; | |
8bc7f138 L |
117 | |
118 | /* Definitions to generate Intel SVR4-like core files. These mostly | |
119 | have the same names as the SVR4 types with "elf_" tacked on the | |
120 | front to prevent clashes with Linux definitions, and the typedef | |
121 | forms have been avoided. This is mostly like the SVR4 structure, | |
122 | but more Linuxy, with things that Linux does not support and which | |
123 | GDB doesn't really use excluded. */ | |
124 | ||
125 | struct prstatus32_timeval | |
126 | { | |
127 | int tv_sec; | |
128 | int tv_usec; | |
129 | }; | |
130 | ||
131 | struct elf_prstatus32 | |
132 | { | |
133 | struct elf_siginfo pr_info; /* Info associated with signal. */ | |
134 | short int pr_cursig; /* Current signal. */ | |
135 | unsigned int pr_sigpend; /* Set of pending signals. */ | |
136 | unsigned int pr_sighold; /* Set of held signals. */ | |
2351cae0 L |
137 | pid_t pr_pid; |
138 | pid_t pr_ppid; | |
139 | pid_t pr_pgrp; | |
140 | pid_t pr_sid; | |
8bc7f138 L |
141 | struct prstatus32_timeval pr_utime; /* User time. */ |
142 | struct prstatus32_timeval pr_stime; /* System time. */ | |
143 | struct prstatus32_timeval pr_cutime; /* Cumulative user time. */ | |
144 | struct prstatus32_timeval pr_cstime; /* Cumulative system time. */ | |
145 | elf_gregset32_t pr_reg; /* GP registers. */ | |
146 | int pr_fpvalid; /* True if math copro being used. */ | |
147 | }; | |
148 | ||
8fd79e71 L |
149 | struct elf_prstatusx32 |
150 | { | |
151 | struct elf_siginfo pr_info; /* Info associated with signal. */ | |
152 | short int pr_cursig; /* Current signal. */ | |
153 | unsigned int pr_sigpend; /* Set of pending signals. */ | |
154 | unsigned int pr_sighold; /* Set of held signals. */ | |
155 | pid_t pr_pid; | |
156 | pid_t pr_ppid; | |
157 | pid_t pr_pgrp; | |
158 | pid_t pr_sid; | |
159 | struct prstatus32_timeval pr_utime; /* User time. */ | |
160 | struct prstatus32_timeval pr_stime; /* System time. */ | |
161 | struct prstatus32_timeval pr_cutime; /* Cumulative user time. */ | |
162 | struct prstatus32_timeval pr_cstime; /* Cumulative system time. */ | |
163 | elf_gregsetx32_t pr_reg; /* GP registers. */ | |
164 | int pr_fpvalid; /* True if math copro being used. */ | |
165 | }; | |
8bc7f138 L |
166 | |
167 | struct elf_prpsinfo32 | |
168 | { | |
169 | char pr_state; /* Numeric process state. */ | |
170 | char pr_sname; /* Char for pr_state. */ | |
171 | char pr_zomb; /* Zombie. */ | |
172 | char pr_nice; /* Nice val. */ | |
173 | unsigned int pr_flag; /* Flags. */ | |
174 | unsigned short int pr_uid; | |
175 | unsigned short int pr_gid; | |
176 | int pr_pid, pr_ppid, pr_pgrp, pr_sid; | |
177 | /* Lots missing */ | |
178 | char pr_fname[16]; /* Filename of executable. */ | |
179 | char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ | |
180 | }; | |
181 | ||
182 | ||
183 | /* The rest of this file provides the types for emulation of the | |
184 | Solaris <proc_service.h> interfaces that should be implemented by | |
185 | users of libthread_db. */ | |
186 | ||
8bc7f138 L |
187 | /* Process status and info. In the end we do provide typedefs for them. */ |
188 | typedef struct elf_prstatus32 prstatus32_t; | |
8fd79e71 | 189 | typedef struct elf_prstatusx32 prstatusx32_t; |
8bc7f138 | 190 | typedef struct elf_prpsinfo32 prpsinfo32_t; |