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