Commit | Line | Data |
---|---|---|
d8ee244c MK |
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. | |
4 | // OBSOLETE | |
5 | // OBSOLETE This file is part of GDB. | |
6 | // OBSOLETE | |
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. | |
11 | // OBSOLETE | |
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. | |
16 | // OBSOLETE | |
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. */ | |
21 | // OBSOLETE | |
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" | |
27 | // OBSOLETE | |
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> | |
34 | // OBSOLETE | |
35 | // OBSOLETE #include <sys/ptrace.h> | |
36 | // OBSOLETE #include <machine/reg.h> | |
37 | // OBSOLETE | |
38 | // OBSOLETE #include <sys/file.h> | |
39 | // OBSOLETE #include "gdb_stat.h" | |
40 | // OBSOLETE #include <sys/core.h> | |
41 | // OBSOLETE | |
42 | // OBSOLETE static void fetch_core_registers (char *, unsigned, int, CORE_ADDR); | |
43 | // OBSOLETE | |
44 | // OBSOLETE void | |
45 | // OBSOLETE fetch_inferior_registers (int regno) | |
46 | // OBSOLETE { | |
47 | // OBSOLETE struct regs inferior_registers; | |
48 | // OBSOLETE struct fp_state inferior_fp_registers; | |
49 | // OBSOLETE | |
50 | // OBSOLETE registers_fetched (); | |
51 | // OBSOLETE | |
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); | |
56 | // OBSOLETE | |
57 | // OBSOLETE memcpy (registers, &inferior_registers, sizeof inferior_registers); | |
58 | // OBSOLETE | |
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); | |
65 | // OBSOLETE } | |
66 | // OBSOLETE | |
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). */ | |
70 | // OBSOLETE | |
71 | // OBSOLETE void | |
72 | // OBSOLETE store_inferior_registers (int regno) | |
73 | // OBSOLETE { | |
74 | // OBSOLETE struct regs inferior_registers; | |
75 | // OBSOLETE struct fp_state inferior_fp_registers; | |
76 | // OBSOLETE | |
77 | // OBSOLETE memcpy (&inferior_registers, registers, 20 * 4); | |
78 | // OBSOLETE | |
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); | |
84 | // OBSOLETE | |
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. */ | |
89 | // OBSOLETE { | |
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; | |
106 | // OBSOLETE } | |
107 | // OBSOLETE #endif | |
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); | |
112 | // OBSOLETE } | |
113 | // OBSOLETE | |
114 | // OBSOLETE | |
115 | // OBSOLETE | |
116 | // OBSOLETE /* Provide registers to GDB from a core file. | |
117 | // OBSOLETE | |
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. | |
121 | // OBSOLETE | |
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 | |
125 | // OBSOLETE | |
126 | // OBSOLETE REG_ADDR isn't used. */ | |
127 | // OBSOLETE | |
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) | |
131 | // OBSOLETE { | |
132 | // OBSOLETE int val; | |
133 | // OBSOLETE | |
134 | // OBSOLETE switch (which) | |
135 | // OBSOLETE { | |
136 | // OBSOLETE case 0: | |
137 | // OBSOLETE case 1: | |
138 | // OBSOLETE memcpy (registers, core_reg_sect, core_reg_size); | |
139 | // OBSOLETE break; | |
140 | // OBSOLETE | |
141 | // OBSOLETE case 2: | |
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); | |
150 | // OBSOLETE #endif | |
151 | // OBSOLETE break; | |
152 | // OBSOLETE } | |
153 | // OBSOLETE } | |
154 | // OBSOLETE \f | |
155 | // OBSOLETE | |
156 | // OBSOLETE /* Register that we are able to handle i386mach core file formats. | |
157 | // OBSOLETE FIXME: is this really bfd_target_unknown_flavour? */ | |
158 | // OBSOLETE | |
159 | // OBSOLETE static struct core_fns i386mach_core_fns = | |
160 | // OBSOLETE { | |
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 */ | |
166 | // OBSOLETE }; | |
167 | // OBSOLETE | |
168 | // OBSOLETE void | |
169 | // OBSOLETE _initialize_core_i386mach (void) | |
170 | // OBSOLETE { | |
171 | // OBSOLETE add_core_fns (&i386mach_core_fns); | |
172 | // OBSOLETE } |