1 // OBSOLETE /* Native dependent code for Mach 386's for GDB, the GNU debugger.
2 // OBSOLETE Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1995, 1996, 1999, 2000,
3 // OBSOLETE 2001 Free Software Foundation, Inc.
5 // OBSOLETE This file is part of GDB.
7 // OBSOLETE This program is free software; you can redistribute it and/or modify
8 // OBSOLETE it under the terms of the GNU General Public License as published by
9 // OBSOLETE the Free Software Foundation; either version 2 of the License, or
10 // OBSOLETE (at your option) any later version.
12 // OBSOLETE This program is distributed in the hope that it will be useful,
13 // OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // OBSOLETE GNU General Public License for more details.
17 // OBSOLETE You should have received a copy of the GNU General Public License
18 // OBSOLETE along with this program; if not, write to the Free Software
19 // OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
20 // OBSOLETE Boston, MA 02111-1307, USA. */
22 // OBSOLETE #include "defs.h"
23 // OBSOLETE #include "frame.h"
24 // OBSOLETE #include "inferior.h"
25 // OBSOLETE #include "gdbcore.h"
26 // OBSOLETE #include "regcache.h"
28 // OBSOLETE #include <sys/param.h>
29 // OBSOLETE #include <sys/dir.h>
30 // OBSOLETE #include <sys/user.h>
31 // OBSOLETE #include <signal.h>
32 // OBSOLETE #include <sys/ioctl.h>
33 // OBSOLETE #include <fcntl.h>
35 // OBSOLETE #include <sys/ptrace.h>
36 // OBSOLETE #include <machine/reg.h>
38 // OBSOLETE #include <sys/file.h>
39 // OBSOLETE #include "gdb_stat.h"
40 // OBSOLETE #include <sys/core.h>
42 // OBSOLETE static void fetch_core_registers (char *, unsigned, int, CORE_ADDR);
45 // OBSOLETE fetch_inferior_registers (int regno)
47 // OBSOLETE struct regs inferior_registers;
48 // OBSOLETE struct fp_state inferior_fp_registers;
50 // OBSOLETE registers_fetched ();
52 // OBSOLETE ptrace (PTRACE_GETREGS, PIDGET (inferior_ptid),
53 // OBSOLETE (PTRACE_ARG3_TYPE) & inferior_registers);
54 // OBSOLETE ptrace (PTRACE_GETFPREGS, PIDGET (inferior_ptid),
55 // OBSOLETE (PTRACE_ARG3_TYPE) & inferior_fp_registers);
57 // OBSOLETE memcpy (registers, &inferior_registers, sizeof inferior_registers);
59 // OBSOLETE memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)],
60 // OBSOLETE inferior_fp_registers.f_st,
61 // OBSOLETE sizeof inferior_fp_registers.f_st);
62 // OBSOLETE memcpy (®isters[REGISTER_BYTE (FPC_REGNUM)],
63 // OBSOLETE &inferior_fp_registers.f_ctrl,
64 // OBSOLETE sizeof inferior_fp_registers - sizeof inferior_fp_registers.f_st);
67 // OBSOLETE /* Store our register values back into the inferior.
68 // OBSOLETE If REGNO is -1, do this for all registers.
69 // OBSOLETE Otherwise, REGNO specifies which register (so we can save time). */
72 // OBSOLETE store_inferior_registers (int regno)
74 // OBSOLETE struct regs inferior_registers;
75 // OBSOLETE struct fp_state inferior_fp_registers;
77 // OBSOLETE memcpy (&inferior_registers, registers, 20 * 4);
79 // OBSOLETE memcpy (inferior_fp_registers.f_st, ®isters[REGISTER_BYTE (FP0_REGNUM)],
80 // OBSOLETE sizeof inferior_fp_registers.f_st);
81 // OBSOLETE memcpy (&inferior_fp_registers.f_ctrl,
82 // OBSOLETE ®isters[REGISTER_BYTE (FPC_REGNUM)],
83 // OBSOLETE sizeof inferior_fp_registers - sizeof inferior_fp_registers.f_st);
85 // OBSOLETE #ifdef PTRACE_FP_BUG
86 // OBSOLETE if (regno == FP_REGNUM || regno == -1)
87 // OBSOLETE /* Storing the frame pointer requires a gross hack, in which an
88 // OBSOLETE instruction that moves eax into ebp gets single-stepped. */
90 // OBSOLETE int stack = inferior_registers.r_reg[SP_REGNUM];
91 // OBSOLETE int stuff = ptrace (PTRACE_PEEKDATA, PIDGET (inferior_ptid),
92 // OBSOLETE (PTRACE_ARG3_TYPE) stack);
93 // OBSOLETE int reg = inferior_registers.r_reg[EAX];
94 // OBSOLETE inferior_registers.r_reg[EAX] =
95 // OBSOLETE inferior_registers.r_reg[FP_REGNUM];
96 // OBSOLETE ptrace (PTRACE_SETREGS, PIDGET (inferior_ptid),
97 // OBSOLETE (PTRACE_ARG3_TYPE) & inferior_registers);
98 // OBSOLETE ptrace (PTRACE_POKEDATA, PIDGET (inferior_ptid),
99 // OBSOLETE (PTRACE_ARG3_TYPE) stack, 0xc589);
100 // OBSOLETE ptrace (PTRACE_SINGLESTEP, PIDGET (inferior_ptid),
101 // OBSOLETE (PTRACE_ARG3_TYPE) stack, 0);
102 // OBSOLETE wait (0);
103 // OBSOLETE ptrace (PTRACE_POKEDATA, PIDGET (inferior_ptid),
104 // OBSOLETE (PTRACE_ARG3_TYPE) stack, stuff);
105 // OBSOLETE inferior_registers.r_reg[EAX] = reg;
108 // OBSOLETE ptrace (PTRACE_SETREGS, PIDGET (inferior_ptid),
109 // OBSOLETE (PTRACE_ARG3_TYPE) & inferior_registers);
110 // OBSOLETE ptrace (PTRACE_SETFPREGS, PIDGET (inferior_ptid),
111 // OBSOLETE (PTRACE_ARG3_TYPE) & inferior_fp_registers);
116 // OBSOLETE /* Provide registers to GDB from a core file.
118 // OBSOLETE CORE_REG_SECT points to an array of bytes, which were obtained from
119 // OBSOLETE a core file which BFD thinks might contain register contents.
120 // OBSOLETE CORE_REG_SIZE is its size.
122 // OBSOLETE WHICH says which register set corelow suspects this is:
123 // OBSOLETE 0 --- the general-purpose register set
124 // OBSOLETE 2 --- the floating-point register set
126 // OBSOLETE REG_ADDR isn't used. */
128 // OBSOLETE static void
129 // OBSOLETE fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
130 // OBSOLETE int which, CORE_ADDR reg_addr)
134 // OBSOLETE switch (which)
138 // OBSOLETE memcpy (registers, core_reg_sect, core_reg_size);
142 // OBSOLETE memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)],
143 // OBSOLETE core_reg_sect,
144 // OBSOLETE core_reg_size); /* FIXME, probably bogus */
145 // OBSOLETE #ifdef FPC_REGNUM
146 // OBSOLETE memcpy (®isters[REGISTER_BYTE (FPC_REGNUM)],
147 // OBSOLETE &corestr.c_fpu.f_fpstatus.f_ctrl,
148 // OBSOLETE sizeof corestr.c_fpu.f_fpstatus -
149 // OBSOLETE sizeof corestr.c_fpu.f_fpstatus.f_st);
156 // OBSOLETE /* Register that we are able to handle i386mach core file formats.
157 // OBSOLETE FIXME: is this really bfd_target_unknown_flavour? */
159 // OBSOLETE static struct core_fns i386mach_core_fns =
161 // OBSOLETE bfd_target_unknown_flavour, /* core_flavour */
162 // OBSOLETE default_check_format, /* check_format */
163 // OBSOLETE default_core_sniffer, /* core_sniffer */
164 // OBSOLETE fetch_core_registers, /* core_read_registers */
165 // OBSOLETE NULL /* next */
169 // OBSOLETE _initialize_core_i386mach (void)
171 // OBSOLETE add_core_fns (&i386mach_core_fns);
This page took 0.03238 seconds and 4 git commands to generate.