Commit | Line | Data |
---|---|---|
d4f3574e SS |
1 | /* Native-dependent code for Linux running on i386's, for GDB. |
2 | ||
04cd15b6 | 3 | This file is part of GDB. |
d4f3574e | 4 | |
04cd15b6 MK |
5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 2 of the License, or | |
8 | (at your option) any later version. | |
d4f3574e | 9 | |
04cd15b6 MK |
10 | This program 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 | |
13 | GNU General Public License for more details. | |
d4f3574e | 14 | |
04cd15b6 MK |
15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | |
17 | Foundation, Inc., 59 Temple Place - Suite 330, | |
18 | Boston, MA 02111-1307, USA. */ | |
d4f3574e SS |
19 | |
20 | #include "defs.h" | |
21 | #include "inferior.h" | |
22 | #include "gdbcore.h" | |
23 | ||
04cd15b6 | 24 | /* For i386_linux_skip_solib_resolver. */ |
d4f3574e | 25 | #include "symtab.h" |
d4f3574e SS |
26 | #include "symfile.h" |
27 | #include "objfiles.h" | |
28 | ||
29 | #include <sys/ptrace.h> | |
30 | #include <sys/user.h> | |
31 | #include <sys/procfs.h> | |
32 | ||
33 | #ifdef HAVE_SYS_REG_H | |
34 | #include <sys/reg.h> | |
35 | #endif | |
36 | ||
04cd15b6 MK |
37 | /* On Linux, threads are implemented as pseudo-processes, in which |
38 | case we may be tracing more than one process at a time. In that | |
39 | case, inferior_pid will contain the main process ID and the | |
40 | individual thread (process) ID mashed together. These macros are | |
41 | used to separate them out. These definitions should be overridden | |
42 | if thread support is included. */ | |
ed9a39eb JM |
43 | |
44 | #if !defined (PIDGET) /* Default definition for PIDGET/TIDGET. */ | |
45 | #define PIDGET(PID) PID | |
46 | #define TIDGET(PID) 0 | |
47 | #endif | |
48 | ||
d4f3574e | 49 | |
04cd15b6 MK |
50 | /* The register sets used in Linux ELF core-dumps are identical to the |
51 | register sets in `struct user' that is used for a.out core-dumps, | |
52 | and is also used by `ptrace'. The corresponding types are | |
53 | `elf_gregset_t' for the general-purpose registers (with | |
54 | `elf_greg_t' the type of a single GP register) and `elf_fpregset_t' | |
55 | for the floating-point registers. | |
56 | ||
57 | Those types used to be available under the names `gregset_t' and | |
58 | `fpregset_t' too, and this file used those names in the past. But | |
59 | those names are now used for the register sets used in the | |
60 | `mcontext_t' type, and have a different size and layout. */ | |
61 | ||
62 | /* Mapping between the general-purpose registers in `struct user' | |
63 | format and GDB's register array layout. */ | |
d4f3574e SS |
64 | static int regmap[] = |
65 | { | |
66 | EAX, ECX, EDX, EBX, | |
67 | UESP, EBP, ESI, EDI, | |
68 | EIP, EFL, CS, SS, | |
04cd15b6 | 69 | DS, ES, FS, GS |
d4f3574e SS |
70 | }; |
71 | ||
5c44784c JM |
72 | /* Which ptrace request retrieves which registers? |
73 | These apply to the corresponding SET requests as well. */ | |
74 | #define GETREGS_SUPPLIES(regno) \ | |
75 | (0 <= (regno) && (regno) <= 15) | |
76 | #define GETFPREGS_SUPPLIES(regno) \ | |
77 | (FP0_REGNUM <= (regno) && (regno) <= LAST_FPU_CTRL_REGNUM) | |
78 | #define GETXFPREGS_SUPPLIES(regno) \ | |
79 | (FP0_REGNUM <= (regno) && (regno) <= MXCSR_REGNUM) | |
80 | ||
f60300e7 MK |
81 | /* Does the current host support the GETREGS request? */ |
82 | int have_ptrace_getregs = | |
83 | #ifdef HAVE_PTRACE_GETREGS | |
84 | 1 | |
85 | #else | |
86 | 0 | |
87 | #endif | |
88 | ; | |
89 | ||
5c44784c JM |
90 | /* Does the current host support the GETXFPREGS request? The header |
91 | file may or may not define it, and even if it is defined, the | |
92 | kernel will return EIO if it's running on a pre-SSE processor. | |
93 | ||
c2d11a7d JM |
94 | PTRACE_GETXFPREGS is a Cygnus invention, since we wrote our own |
95 | Linux kernel patch for SSE support. That patch may or may not | |
96 | actually make it into the official distribution. If you find that | |
97 | years have gone by since this stuff was added, and Linux isn't | |
98 | using PTRACE_GETXFPREGS, that means that our patch didn't make it, | |
99 | and you can delete this, and the related code. | |
100 | ||
5c44784c JM |
101 | My instinct is to attach this to some architecture- or |
102 | target-specific data structure, but really, a particular GDB | |
103 | process can only run on top of one kernel at a time. So it's okay | |
104 | for this to be a simple variable. */ | |
105 | int have_ptrace_getxfpregs = | |
106 | #ifdef HAVE_PTRACE_GETXFPREGS | |
107 | 1 | |
108 | #else | |
109 | 0 | |
110 | #endif | |
111 | ; | |
112 | ||
f60300e7 | 113 | \f |
97780f5f JB |
114 | /* Fetching registers directly from the U area, one at a time. */ |
115 | ||
f60300e7 MK |
116 | /* FIXME: kettenis/2000-03-05: This duplicates code from `inptrace.c'. |
117 | The problem is that we define FETCH_INFERIOR_REGISTERS since we | |
118 | want to use our own versions of {fetch,store}_inferior_registers | |
119 | that use the GETREGS request. This means that the code in | |
120 | `infptrace.c' is #ifdef'd out. But we need to fall back on that | |
121 | code when GDB is running on top of a kernel that doesn't support | |
122 | the GETREGS request. I want to avoid changing `infptrace.c' right | |
123 | now. */ | |
124 | ||
125 | /* Default the type of the ptrace transfer to int. */ | |
126 | #ifndef PTRACE_XFER_TYPE | |
127 | #define PTRACE_XFER_TYPE int | |
128 | #endif | |
129 | ||
130 | /* Registers we shouldn't try to fetch. */ | |
131 | #if !defined (CANNOT_FETCH_REGISTER) | |
132 | #define CANNOT_FETCH_REGISTER(regno) 0 | |
133 | #endif | |
134 | ||
135 | /* Fetch one register. */ | |
136 | ||
137 | static void | |
138 | fetch_register (regno) | |
139 | int regno; | |
140 | { | |
141 | /* This isn't really an address. But ptrace thinks of it as one. */ | |
142 | CORE_ADDR regaddr; | |
143 | char mess[128]; /* For messages */ | |
144 | register int i; | |
145 | unsigned int offset; /* Offset of registers within the u area. */ | |
146 | char buf[MAX_REGISTER_RAW_SIZE]; | |
147 | int tid; | |
148 | ||
149 | if (CANNOT_FETCH_REGISTER (regno)) | |
150 | { | |
151 | memset (buf, '\0', REGISTER_RAW_SIZE (regno)); /* Supply zeroes */ | |
152 | supply_register (regno, buf); | |
153 | return; | |
154 | } | |
155 | ||
156 | /* Overload thread id onto process id */ | |
157 | if ((tid = TIDGET (inferior_pid)) == 0) | |
158 | tid = inferior_pid; /* no thread id, just use process id */ | |
159 | ||
160 | offset = U_REGS_OFFSET; | |
161 | ||
162 | regaddr = register_addr (regno, offset); | |
163 | for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) | |
164 | { | |
165 | errno = 0; | |
166 | *(PTRACE_XFER_TYPE *) & buf[i] = ptrace (PT_READ_U, tid, | |
167 | (PTRACE_ARG3_TYPE) regaddr, 0); | |
168 | regaddr += sizeof (PTRACE_XFER_TYPE); | |
169 | if (errno != 0) | |
170 | { | |
171 | sprintf (mess, "reading register %s (#%d)", | |
172 | REGISTER_NAME (regno), regno); | |
173 | perror_with_name (mess); | |
174 | } | |
175 | } | |
176 | supply_register (regno, buf); | |
177 | } | |
178 | ||
179 | /* Fetch register values from the inferior. | |
180 | If REGNO is negative, do this for all registers. | |
181 | Otherwise, REGNO specifies which register (so we can save time). */ | |
182 | ||
183 | void | |
184 | old_fetch_inferior_registers (regno) | |
185 | int regno; | |
186 | { | |
187 | if (regno >= 0) | |
188 | { | |
189 | fetch_register (regno); | |
190 | } | |
191 | else | |
192 | { | |
193 | for (regno = 0; regno < ARCH_NUM_REGS; regno++) | |
194 | { | |
195 | fetch_register (regno); | |
196 | } | |
197 | } | |
198 | } | |
199 | ||
200 | /* Registers we shouldn't try to store. */ | |
201 | #if !defined (CANNOT_STORE_REGISTER) | |
202 | #define CANNOT_STORE_REGISTER(regno) 0 | |
203 | #endif | |
204 | ||
205 | /* Store one register. */ | |
206 | ||
207 | static void | |
208 | store_register (regno) | |
209 | int regno; | |
210 | { | |
211 | /* This isn't really an address. But ptrace thinks of it as one. */ | |
212 | CORE_ADDR regaddr; | |
213 | char mess[128]; /* For messages */ | |
214 | register int i; | |
215 | unsigned int offset; /* Offset of registers within the u area. */ | |
216 | int tid; | |
217 | ||
218 | if (CANNOT_STORE_REGISTER (regno)) | |
219 | { | |
220 | return; | |
221 | } | |
222 | ||
223 | /* Overload thread id onto process id */ | |
224 | if ((tid = TIDGET (inferior_pid)) == 0) | |
225 | tid = inferior_pid; /* no thread id, just use process id */ | |
226 | ||
227 | offset = U_REGS_OFFSET; | |
228 | ||
229 | regaddr = register_addr (regno, offset); | |
230 | for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) | |
231 | { | |
232 | errno = 0; | |
233 | ptrace (PT_WRITE_U, tid, (PTRACE_ARG3_TYPE) regaddr, | |
234 | *(PTRACE_XFER_TYPE *) & registers[REGISTER_BYTE (regno) + i]); | |
235 | regaddr += sizeof (PTRACE_XFER_TYPE); | |
236 | if (errno != 0) | |
237 | { | |
238 | sprintf (mess, "writing register %s (#%d)", | |
239 | REGISTER_NAME (regno), regno); | |
240 | perror_with_name (mess); | |
241 | } | |
242 | } | |
243 | } | |
244 | ||
245 | /* Store our register values back into the inferior. | |
246 | If REGNO is negative, do this for all registers. | |
247 | Otherwise, REGNO specifies which register (so we can save time). */ | |
248 | ||
249 | void | |
250 | old_store_inferior_registers (regno) | |
251 | int regno; | |
252 | { | |
253 | if (regno >= 0) | |
254 | { | |
255 | store_register (regno); | |
256 | } | |
257 | else | |
258 | { | |
259 | for (regno = 0; regno < ARCH_NUM_REGS; regno++) | |
260 | { | |
261 | store_register (regno); | |
262 | } | |
263 | } | |
264 | } | |
265 | ||
5c44784c | 266 | \f |
04cd15b6 MK |
267 | /* Transfering the general-purpose registers between GDB, inferiors |
268 | and core files. */ | |
269 | ||
270 | /* Fill GDB's register array with the genereal-purpose register values | |
271 | in *GREGSETP. */ | |
5c44784c | 272 | |
d4f3574e | 273 | void |
04cd15b6 | 274 | supply_gregset (elf_gregset_t *gregsetp) |
d4f3574e | 275 | { |
04cd15b6 MK |
276 | elf_greg_t *regp = (elf_greg_t *) gregsetp; |
277 | int regi; | |
d4f3574e | 278 | |
917317f4 | 279 | for (regi = 0; regi < NUM_GREGS; regi++) |
04cd15b6 | 280 | supply_register (regi, (char *) (regp + regmap[regi])); |
d4f3574e SS |
281 | } |
282 | ||
04cd15b6 MK |
283 | /* Convert the valid general-purpose register values in GDB's register |
284 | array to `struct user' format and store them in *GREGSETP. The | |
285 | array VALID indicates which register values are valid. If VALID is | |
286 | NULL, all registers are assumed to be valid. */ | |
5c44784c | 287 | |
04cd15b6 MK |
288 | static void |
289 | convert_to_gregset (elf_gregset_t *gregsetp, signed char *valid) | |
d4f3574e | 290 | { |
04cd15b6 | 291 | elf_greg_t *regp = (elf_greg_t *) gregsetp; |
d4f3574e | 292 | int regi; |
d4f3574e | 293 | |
917317f4 JM |
294 | for (regi = 0; regi < NUM_GREGS; regi++) |
295 | if (! valid || valid[regi]) | |
296 | *(regp + regmap[regi]) = * (int *) ®isters[REGISTER_BYTE (regi)]; | |
297 | } | |
298 | ||
04cd15b6 MK |
299 | /* Fill register REGNO (if it is a general-purpose register) in |
300 | *GREGSETPS with the value in GDB's register array. If REGNO is -1, | |
301 | do this for all registers. */ | |
917317f4 | 302 | void |
04cd15b6 | 303 | fill_gregset (elf_gregset_t *gregsetp, int regno) |
917317f4 JM |
304 | { |
305 | if (regno == -1) | |
04cd15b6 MK |
306 | { |
307 | convert_to_gregset (gregsetp, NULL); | |
308 | return; | |
309 | } | |
310 | ||
311 | if (GETREGS_SUPPLIES (regno)) | |
d4f3574e | 312 | { |
917317f4 | 313 | signed char valid[NUM_GREGS]; |
04cd15b6 | 314 | |
917317f4 JM |
315 | memset (valid, 0, sizeof (valid)); |
316 | valid[regno] = 1; | |
04cd15b6 MK |
317 | |
318 | convert_to_gregset (gregsetp, valid); | |
d4f3574e SS |
319 | } |
320 | } | |
321 | ||
f60300e7 MK |
322 | #ifdef HAVE_PTRACE_GETREGS |
323 | ||
04cd15b6 MK |
324 | /* Fetch all general-purpose registers from process/thread TID and |
325 | store their values in GDB's register array. */ | |
d4f3574e | 326 | |
5c44784c | 327 | static void |
ed9a39eb | 328 | fetch_regs (int tid) |
5c44784c | 329 | { |
04cd15b6 MK |
330 | elf_gregset_t regs; |
331 | int ret; | |
5c44784c | 332 | |
04cd15b6 | 333 | ret = ptrace (PTRACE_GETREGS, tid, 0, (int) ®s); |
5c44784c JM |
334 | if (ret < 0) |
335 | { | |
f60300e7 MK |
336 | if (errno == EIO) |
337 | { | |
338 | /* The kernel we're running on doesn't support the GETREGS | |
339 | request. Reset `have_ptrace_getregs'. */ | |
340 | have_ptrace_getregs = 0; | |
341 | return; | |
342 | } | |
343 | ||
04cd15b6 | 344 | warning ("Couldn't get registers."); |
5c44784c JM |
345 | return; |
346 | } | |
347 | ||
04cd15b6 | 348 | supply_gregset (®s); |
5c44784c JM |
349 | } |
350 | ||
04cd15b6 MK |
351 | /* Store all valid general-purpose registers in GDB's register array |
352 | into the process/thread specified by TID. */ | |
5c44784c | 353 | |
5c44784c | 354 | static void |
ed9a39eb | 355 | store_regs (int tid) |
5c44784c | 356 | { |
04cd15b6 MK |
357 | elf_gregset_t regs; |
358 | int ret; | |
5c44784c | 359 | |
04cd15b6 | 360 | ret = ptrace (PTRACE_GETREGS, tid, 0, (int) ®s); |
5c44784c JM |
361 | if (ret < 0) |
362 | { | |
04cd15b6 | 363 | warning ("Couldn't get registers."); |
5c44784c JM |
364 | return; |
365 | } | |
366 | ||
04cd15b6 | 367 | convert_to_gregset (®s, register_valid); |
5c44784c | 368 | |
04cd15b6 | 369 | ret = ptrace (PTRACE_SETREGS, tid, 0, (int) ®s); |
5c44784c JM |
370 | if (ret < 0) |
371 | { | |
04cd15b6 | 372 | warning ("Couldn't write registers."); |
5c44784c JM |
373 | return; |
374 | } | |
375 | } | |
376 | ||
f60300e7 MK |
377 | #else |
378 | ||
379 | static void fetch_regs (int tid) {} | |
380 | static void store_regs (int tid) {} | |
381 | ||
382 | #endif | |
383 | ||
5c44784c JM |
384 | \f |
385 | /* Transfering floating-point registers between GDB, inferiors and cores. */ | |
386 | ||
04cd15b6 MK |
387 | /* What is the address of st(N) within the floating-point register set F? */ |
388 | #define FPREG_ADDR(f, n) ((char *) &(f)->st_space + (n) * 10) | |
d4f3574e | 389 | |
04cd15b6 | 390 | /* Fill GDB's register array with the floating-point register values in |
917317f4 | 391 | *FPREGSETP. */ |
04cd15b6 | 392 | |
d4f3574e | 393 | void |
04cd15b6 | 394 | supply_fpregset (elf_fpregset_t *fpregsetp) |
d4f3574e | 395 | { |
04cd15b6 | 396 | int reg; |
b948cda9 | 397 | long l; |
917317f4 JM |
398 | |
399 | /* Supply the floating-point registers. */ | |
04cd15b6 MK |
400 | for (reg = 0; reg < 8; reg++) |
401 | supply_register (FP0_REGNUM + reg, FPREG_ADDR (fpregsetp, reg)); | |
917317f4 | 402 | |
b948cda9 MK |
403 | /* We have to mask off the reserved bits in *FPREGSETP before |
404 | storing the values in GDB's register file. */ | |
405 | #define supply(REGNO, MEMBER) \ | |
406 | l = fpregsetp->MEMBER & 0xffff; \ | |
407 | supply_register (REGNO, (char *) &l) | |
408 | ||
409 | supply (FCTRL_REGNUM, cwd); | |
410 | supply (FSTAT_REGNUM, swd); | |
411 | supply (FTAG_REGNUM, twd); | |
917317f4 | 412 | supply_register (FCOFF_REGNUM, (char *) &fpregsetp->fip); |
b948cda9 | 413 | supply (FDS_REGNUM, fos); |
917317f4 | 414 | supply_register (FDOFF_REGNUM, (char *) &fpregsetp->foo); |
917317f4 | 415 | |
b948cda9 MK |
416 | #undef supply |
417 | ||
418 | /* Extract the code segment and opcode from the "fcs" member. */ | |
419 | l = fpregsetp->fcs & 0xffff; | |
420 | supply_register (FCS_REGNUM, (char *) &l); | |
917317f4 | 421 | |
b948cda9 MK |
422 | l = (fpregsetp->fcs >> 16) & ((1 << 11) - 1); |
423 | supply_register (FOP_REGNUM, (char *) &l); | |
d4f3574e SS |
424 | } |
425 | ||
04cd15b6 MK |
426 | /* Convert the valid floating-point register values in GDB's register |
427 | array to `struct user' format and store them in *FPREGSETP. The | |
428 | array VALID indicates which register values are valid. If VALID is | |
429 | NULL, all registers are assumed to be valid. */ | |
d4f3574e | 430 | |
04cd15b6 MK |
431 | static void |
432 | convert_to_fpregset (elf_fpregset_t *fpregsetp, signed char *valid) | |
d4f3574e | 433 | { |
04cd15b6 | 434 | int reg; |
917317f4 JM |
435 | |
436 | /* Fill in the floating-point registers. */ | |
04cd15b6 MK |
437 | for (reg = 0; reg < 8; reg++) |
438 | if (!valid || valid[reg]) | |
439 | memcpy (FPREG_ADDR (fpregsetp, reg), | |
440 | ®isters[REGISTER_BYTE (FP0_REGNUM + reg)], | |
441 | REGISTER_RAW_SIZE(FP0_REGNUM + reg)); | |
917317f4 | 442 | |
b948cda9 MK |
443 | /* We're not supposed to touch the reserved bits in *FPREGSETP. */ |
444 | ||
917317f4 JM |
445 | #define fill(MEMBER, REGNO) \ |
446 | if (! valid || valid[(REGNO)]) \ | |
b948cda9 MK |
447 | fpregsetp->MEMBER \ |
448 | = ((fpregsetp->MEMBER & ~0xffff) \ | |
449 | | (* (int *) ®isters[REGISTER_BYTE (REGNO)] & 0xffff)) | |
450 | ||
451 | #define fill_register(MEMBER, REGNO) \ | |
452 | if (! valid || valid[(REGNO)]) \ | |
453 | memcpy (&fpregsetp->MEMBER, ®isters[REGISTER_BYTE (REGNO)], \ | |
454 | sizeof (fpregsetp->MEMBER)) | |
917317f4 JM |
455 | |
456 | fill (cwd, FCTRL_REGNUM); | |
457 | fill (swd, FSTAT_REGNUM); | |
458 | fill (twd, FTAG_REGNUM); | |
b948cda9 | 459 | fill_register (fip, FCOFF_REGNUM); |
917317f4 | 460 | fill (foo, FDOFF_REGNUM); |
b948cda9 | 461 | fill_register (fos, FDS_REGNUM); |
917317f4 JM |
462 | |
463 | #undef fill | |
b948cda9 | 464 | #undef fill_register |
917317f4 JM |
465 | |
466 | if (! valid || valid[FCS_REGNUM]) | |
467 | fpregsetp->fcs | |
468 | = ((fpregsetp->fcs & ~0xffff) | |
469 | | (* (int *) ®isters[REGISTER_BYTE (FCS_REGNUM)] & 0xffff)); | |
470 | ||
471 | if (! valid || valid[FOP_REGNUM]) | |
472 | fpregsetp->fcs | |
473 | = ((fpregsetp->fcs & 0xffff) | |
474 | | ((*(int *) ®isters[REGISTER_BYTE (FOP_REGNUM)] & ((1 << 11) - 1)) | |
475 | << 16)); | |
476 | } | |
d4f3574e | 477 | |
04cd15b6 MK |
478 | /* Fill register REGNO (if it is a floating-point register) in |
479 | *FPREGSETP with the value in GDB's register array. If REGNO is -1, | |
480 | do this for all registers. */ | |
917317f4 JM |
481 | |
482 | void | |
04cd15b6 | 483 | fill_fpregset (elf_fpregset_t *fpregsetp, int regno) |
917317f4 | 484 | { |
04cd15b6 MK |
485 | if (regno == -1) |
486 | { | |
487 | convert_to_fpregset (fpregsetp, NULL); | |
488 | return; | |
489 | } | |
490 | ||
491 | if (GETFPREGS_SUPPLIES(regno)) | |
492 | { | |
493 | signed char valid[MAX_NUM_REGS]; | |
494 | ||
495 | memset (valid, 0, sizeof (valid)); | |
496 | valid[regno] = 1; | |
497 | ||
498 | convert_to_fpregset (fpregsetp, valid); | |
499 | } | |
d4f3574e SS |
500 | } |
501 | ||
f60300e7 MK |
502 | #ifdef HAVE_PTRACE_GETREGS |
503 | ||
04cd15b6 MK |
504 | /* Fetch all floating-point registers from process/thread TID and store |
505 | thier values in GDB's register array. */ | |
917317f4 | 506 | |
d4f3574e | 507 | static void |
ed9a39eb | 508 | fetch_fpregs (int tid) |
d4f3574e | 509 | { |
04cd15b6 MK |
510 | elf_fpregset_t fpregs; |
511 | int ret; | |
d4f3574e | 512 | |
04cd15b6 | 513 | ret = ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs); |
917317f4 | 514 | if (ret < 0) |
d4f3574e | 515 | { |
04cd15b6 | 516 | warning ("Couldn't get floating point status."); |
d4f3574e SS |
517 | return; |
518 | } | |
519 | ||
04cd15b6 | 520 | supply_fpregset (&fpregs); |
d4f3574e SS |
521 | } |
522 | ||
04cd15b6 MK |
523 | /* Store all valid floating-point registers in GDB's register array |
524 | into the process/thread specified by TID. */ | |
d4f3574e | 525 | |
d4f3574e | 526 | static void |
ed9a39eb | 527 | store_fpregs (int tid) |
d4f3574e | 528 | { |
04cd15b6 | 529 | elf_fpregset_t fpregs; |
917317f4 | 530 | int ret; |
d4f3574e | 531 | |
04cd15b6 | 532 | ret = ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs); |
917317f4 | 533 | if (ret < 0) |
d4f3574e | 534 | { |
04cd15b6 | 535 | warning ("Couldn't get floating point status."); |
d4f3574e SS |
536 | return; |
537 | } | |
538 | ||
04cd15b6 | 539 | convert_to_fpregset (&fpregs, register_valid); |
d4f3574e | 540 | |
04cd15b6 | 541 | ret = ptrace (PTRACE_SETFPREGS, tid, 0, (int) &fpregs); |
917317f4 | 542 | if (ret < 0) |
d4f3574e | 543 | { |
04cd15b6 | 544 | warning ("Couldn't write floating point status."); |
d4f3574e SS |
545 | return; |
546 | } | |
d4f3574e SS |
547 | } |
548 | ||
f60300e7 MK |
549 | #else |
550 | ||
551 | static void fetch_fpregs (int tid) {} | |
552 | static void store_fpregs (int tid) {} | |
553 | ||
554 | #endif | |
555 | ||
5c44784c JM |
556 | \f |
557 | /* Transfering floating-point and SSE registers to and from GDB. */ | |
d4f3574e | 558 | |
11cf8741 JM |
559 | /* PTRACE_GETXFPREGS is a Cygnus invention, since we wrote our own |
560 | Linux kernel patch for SSE support. That patch may or may not | |
561 | actually make it into the official distribution. If you find that | |
562 | years have gone by since this code was added, and Linux isn't using | |
563 | PTRACE_GETXFPREGS, that means that our patch didn't make it, and | |
564 | you can delete this code. */ | |
565 | ||
5c44784c | 566 | #ifdef HAVE_PTRACE_GETXFPREGS |
04cd15b6 MK |
567 | |
568 | /* Fill GDB's register array with the floating-point and SSE register | |
569 | values in *XFPREGS. */ | |
570 | ||
d4f3574e | 571 | static void |
5c44784c | 572 | supply_xfpregset (struct user_xfpregs_struct *xfpregs) |
d4f3574e | 573 | { |
5c44784c | 574 | int reg; |
d4f3574e | 575 | |
5c44784c JM |
576 | /* Supply the floating-point registers. */ |
577 | for (reg = 0; reg < 8; reg++) | |
578 | supply_register (FP0_REGNUM + reg, (char *) &xfpregs->st_space[reg]); | |
579 | ||
580 | { | |
581 | supply_register (FCTRL_REGNUM, (char *) &xfpregs->cwd); | |
582 | supply_register (FSTAT_REGNUM, (char *) &xfpregs->swd); | |
583 | supply_register (FTAG_REGNUM, (char *) &xfpregs->twd); | |
584 | supply_register (FCOFF_REGNUM, (char *) &xfpregs->fip); | |
585 | supply_register (FDS_REGNUM, (char *) &xfpregs->fos); | |
586 | supply_register (FDOFF_REGNUM, (char *) &xfpregs->foo); | |
587 | ||
588 | /* Extract the code segment and opcode from the "fcs" member. */ | |
d4f3574e | 589 | { |
5c44784c JM |
590 | long l; |
591 | ||
592 | l = xfpregs->fcs & 0xffff; | |
593 | supply_register (FCS_REGNUM, (char *) &l); | |
594 | ||
595 | l = (xfpregs->fcs >> 16) & ((1 << 11) - 1); | |
596 | supply_register (FOP_REGNUM, (char *) &l); | |
d4f3574e | 597 | } |
5c44784c | 598 | } |
d4f3574e | 599 | |
5c44784c JM |
600 | /* Supply the SSE registers. */ |
601 | for (reg = 0; reg < 8; reg++) | |
602 | supply_register (XMM0_REGNUM + reg, (char *) &xfpregs->xmm_space[reg]); | |
603 | supply_register (MXCSR_REGNUM, (char *) &xfpregs->mxcsr); | |
d4f3574e SS |
604 | } |
605 | ||
04cd15b6 MK |
606 | /* Convert the valid floating-point and SSE registers in GDB's |
607 | register array to `struct user' format and store them in *XFPREGS. | |
608 | The array VALID indicates which registers are valid. If VALID is | |
609 | NULL, all registers are assumed to be valid. */ | |
d4f3574e | 610 | |
d4f3574e | 611 | static void |
5c44784c | 612 | convert_to_xfpregset (struct user_xfpregs_struct *xfpregs, |
5c44784c | 613 | signed char *valid) |
d4f3574e | 614 | { |
5c44784c | 615 | int reg; |
d4f3574e | 616 | |
5c44784c JM |
617 | /* Fill in the floating-point registers. */ |
618 | for (reg = 0; reg < 8; reg++) | |
619 | if (!valid || valid[reg]) | |
620 | memcpy (&xfpregs->st_space[reg], | |
621 | ®isters[REGISTER_BYTE (FP0_REGNUM + reg)], | |
622 | REGISTER_RAW_SIZE(FP0_REGNUM + reg)); | |
623 | ||
624 | #define fill(MEMBER, REGNO) \ | |
625 | if (! valid || valid[(REGNO)]) \ | |
626 | memcpy (&xfpregs->MEMBER, ®isters[REGISTER_BYTE (REGNO)], \ | |
627 | sizeof (xfpregs->MEMBER)) | |
628 | ||
629 | fill (cwd, FCTRL_REGNUM); | |
630 | fill (swd, FSTAT_REGNUM); | |
631 | fill (twd, FTAG_REGNUM); | |
632 | fill (fip, FCOFF_REGNUM); | |
633 | fill (foo, FDOFF_REGNUM); | |
634 | fill (fos, FDS_REGNUM); | |
635 | ||
636 | #undef fill | |
637 | ||
638 | if (! valid || valid[FCS_REGNUM]) | |
639 | xfpregs->fcs | |
640 | = ((xfpregs->fcs & ~0xffff) | |
641 | | (* (int *) ®isters[REGISTER_BYTE (FCS_REGNUM)] & 0xffff)); | |
642 | ||
643 | if (! valid || valid[FOP_REGNUM]) | |
644 | xfpregs->fcs | |
645 | = ((xfpregs->fcs & 0xffff) | |
646 | | ((*(int *) ®isters[REGISTER_BYTE (FOP_REGNUM)] & ((1 << 11) - 1)) | |
647 | << 16)); | |
648 | ||
649 | /* Fill in the XMM registers. */ | |
650 | for (reg = 0; reg < 8; reg++) | |
651 | if (! valid || valid[reg]) | |
652 | memcpy (&xfpregs->xmm_space[reg], | |
653 | ®isters[REGISTER_BYTE (XMM0_REGNUM + reg)], | |
654 | REGISTER_RAW_SIZE (XMM0_REGNUM + reg)); | |
655 | } | |
656 | ||
04cd15b6 MK |
657 | /* Fetch all registers covered by the PTRACE_SETXFPREGS request from |
658 | process/thread TID and store their values in GDB's register array. | |
659 | Return non-zero if successful, zero otherwise. */ | |
5c44784c | 660 | |
5c44784c | 661 | static int |
ed9a39eb | 662 | fetch_xfpregs (int tid) |
5c44784c | 663 | { |
5c44784c | 664 | struct user_xfpregs_struct xfpregs; |
04cd15b6 | 665 | int ret; |
5c44784c JM |
666 | |
667 | if (! have_ptrace_getxfpregs) | |
668 | return 0; | |
669 | ||
ed9a39eb | 670 | ret = ptrace (PTRACE_GETXFPREGS, tid, 0, &xfpregs); |
5c44784c | 671 | if (ret == -1) |
d4f3574e | 672 | { |
5c44784c JM |
673 | if (errno == EIO) |
674 | { | |
675 | have_ptrace_getxfpregs = 0; | |
676 | return 0; | |
677 | } | |
678 | ||
04cd15b6 | 679 | warning ("Couldn't read floating-point and SSE registers."); |
5c44784c | 680 | return 0; |
d4f3574e SS |
681 | } |
682 | ||
5c44784c JM |
683 | supply_xfpregset (&xfpregs); |
684 | return 1; | |
685 | } | |
d4f3574e | 686 | |
04cd15b6 MK |
687 | /* Store all valid registers in GDB's register array covered by the |
688 | PTRACE_SETXFPREGS request into the process/thread specified by TID. | |
689 | Return non-zero if successful, zero otherwise. */ | |
5c44784c | 690 | |
5c44784c | 691 | static int |
ed9a39eb | 692 | store_xfpregs (int tid) |
5c44784c | 693 | { |
5c44784c | 694 | struct user_xfpregs_struct xfpregs; |
04cd15b6 | 695 | int ret; |
5c44784c JM |
696 | |
697 | if (! have_ptrace_getxfpregs) | |
698 | return 0; | |
699 | ||
ed9a39eb | 700 | ret = ptrace (PTRACE_GETXFPREGS, tid, 0, &xfpregs); |
5c44784c | 701 | if (ret == -1) |
d4f3574e | 702 | { |
5c44784c JM |
703 | if (errno == EIO) |
704 | { | |
705 | have_ptrace_getxfpregs = 0; | |
706 | return 0; | |
707 | } | |
708 | ||
04cd15b6 | 709 | warning ("Couldn't read floating-point and SSE registers."); |
5c44784c JM |
710 | return 0; |
711 | } | |
712 | ||
04cd15b6 | 713 | convert_to_xfpregset (&xfpregs, register_valid); |
5c44784c | 714 | |
ed9a39eb | 715 | if (ptrace (PTRACE_SETXFPREGS, tid, 0, &xfpregs) < 0) |
5c44784c JM |
716 | { |
717 | warning ("Couldn't write floating-point and SSE registers."); | |
718 | return 0; | |
d4f3574e | 719 | } |
5c44784c JM |
720 | |
721 | return 1; | |
722 | } | |
723 | ||
04cd15b6 | 724 | /* Fill the XMM registers in the register array with dummy values. For |
5c44784c JM |
725 | cases where we don't have access to the XMM registers. I think |
726 | this is cleaner than printing a warning. For a cleaner solution, | |
727 | we should gdbarchify the i386 family. */ | |
04cd15b6 | 728 | |
5c44784c | 729 | static void |
04cd15b6 | 730 | dummy_sse_values (void) |
5c44784c JM |
731 | { |
732 | /* C doesn't have a syntax for NaN's, so write it out as an array of | |
733 | longs. */ | |
734 | static long dummy[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; | |
735 | static long mxcsr = 0x1f80; | |
736 | int reg; | |
737 | ||
738 | for (reg = 0; reg < 8; reg++) | |
739 | supply_register (XMM0_REGNUM + reg, (char *) dummy); | |
740 | supply_register (MXCSR_REGNUM, (char *) &mxcsr); | |
d4f3574e SS |
741 | } |
742 | ||
5c44784c JM |
743 | #else |
744 | ||
745 | /* Stub versions of the above routines, for systems that don't have | |
746 | PTRACE_GETXFPREGS. */ | |
ed9a39eb JM |
747 | static int store_xfpregs (int tid) { return 0; } |
748 | static int fetch_xfpregs (int tid) { return 0; } | |
04cd15b6 | 749 | static void dummy_sse_values (void) {} |
5c44784c JM |
750 | |
751 | #endif | |
752 | ||
753 | \f | |
754 | /* Transferring arbitrary registers between GDB and inferior. */ | |
d4f3574e | 755 | |
04cd15b6 MK |
756 | /* Fetch register REGNO from the child process. If REGNO is -1, do |
757 | this for all registers (including the floating point and SSE | |
758 | registers). */ | |
d4f3574e SS |
759 | |
760 | void | |
917317f4 | 761 | fetch_inferior_registers (int regno) |
d4f3574e | 762 | { |
ed9a39eb JM |
763 | int tid; |
764 | ||
f60300e7 MK |
765 | /* Use the old method of peeking around in `struct user' if the |
766 | GETREGS request isn't available. */ | |
767 | if (! have_ptrace_getregs) | |
768 | { | |
769 | old_fetch_inferior_registers (regno); | |
770 | return; | |
771 | } | |
772 | ||
04cd15b6 | 773 | /* Linux LWP ID's are process ID's. */ |
ed9a39eb | 774 | if ((tid = TIDGET (inferior_pid)) == 0) |
04cd15b6 | 775 | tid = inferior_pid; /* Not a threaded program. */ |
ed9a39eb | 776 | |
04cd15b6 MK |
777 | /* Use the PTRACE_GETXFPREGS request whenever possible, since it |
778 | transfers more registers in one system call, and we'll cache the | |
779 | results. But remember that fetch_xfpregs can fail, and return | |
780 | zero. */ | |
5c44784c JM |
781 | if (regno == -1) |
782 | { | |
ed9a39eb | 783 | fetch_regs (tid); |
f60300e7 MK |
784 | |
785 | /* The call above might reset `have_ptrace_getregs'. */ | |
786 | if (! have_ptrace_getregs) | |
787 | { | |
788 | old_fetch_inferior_registers (-1); | |
789 | return; | |
790 | } | |
791 | ||
ed9a39eb | 792 | if (fetch_xfpregs (tid)) |
5c44784c | 793 | return; |
ed9a39eb | 794 | fetch_fpregs (tid); |
5c44784c JM |
795 | return; |
796 | } | |
d4f3574e | 797 | |
5c44784c JM |
798 | if (GETREGS_SUPPLIES (regno)) |
799 | { | |
ed9a39eb | 800 | fetch_regs (tid); |
5c44784c JM |
801 | return; |
802 | } | |
803 | ||
804 | if (GETXFPREGS_SUPPLIES (regno)) | |
805 | { | |
ed9a39eb | 806 | if (fetch_xfpregs (tid)) |
5c44784c JM |
807 | return; |
808 | ||
809 | /* Either our processor or our kernel doesn't support the SSE | |
810 | registers, so read the FP registers in the traditional way, | |
811 | and fill the SSE registers with dummy values. It would be | |
812 | more graceful to handle differences in the register set using | |
813 | gdbarch. Until then, this will at least make things work | |
814 | plausibly. */ | |
ed9a39eb | 815 | fetch_fpregs (tid); |
5c44784c JM |
816 | dummy_sse_values (); |
817 | return; | |
818 | } | |
819 | ||
820 | internal_error ("i386-linux-nat.c (fetch_inferior_registers): " | |
821 | "got request for bad register number %d", regno); | |
d4f3574e SS |
822 | } |
823 | ||
04cd15b6 MK |
824 | /* Store register REGNO back into the child process. If REGNO is -1, |
825 | do this for all registers (including the floating point and SSE | |
826 | registers). */ | |
d4f3574e | 827 | void |
04cd15b6 | 828 | store_inferior_registers (int regno) |
d4f3574e | 829 | { |
ed9a39eb JM |
830 | int tid; |
831 | ||
f60300e7 MK |
832 | /* Use the old method of poking around in `struct user' if the |
833 | SETREGS request isn't available. */ | |
834 | if (! have_ptrace_getregs) | |
835 | { | |
836 | old_store_inferior_registers (regno); | |
837 | return; | |
838 | } | |
839 | ||
04cd15b6 | 840 | /* Linux LWP ID's are process ID's. */ |
ed9a39eb | 841 | if ((tid = TIDGET (inferior_pid)) == 0) |
04cd15b6 | 842 | tid = inferior_pid; /* Not a threaded program. */ |
ed9a39eb | 843 | |
04cd15b6 MK |
844 | /* Use the PTRACE_SETXFPREGS requests whenever possibl, since it |
845 | transfers more registers in one system call. But remember that | |
ed9a39eb | 846 | store_xfpregs can fail, and return zero. */ |
5c44784c JM |
847 | if (regno == -1) |
848 | { | |
ed9a39eb JM |
849 | store_regs (tid); |
850 | if (store_xfpregs (tid)) | |
5c44784c | 851 | return; |
ed9a39eb | 852 | store_fpregs (tid); |
5c44784c JM |
853 | return; |
854 | } | |
d4f3574e | 855 | |
5c44784c JM |
856 | if (GETREGS_SUPPLIES (regno)) |
857 | { | |
ed9a39eb | 858 | store_regs (tid); |
5c44784c JM |
859 | return; |
860 | } | |
861 | ||
862 | if (GETXFPREGS_SUPPLIES (regno)) | |
863 | { | |
ed9a39eb | 864 | if (store_xfpregs (tid)) |
5c44784c JM |
865 | return; |
866 | ||
867 | /* Either our processor or our kernel doesn't support the SSE | |
04cd15b6 MK |
868 | registers, so just write the FP registers in the traditional |
869 | way. */ | |
ed9a39eb | 870 | store_fpregs (tid); |
5c44784c JM |
871 | return; |
872 | } | |
873 | ||
04cd15b6 | 874 | internal_error ("Got request to store bad register number %d.", regno); |
d4f3574e SS |
875 | } |
876 | ||
de57eccd JM |
877 | \f |
878 | /* Interpreting register set info found in core files. */ | |
879 | ||
880 | /* Provide registers to GDB from a core file. | |
881 | ||
882 | (We can't use the generic version of this function in | |
883 | core-regset.c, because Linux has *three* different kinds of | |
884 | register set notes. core-regset.c would have to call | |
885 | supply_xfpregset, which most platforms don't have.) | |
886 | ||
887 | CORE_REG_SECT points to an array of bytes, which are the contents | |
888 | of a `note' from a core file which BFD thinks might contain | |
889 | register contents. CORE_REG_SIZE is its size. | |
890 | ||
891 | WHICH says which register set corelow suspects this is: | |
04cd15b6 MK |
892 | 0 --- the general-purpose register set, in elf_gregset_t format |
893 | 2 --- the floating-point register set, in elf_fpregset_t format | |
894 | 3 --- the extended floating-point register set, in struct | |
895 | user_xfpregs_struct format | |
896 | ||
897 | REG_ADDR isn't used on Linux. */ | |
de57eccd | 898 | |
de57eccd | 899 | static void |
04cd15b6 MK |
900 | fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, |
901 | int which, CORE_ADDR reg_addr) | |
de57eccd | 902 | { |
04cd15b6 MK |
903 | elf_gregset_t gregset; |
904 | elf_fpregset_t fpregset; | |
de57eccd JM |
905 | |
906 | switch (which) | |
907 | { | |
908 | case 0: | |
909 | if (core_reg_size != sizeof (gregset)) | |
04cd15b6 | 910 | warning ("Wrong size gregset in core file."); |
de57eccd JM |
911 | else |
912 | { | |
913 | memcpy (&gregset, core_reg_sect, sizeof (gregset)); | |
914 | supply_gregset (&gregset); | |
915 | } | |
916 | break; | |
917 | ||
918 | case 2: | |
919 | if (core_reg_size != sizeof (fpregset)) | |
04cd15b6 | 920 | warning ("Wrong size fpregset in core file."); |
de57eccd JM |
921 | else |
922 | { | |
923 | memcpy (&fpregset, core_reg_sect, sizeof (fpregset)); | |
924 | supply_fpregset (&fpregset); | |
925 | } | |
926 | break; | |
927 | ||
928 | #ifdef HAVE_PTRACE_GETXFPREGS | |
929 | { | |
930 | struct user_xfpregs_struct xfpregset; | |
04cd15b6 | 931 | |
de57eccd | 932 | case 3: |
04cd15b6 MK |
933 | if (core_reg_size != sizeof (xfpregset)) |
934 | warning ("Wrong size user_xfpregs_struct in core file."); | |
de57eccd JM |
935 | else |
936 | { | |
937 | memcpy (&xfpregset, core_reg_sect, sizeof (xfpregset)); | |
938 | supply_xfpregset (&xfpregset); | |
939 | } | |
940 | break; | |
941 | } | |
942 | #endif | |
943 | ||
944 | default: | |
945 | /* We've covered all the kinds of registers we know about here, | |
946 | so this must be something we wouldn't know what to do with | |
947 | anyway. Just ignore it. */ | |
948 | break; | |
949 | } | |
950 | } | |
951 | ||
5c44784c JM |
952 | \f |
953 | /* Calling functions in shared libraries. */ | |
04cd15b6 MK |
954 | /* FIXME: kettenis/2000-03-05: Doesn't this belong in a |
955 | target-dependent file? The function | |
956 | `i386_linux_skip_solib_resolver' is mentioned in | |
957 | `config/i386/tm-linux.h'. */ | |
5c44784c | 958 | |
d4f3574e SS |
959 | /* Find the minimal symbol named NAME, and return both the minsym |
960 | struct and its objfile. This probably ought to be in minsym.c, but | |
961 | everything there is trying to deal with things like C++ and | |
962 | SOFUN_ADDRESS_MAYBE_TURQUOISE, ... Since this is so simple, it may | |
963 | be considered too special-purpose for general consumption. */ | |
964 | ||
965 | static struct minimal_symbol * | |
966 | find_minsym_and_objfile (char *name, struct objfile **objfile_p) | |
967 | { | |
968 | struct objfile *objfile; | |
969 | ||
970 | ALL_OBJFILES (objfile) | |
971 | { | |
972 | struct minimal_symbol *msym; | |
973 | ||
974 | ALL_OBJFILE_MSYMBOLS (objfile, msym) | |
975 | { | |
976 | if (SYMBOL_NAME (msym) | |
977 | && STREQ (SYMBOL_NAME (msym), name)) | |
978 | { | |
979 | *objfile_p = objfile; | |
980 | return msym; | |
981 | } | |
982 | } | |
983 | } | |
984 | ||
985 | return 0; | |
986 | } | |
987 | ||
988 | ||
989 | static CORE_ADDR | |
990 | skip_hurd_resolver (CORE_ADDR pc) | |
991 | { | |
992 | /* The HURD dynamic linker is part of the GNU C library, so many | |
993 | GNU/Linux distributions use it. (All ELF versions, as far as I | |
994 | know.) An unresolved PLT entry points to "_dl_runtime_resolve", | |
995 | which calls "fixup" to patch the PLT, and then passes control to | |
996 | the function. | |
997 | ||
998 | We look for the symbol `_dl_runtime_resolve', and find `fixup' in | |
999 | the same objfile. If we are at the entry point of `fixup', then | |
1000 | we set a breakpoint at the return address (at the top of the | |
1001 | stack), and continue. | |
1002 | ||
1003 | It's kind of gross to do all these checks every time we're | |
1004 | called, since they don't change once the executable has gotten | |
1005 | started. But this is only a temporary hack --- upcoming versions | |
1006 | of Linux will provide a portable, efficient interface for | |
1007 | debugging programs that use shared libraries. */ | |
1008 | ||
1009 | struct objfile *objfile; | |
1010 | struct minimal_symbol *resolver | |
1011 | = find_minsym_and_objfile ("_dl_runtime_resolve", &objfile); | |
1012 | ||
1013 | if (resolver) | |
1014 | { | |
1015 | struct minimal_symbol *fixup | |
1016 | = lookup_minimal_symbol ("fixup", 0, objfile); | |
1017 | ||
1018 | if (fixup && SYMBOL_VALUE_ADDRESS (fixup) == pc) | |
1019 | return (SAVED_PC_AFTER_CALL (get_current_frame ())); | |
1020 | } | |
1021 | ||
1022 | return 0; | |
1023 | } | |
1024 | ||
d4f3574e SS |
1025 | /* See the comments for SKIP_SOLIB_RESOLVER at the top of infrun.c. |
1026 | This function: | |
1027 | 1) decides whether a PLT has sent us into the linker to resolve | |
1028 | a function reference, and | |
1029 | 2) if so, tells us where to set a temporary breakpoint that will | |
1030 | trigger when the dynamic linker is done. */ | |
1031 | ||
1032 | CORE_ADDR | |
1033 | i386_linux_skip_solib_resolver (CORE_ADDR pc) | |
1034 | { | |
1035 | CORE_ADDR result; | |
1036 | ||
1037 | /* Plug in functions for other kinds of resolvers here. */ | |
1038 | result = skip_hurd_resolver (pc); | |
1039 | if (result) | |
1040 | return result; | |
1041 | ||
1042 | return 0; | |
1043 | } | |
de57eccd | 1044 | |
de57eccd | 1045 | \f |
04cd15b6 MK |
1046 | /* Register that we are able to handle Linux ELF core file formats. */ |
1047 | ||
1048 | static struct core_fns linux_elf_core_fns = | |
1049 | { | |
1050 | bfd_target_elf_flavour, /* core_flavour */ | |
1051 | default_check_format, /* check_format */ | |
1052 | default_core_sniffer, /* core_sniffer */ | |
1053 | fetch_core_registers, /* core_read_registers */ | |
1054 | NULL /* next */ | |
1055 | }; | |
de57eccd JM |
1056 | |
1057 | void | |
1058 | _initialize_i386_linux_nat () | |
1059 | { | |
04cd15b6 | 1060 | add_core_fns (&linux_elf_core_fns); |
de57eccd | 1061 | } |