1 /* Native-dependent code for Linux/x86.
2 Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
26 #include "gdb_assert.h"
27 #include <sys/ptrace.h>
29 #include <sys/procfs.h>
35 #ifdef HAVE_SYS_DEBUGREG_H
36 #include <sys/debugreg.h>
40 #define DR_FIRSTADDR 0
55 /* Prototypes for supply_gregset etc. */
58 /* Prototypes for i387_supply_fsave etc. */
61 /* Prototypes for local functions. */
62 static void dummy_sse_values (void);
66 /* The register sets used in Linux ELF core-dumps are identical to the
67 register sets in `struct user' that is used for a.out core-dumps,
68 and is also used by `ptrace'. The corresponding types are
69 `elf_gregset_t' for the general-purpose registers (with
70 `elf_greg_t' the type of a single GP register) and `elf_fpregset_t'
71 for the floating-point registers.
73 Those types used to be available under the names `gregset_t' and
74 `fpregset_t' too, and this file used those names in the past. But
75 those names are now used for the register sets used in the
76 `mcontext_t' type, and have a different size and layout. */
78 /* Mapping between the general-purpose registers in `struct user'
79 format and GDB's register array layout. */
88 /* Which ptrace request retrieves which registers?
89 These apply to the corresponding SET requests as well. */
90 #define GETREGS_SUPPLIES(regno) \
91 ((0 <= (regno) && (regno) <= 15) || (regno) == I386_LINUX_ORIG_EAX_REGNUM)
92 #define GETFPREGS_SUPPLIES(regno) \
93 (FP0_REGNUM <= (regno) && (regno) <= LAST_FPU_CTRL_REGNUM)
94 #define GETFPXREGS_SUPPLIES(regno) \
95 (FP0_REGNUM <= (regno) && (regno) <= MXCSR_REGNUM)
97 /* Does the current host support the GETREGS request? */
98 int have_ptrace_getregs
=
99 #ifdef HAVE_PTRACE_GETREGS
106 /* Does the current host support the GETFPXREGS request? The header
107 file may or may not define it, and even if it is defined, the
108 kernel will return EIO if it's running on a pre-SSE processor.
110 My instinct is to attach this to some architecture- or
111 target-specific data structure, but really, a particular GDB
112 process can only run on top of one kernel at a time. So it's okay
113 for this to be a simple variable. */
114 int have_ptrace_getfpxregs
=
115 #ifdef HAVE_PTRACE_GETFPXREGS
123 /* Support for the user struct. */
125 /* Return the address of register REGNUM. BLOCKEND is the value of
126 u.u_ar0, which should point to the registers. */
129 register_u_addr (CORE_ADDR blockend
, int regnum
)
131 return (blockend
+ 4 * regmap
[regnum
]);
134 /* Return the size of the user struct. */
139 return (sizeof (struct user
));
143 /* Fetching registers directly from the U area, one at a time. */
145 /* FIXME: kettenis/2000-03-05: This duplicates code from `inptrace.c'.
146 The problem is that we define FETCH_INFERIOR_REGISTERS since we
147 want to use our own versions of {fetch,store}_inferior_registers
148 that use the GETREGS request. This means that the code in
149 `infptrace.c' is #ifdef'd out. But we need to fall back on that
150 code when GDB is running on top of a kernel that doesn't support
151 the GETREGS request. I want to avoid changing `infptrace.c' right
155 #define PT_READ_U PTRACE_PEEKUSR
158 #define PT_WRITE_U PTRACE_POKEUSR
161 /* Default the type of the ptrace transfer to int. */
162 #ifndef PTRACE_XFER_TYPE
163 #define PTRACE_XFER_TYPE int
166 /* Registers we shouldn't try to fetch. */
167 #define OLD_CANNOT_FETCH_REGISTER(regno) ((regno) >= NUM_GREGS)
169 /* Fetch one register. */
172 fetch_register (int regno
)
174 /* This isn't really an address. But ptrace thinks of it as one. */
176 char mess
[128]; /* For messages */
178 unsigned int offset
; /* Offset of registers within the u area. */
179 char buf
[MAX_REGISTER_RAW_SIZE
];
182 if (OLD_CANNOT_FETCH_REGISTER (regno
))
184 memset (buf
, '\0', REGISTER_RAW_SIZE (regno
)); /* Supply zeroes */
185 supply_register (regno
, buf
);
189 /* Overload thread id onto process id */
190 if ((tid
= TIDGET (inferior_ptid
)) == 0)
191 tid
= PIDGET (inferior_ptid
); /* no thread id, just use process id */
193 offset
= U_REGS_OFFSET
;
195 regaddr
= register_addr (regno
, offset
);
196 for (i
= 0; i
< REGISTER_RAW_SIZE (regno
); i
+= sizeof (PTRACE_XFER_TYPE
))
199 *(PTRACE_XFER_TYPE
*) & buf
[i
] = ptrace (PT_READ_U
, tid
,
200 (PTRACE_ARG3_TYPE
) regaddr
, 0);
201 regaddr
+= sizeof (PTRACE_XFER_TYPE
);
204 sprintf (mess
, "reading register %s (#%d)",
205 REGISTER_NAME (regno
), regno
);
206 perror_with_name (mess
);
209 supply_register (regno
, buf
);
212 /* Fetch register values from the inferior.
213 If REGNO is negative, do this for all registers.
214 Otherwise, REGNO specifies which register (so we can save time). */
217 old_fetch_inferior_registers (int regno
)
221 fetch_register (regno
);
225 for (regno
= 0; regno
< NUM_REGS
; regno
++)
227 fetch_register (regno
);
232 /* Registers we shouldn't try to store. */
233 #define OLD_CANNOT_STORE_REGISTER(regno) ((regno) >= NUM_GREGS)
235 /* Store one register. */
238 store_register (int regno
)
240 /* This isn't really an address. But ptrace thinks of it as one. */
242 char mess
[128]; /* For messages */
244 unsigned int offset
; /* Offset of registers within the u area. */
247 if (OLD_CANNOT_STORE_REGISTER (regno
))
252 /* Overload thread id onto process id */
253 if ((tid
= TIDGET (inferior_ptid
)) == 0)
254 tid
= PIDGET (inferior_ptid
); /* no thread id, just use process id */
256 offset
= U_REGS_OFFSET
;
258 regaddr
= register_addr (regno
, offset
);
259 for (i
= 0; i
< REGISTER_RAW_SIZE (regno
); i
+= sizeof (PTRACE_XFER_TYPE
))
262 ptrace (PT_WRITE_U
, tid
, (PTRACE_ARG3_TYPE
) regaddr
,
263 *(PTRACE_XFER_TYPE
*) & registers
[REGISTER_BYTE (regno
) + i
]);
264 regaddr
+= sizeof (PTRACE_XFER_TYPE
);
267 sprintf (mess
, "writing register %s (#%d)",
268 REGISTER_NAME (regno
), regno
);
269 perror_with_name (mess
);
274 /* Store our register values back into the inferior.
275 If REGNO is negative, do this for all registers.
276 Otherwise, REGNO specifies which register (so we can save time). */
279 old_store_inferior_registers (int regno
)
283 store_register (regno
);
287 for (regno
= 0; regno
< NUM_REGS
; regno
++)
289 store_register (regno
);
295 /* Transfering the general-purpose registers between GDB, inferiors
298 /* Fill GDB's register array with the general-purpose register values
302 supply_gregset (elf_gregset_t
*gregsetp
)
304 elf_greg_t
*regp
= (elf_greg_t
*) gregsetp
;
307 for (i
= 0; i
< NUM_GREGS
; i
++)
308 supply_register (i
, (char *) (regp
+ regmap
[i
]));
310 supply_register (I386_LINUX_ORIG_EAX_REGNUM
, (char *) (regp
+ ORIG_EAX
));
313 /* Fill register REGNO (if it is a general-purpose register) in
314 *GREGSETPS with the value in GDB's register array. If REGNO is -1,
315 do this for all registers. */
318 fill_gregset (elf_gregset_t
*gregsetp
, int regno
)
320 elf_greg_t
*regp
= (elf_greg_t
*) gregsetp
;
323 for (i
= 0; i
< NUM_GREGS
; i
++)
324 if ((regno
== -1 || regno
== i
))
325 regcache_collect (i
, regp
+ regmap
[i
]);
327 if (regno
== -1 || regno
== I386_LINUX_ORIG_EAX_REGNUM
)
328 regcache_collect (I386_LINUX_ORIG_EAX_REGNUM
, regp
+ regmap
[ORIG_EAX
]);
331 #ifdef HAVE_PTRACE_GETREGS
333 /* Fetch all general-purpose registers from process/thread TID and
334 store their values in GDB's register array. */
341 if (ptrace (PTRACE_GETREGS
, tid
, 0, (int) ®s
) < 0)
345 /* The kernel we're running on doesn't support the GETREGS
346 request. Reset `have_ptrace_getregs'. */
347 have_ptrace_getregs
= 0;
351 perror_with_name ("Couldn't get registers");
354 supply_gregset (®s
);
357 /* Store all valid general-purpose registers in GDB's register array
358 into the process/thread specified by TID. */
361 store_regs (int tid
, int regno
)
365 if (ptrace (PTRACE_GETREGS
, tid
, 0, (int) ®s
) < 0)
366 perror_with_name ("Couldn't get registers");
368 fill_gregset (®s
, regno
);
370 if (ptrace (PTRACE_SETREGS
, tid
, 0, (int) ®s
) < 0)
371 perror_with_name ("Couldn't write registers");
376 static void fetch_regs (int tid
) {}
377 static void store_regs (int tid
, int regno
) {}
382 /* Transfering floating-point registers between GDB, inferiors and cores. */
384 /* Fill GDB's register array with the floating-point register values in
388 supply_fpregset (elf_fpregset_t
*fpregsetp
)
390 i387_supply_fsave ((char *) fpregsetp
);
394 /* Fill register REGNO (if it is a floating-point register) in
395 *FPREGSETP with the value in GDB's register array. If REGNO is -1,
396 do this for all registers. */
399 fill_fpregset (elf_fpregset_t
*fpregsetp
, int regno
)
401 i387_fill_fsave ((char *) fpregsetp
, regno
);
404 #ifdef HAVE_PTRACE_GETREGS
406 /* Fetch all floating-point registers from process/thread TID and store
407 thier values in GDB's register array. */
410 fetch_fpregs (int tid
)
412 elf_fpregset_t fpregs
;
414 if (ptrace (PTRACE_GETFPREGS
, tid
, 0, (int) &fpregs
) < 0)
415 perror_with_name ("Couldn't get floating point status");
417 supply_fpregset (&fpregs
);
420 /* Store all valid floating-point registers in GDB's register array
421 into the process/thread specified by TID. */
424 store_fpregs (int tid
, int regno
)
426 elf_fpregset_t fpregs
;
428 if (ptrace (PTRACE_GETFPREGS
, tid
, 0, (int) &fpregs
) < 0)
429 perror_with_name ("Couldn't get floating point status");
431 fill_fpregset (&fpregs
, regno
);
433 if (ptrace (PTRACE_SETFPREGS
, tid
, 0, (int) &fpregs
) < 0)
434 perror_with_name ("Couldn't write floating point status");
439 static void fetch_fpregs (int tid
) {}
440 static void store_fpregs (int tid
, int regno
) {}
445 /* Transfering floating-point and SSE registers to and from GDB. */
447 #ifdef HAVE_PTRACE_GETFPXREGS
449 /* Fill GDB's register array with the floating-point and SSE register
450 values in *FPXREGSETP. */
453 supply_fpxregset (elf_fpxregset_t
*fpxregsetp
)
455 i387_supply_fxsave ((char *) fpxregsetp
);
458 /* Fill register REGNO (if it is a floating-point or SSE register) in
459 *FPXREGSETP with the value in GDB's register array. If REGNO is
460 -1, do this for all registers. */
463 fill_fpxregset (elf_fpxregset_t
*fpxregsetp
, int regno
)
465 i387_fill_fxsave ((char *) fpxregsetp
, regno
);
468 /* Fetch all registers covered by the PTRACE_GETFPXREGS request from
469 process/thread TID and store their values in GDB's register array.
470 Return non-zero if successful, zero otherwise. */
473 fetch_fpxregs (int tid
)
475 elf_fpxregset_t fpxregs
;
477 if (! have_ptrace_getfpxregs
)
480 if (ptrace (PTRACE_GETFPXREGS
, tid
, 0, (int) &fpxregs
) < 0)
484 have_ptrace_getfpxregs
= 0;
488 perror_with_name ("Couldn't read floating-point and SSE registers");
491 supply_fpxregset (&fpxregs
);
495 /* Store all valid registers in GDB's register array covered by the
496 PTRACE_SETFPXREGS request into the process/thread specified by TID.
497 Return non-zero if successful, zero otherwise. */
500 store_fpxregs (int tid
, int regno
)
502 elf_fpxregset_t fpxregs
;
504 if (! have_ptrace_getfpxregs
)
507 if (ptrace (PTRACE_GETFPXREGS
, tid
, 0, &fpxregs
) == -1)
511 have_ptrace_getfpxregs
= 0;
515 perror_with_name ("Couldn't read floating-point and SSE registers");
518 fill_fpxregset (&fpxregs
, regno
);
520 if (ptrace (PTRACE_SETFPXREGS
, tid
, 0, &fpxregs
) == -1)
521 perror_with_name ("Couldn't write floating-point and SSE registers");
526 /* Fill the XMM registers in the register array with dummy values. For
527 cases where we don't have access to the XMM registers. I think
528 this is cleaner than printing a warning. For a cleaner solution,
529 we should gdbarchify the i386 family. */
532 dummy_sse_values (void)
534 /* C doesn't have a syntax for NaN's, so write it out as an array of
536 static long dummy
[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff };
537 static long mxcsr
= 0x1f80;
540 for (reg
= 0; reg
< 8; reg
++)
541 supply_register (XMM0_REGNUM
+ reg
, (char *) dummy
);
542 supply_register (MXCSR_REGNUM
, (char *) &mxcsr
);
547 static int fetch_fpxregs (int tid
) { return 0; }
548 static int store_fpxregs (int tid
, int regno
) { return 0; }
549 static void dummy_sse_values (void) {}
551 #endif /* HAVE_PTRACE_GETFPXREGS */
554 /* Transferring arbitrary registers between GDB and inferior. */
556 /* Check if register REGNO in the child process is accessible.
557 If we are accessing registers directly via the U area, only the
558 general-purpose registers are available.
559 All registers should be accessible if we have GETREGS support. */
562 cannot_fetch_register (int regno
)
564 if (! have_ptrace_getregs
)
565 return OLD_CANNOT_FETCH_REGISTER (regno
);
569 cannot_store_register (int regno
)
571 if (! have_ptrace_getregs
)
572 return OLD_CANNOT_STORE_REGISTER (regno
);
576 /* Fetch register REGNO from the child process. If REGNO is -1, do
577 this for all registers (including the floating point and SSE
581 fetch_inferior_registers (int regno
)
585 /* Use the old method of peeking around in `struct user' if the
586 GETREGS request isn't available. */
587 if (! have_ptrace_getregs
)
589 old_fetch_inferior_registers (regno
);
593 /* Linux LWP ID's are process ID's. */
594 if ((tid
= TIDGET (inferior_ptid
)) == 0)
595 tid
= PIDGET (inferior_ptid
); /* Not a threaded program. */
597 /* Use the PTRACE_GETFPXREGS request whenever possible, since it
598 transfers more registers in one system call, and we'll cache the
599 results. But remember that fetch_fpxregs can fail, and return
605 /* The call above might reset `have_ptrace_getregs'. */
606 if (! have_ptrace_getregs
)
608 old_fetch_inferior_registers (-1);
612 if (fetch_fpxregs (tid
))
618 if (GETREGS_SUPPLIES (regno
))
624 if (GETFPXREGS_SUPPLIES (regno
))
626 if (fetch_fpxregs (tid
))
629 /* Either our processor or our kernel doesn't support the SSE
630 registers, so read the FP registers in the traditional way,
631 and fill the SSE registers with dummy values. It would be
632 more graceful to handle differences in the register set using
633 gdbarch. Until then, this will at least make things work
639 internal_error (__FILE__
, __LINE__
,
640 "Got request for bad register number %d.", regno
);
643 /* Store register REGNO back into the child process. If REGNO is -1,
644 do this for all registers (including the floating point and SSE
647 store_inferior_registers (int regno
)
651 /* Use the old method of poking around in `struct user' if the
652 SETREGS request isn't available. */
653 if (! have_ptrace_getregs
)
655 old_store_inferior_registers (regno
);
659 /* Linux LWP ID's are process ID's. */
660 if ((tid
= TIDGET (inferior_ptid
)) == 0)
661 tid
= PIDGET (inferior_ptid
); /* Not a threaded program. */
663 /* Use the PTRACE_SETFPXREGS requests whenever possible, since it
664 transfers more registers in one system call. But remember that
665 store_fpxregs can fail, and return zero. */
668 store_regs (tid
, regno
);
669 if (store_fpxregs (tid
, regno
))
671 store_fpregs (tid
, regno
);
675 if (GETREGS_SUPPLIES (regno
))
677 store_regs (tid
, regno
);
681 if (GETFPXREGS_SUPPLIES (regno
))
683 if (store_fpxregs (tid
, regno
))
686 /* Either our processor or our kernel doesn't support the SSE
687 registers, so just write the FP registers in the traditional
689 store_fpregs (tid
, regno
);
693 internal_error (__FILE__
, __LINE__
,
694 "Got request to store bad register number %d.", regno
);
699 i386_linux_dr_get (int regnum
)
704 /* FIXME: kettenis/2001-01-29: It's not clear what we should do with
705 multi-threaded processes here. For now, pretend there is just
707 tid
= PIDGET (inferior_ptid
);
709 /* FIXME: kettenis/2001-03-27: Calling perror_with_name if the
710 ptrace call fails breaks debugging remote targets. The correct
711 way to fix this is to add the hardware breakpoint and watchpoint
712 stuff to the target vectore. For now, just return zero if the
713 ptrace call fails. */
715 value
= ptrace (PT_READ_U
, tid
,
716 offsetof (struct user
, u_debugreg
[regnum
]), 0);
719 perror_with_name ("Couldn't read debug register");
728 i386_linux_dr_set (int regnum
, unsigned long value
)
732 /* FIXME: kettenis/2001-01-29: It's not clear what we should do with
733 multi-threaded processes here. For now, pretend there is just
735 tid
= PIDGET (inferior_ptid
);
738 ptrace (PT_WRITE_U
, tid
,
739 offsetof (struct user
, u_debugreg
[regnum
]), value
);
741 perror_with_name ("Couldn't write debug register");
745 i386_linux_dr_set_control (unsigned long control
)
747 i386_linux_dr_set (DR_CONTROL
, control
);
751 i386_linux_dr_set_addr (int regnum
, CORE_ADDR addr
)
753 gdb_assert (regnum
>= 0 && regnum
<= DR_LASTADDR
- DR_FIRSTADDR
);
755 i386_linux_dr_set (DR_FIRSTADDR
+ regnum
, addr
);
759 i386_linux_dr_reset_addr (int regnum
)
761 gdb_assert (regnum
>= 0 && regnum
<= DR_LASTADDR
- DR_FIRSTADDR
);
763 i386_linux_dr_set (DR_FIRSTADDR
+ regnum
, 0L);
767 i386_linux_dr_get_status (void)
769 return i386_linux_dr_get (DR_STATUS
);
773 /* Interpreting register set info found in core files. */
775 /* Provide registers to GDB from a core file.
777 (We can't use the generic version of this function in
778 core-regset.c, because Linux has *three* different kinds of
779 register set notes. core-regset.c would have to call
780 supply_fpxregset, which most platforms don't have.)
782 CORE_REG_SECT points to an array of bytes, which are the contents
783 of a `note' from a core file which BFD thinks might contain
784 register contents. CORE_REG_SIZE is its size.
786 WHICH says which register set corelow suspects this is:
787 0 --- the general-purpose register set, in elf_gregset_t format
788 2 --- the floating-point register set, in elf_fpregset_t format
789 3 --- the extended floating-point register set, in elf_fpxregset_t format
791 REG_ADDR isn't used on Linux. */
794 fetch_core_registers (char *core_reg_sect
, unsigned core_reg_size
,
795 int which
, CORE_ADDR reg_addr
)
797 elf_gregset_t gregset
;
798 elf_fpregset_t fpregset
;
803 if (core_reg_size
!= sizeof (gregset
))
804 warning ("Wrong size gregset in core file.");
807 memcpy (&gregset
, core_reg_sect
, sizeof (gregset
));
808 supply_gregset (&gregset
);
813 if (core_reg_size
!= sizeof (fpregset
))
814 warning ("Wrong size fpregset in core file.");
817 memcpy (&fpregset
, core_reg_sect
, sizeof (fpregset
));
818 supply_fpregset (&fpregset
);
822 #ifdef HAVE_PTRACE_GETFPXREGS
824 elf_fpxregset_t fpxregset
;
827 if (core_reg_size
!= sizeof (fpxregset
))
828 warning ("Wrong size fpxregset in core file.");
831 memcpy (&fpxregset
, core_reg_sect
, sizeof (fpxregset
));
832 supply_fpxregset (&fpxregset
);
839 /* We've covered all the kinds of registers we know about here,
840 so this must be something we wouldn't know what to do with
841 anyway. Just ignore it. */
847 /* The instruction for a Linux system call is:
851 static const unsigned char linux_syscall
[] = { 0xcd, 0x80 };
853 #define LINUX_SYSCALL_LEN (sizeof linux_syscall)
855 /* The system call number is stored in the %eax register. */
856 #define LINUX_SYSCALL_REGNUM 0 /* %eax */
858 /* We are specifically interested in the sigreturn and rt_sigreturn
861 #ifndef SYS_sigreturn
862 #define SYS_sigreturn 0x77
864 #ifndef SYS_rt_sigreturn
865 #define SYS_rt_sigreturn 0xad
868 /* Offset to saved processor flags, from <asm/sigcontext.h>. */
869 #define LINUX_SIGCONTEXT_EFLAGS_OFFSET (64)
871 /* Resume execution of the inferior process.
872 If STEP is nonzero, single-step it.
873 If SIGNAL is nonzero, give it that signal. */
876 child_resume (ptid_t ptid
, int step
, enum target_signal signal
)
878 int pid
= PIDGET (ptid
);
880 int request
= PTRACE_CONT
;
883 /* Resume all threads. */
884 /* I think this only gets used in the non-threaded case, where "resume
885 all threads" and "resume inferior_ptid" are the same. */
886 pid
= PIDGET (inferior_ptid
);
890 CORE_ADDR pc
= read_pc_pid (pid_to_ptid (pid
));
891 unsigned char buf
[LINUX_SYSCALL_LEN
];
893 request
= PTRACE_SINGLESTEP
;
895 /* Returning from a signal trampoline is done by calling a
896 special system call (sigreturn or rt_sigreturn, see
897 i386-linux-tdep.c for more information). This system call
898 restores the registers that were saved when the signal was
899 raised, including %eflags. That means that single-stepping
900 won't work. Instead, we'll have to modify the signal context
901 that's about to be restored, and set the trace flag there. */
903 /* First check if PC is at a system call. */
904 if (read_memory_nobpt (pc
, (char *) buf
, LINUX_SYSCALL_LEN
) == 0
905 && memcmp (buf
, linux_syscall
, LINUX_SYSCALL_LEN
) == 0)
907 int syscall
= read_register_pid (LINUX_SYSCALL_REGNUM
,
910 /* Then check the system call number. */
911 if (syscall
== SYS_sigreturn
|| syscall
== SYS_rt_sigreturn
)
913 CORE_ADDR sp
= read_register (SP_REGNUM
);
915 unsigned long int eflags
;
917 if (syscall
== SYS_rt_sigreturn
)
918 addr
= read_memory_integer (sp
+ 8, 4) + 20;
920 /* Set the trace flag in the context that's about to be
922 addr
+= LINUX_SIGCONTEXT_EFLAGS_OFFSET
;
923 read_memory (addr
, (char *) &eflags
, 4);
925 write_memory (addr
, (char *) &eflags
, 4);
930 if (ptrace (request
, pid
, 0, target_signal_to_host (signal
)) == -1)
931 perror_with_name ("ptrace");
935 /* Register that we are able to handle Linux ELF core file formats. */
937 static struct core_fns linux_elf_core_fns
=
939 bfd_target_elf_flavour
, /* core_flavour */
940 default_check_format
, /* check_format */
941 default_core_sniffer
, /* core_sniffer */
942 fetch_core_registers
, /* core_read_registers */
947 _initialize_i386_linux_nat (void)
949 add_core_fns (&linux_elf_core_fns
);