* gdb.base/maint.exp: Treat $EXEEXT as optional in output.
[deliverable/binutils-gdb.git] / gdb / ns32km3-nat.c
1 /* OBSOLETE /* Low level interface to ns532 running mach 3.0. */
2 /* OBSOLETE Copyright 1992, 1993, 1998, 2000, 2001 Free Software Foundation, Inc. */
3 /* OBSOLETE */
4 /* OBSOLETE This file is part of GDB. */
5 /* OBSOLETE */
6 /* OBSOLETE This program is free software; you can redistribute it and/or modify */
7 /* OBSOLETE it under the terms of the GNU General Public License as published by */
8 /* OBSOLETE the Free Software Foundation; either version 2 of the License, or */
9 /* OBSOLETE (at your option) any later version. */
10 /* OBSOLETE */
11 /* OBSOLETE This program is distributed in the hope that it will be useful, */
12 /* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */
13 /* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14 /* OBSOLETE GNU General Public License for more details. */
15 /* OBSOLETE */
16 /* OBSOLETE You should have received a copy of the GNU General Public License */
17 /* OBSOLETE along with this program; if not, write to the Free Software */
18 /* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, */
19 /* OBSOLETE Boston, MA 02111-1307, USA. */ */
20 /* OBSOLETE */
21 /* OBSOLETE#include "defs.h" */
22 /* OBSOLETE#include "inferior.h" */
23 /* OBSOLETE#include "regcache.h" */
24 /* OBSOLETE */
25 /* OBSOLETE#include <stdio.h> */
26 /* OBSOLETE */
27 /* OBSOLETE#include <mach.h> */
28 /* OBSOLETE#include <mach/message.h> */
29 /* OBSOLETE#include <mach/exception.h> */
30 /* OBSOLETE#include <mach_error.h> */
31 /* OBSOLETE */
32 /* OBSOLETE#define private static */
33 /* OBSOLETE\f */
34 /* OBSOLETE */
35 /* OBSOLETE/* Find offsets to thread states at compile time. */
36 /* OBSOLETE * If your compiler does not grok this, calculate offsets */
37 /* OBSOLETE * offsets yourself and use them (or get a compatible compiler :-) */
38 /* OBSOLETE */ */
39 /* OBSOLETE */
40 /* OBSOLETE#define REG_N_OFFSET(reg) (int)(&((struct ns532_combined_state *)0)->ts.reg) */
41 /* OBSOLETE#define REG_F_OFFSET(reg) (int)(&((struct ns532_combined_state *)0)->fs.reg) */
42 /* OBSOLETE */
43 /* OBSOLETE/* at reg_offset[i] is the offset to the ns532_combined_state */
44 /* OBSOLETE * location where the gdb registers[i] is stored. */
45 /* OBSOLETE */ */
46 /* OBSOLETE */
47 /* OBSOLETEstatic int reg_offset[] = */
48 /* OBSOLETE{ */
49 /* OBSOLETE REG_N_OFFSET (r0), REG_N_OFFSET (r1), REG_N_OFFSET (r2), REG_N_OFFSET (r3), */
50 /* OBSOLETE REG_N_OFFSET (r4), REG_N_OFFSET (r5), REG_N_OFFSET (r6), REG_N_OFFSET (r7), */
51 /* OBSOLETE REG_F_OFFSET (l0a), REG_F_OFFSET (l0b), REG_F_OFFSET (l2a), REG_F_OFFSET (l2b), */
52 /* OBSOLETE REG_F_OFFSET (l4a), REG_F_OFFSET (l4b), REG_F_OFFSET (l6a), REG_F_OFFSET (l6b), */
53 /* OBSOLETEREG_N_OFFSET (sp), REG_N_OFFSET (fp), REG_N_OFFSET (pc), REG_N_OFFSET (psr), */
54 /* OBSOLETE REG_F_OFFSET (fsr), */
55 /* OBSOLETE REG_F_OFFSET (l0a), REG_F_OFFSET (l1a), REG_F_OFFSET (l2a), REG_F_OFFSET (l3a), */
56 /* OBSOLETE REG_F_OFFSET (l4a), REG_F_OFFSET (l5a), REG_F_OFFSET (l6a), REG_F_OFFSET (l7a), */
57 /* OBSOLETE}; */
58 /* OBSOLETE */
59 /* OBSOLETE#define REG_ADDRESS(state,regnum) ((char *)(state)+reg_offset[regnum]) */
60 /* OBSOLETE */
61 /* OBSOLETE/* Fetch COUNT contiguous registers from thread STATE starting from REGNUM */
62 /* OBSOLETE * Caller knows that the regs handled in one transaction are of same size. */
63 /* OBSOLETE */ */
64 /* OBSOLETE#define FETCH_REGS(state, regnum, count) \ */
65 /* OBSOLETE memcpy (&registers[REGISTER_BYTE (regnum)], \ */
66 /* OBSOLETE (char *)state+reg_offset[ regnum ], \ */
67 /* OBSOLETE count*REGISTER_SIZE) */
68 /* OBSOLETE */
69 /* OBSOLETE/* Store COUNT contiguous registers to thread STATE starting from REGNUM */ */
70 /* OBSOLETE#define STORE_REGS(state, regnum, count) \ */
71 /* OBSOLETE memcpy ((char *)state+reg_offset[ regnum ], \ */
72 /* OBSOLETE &registers[REGISTER_BYTE (regnum)], \ */
73 /* OBSOLETE count*REGISTER_SIZE) */
74 /* OBSOLETE\f */
75 /* OBSOLETE/* */
76 /* OBSOLETE * Fetch inferiors registers for gdb. */
77 /* OBSOLETE * REGNO specifies which (as gdb views it) register, -1 for all. */
78 /* OBSOLETE */ */
79 /* OBSOLETE */
80 /* OBSOLETEvoid */
81 /* OBSOLETEfetch_inferior_registers (int regno) */
82 /* OBSOLETE{ */
83 /* OBSOLETE kern_return_t ret; */
84 /* OBSOLETE thread_state_data_t state; */
85 /* OBSOLETE unsigned int stateCnt = NS532_COMBINED_STATE_COUNT; */
86 /* OBSOLETE int index; */
87 /* OBSOLETE */
88 /* OBSOLETE if (!MACH_PORT_VALID (current_thread)) */
89 /* OBSOLETE error ("fetch inferior registers: Invalid thread"); */
90 /* OBSOLETE */
91 /* OBSOLETE if (must_suspend_thread) */
92 /* OBSOLETE setup_thread (current_thread, 1); */
93 /* OBSOLETE */
94 /* OBSOLETE ret = thread_get_state (current_thread, */
95 /* OBSOLETE NS532_COMBINED_STATE, */
96 /* OBSOLETE state, */
97 /* OBSOLETE &stateCnt); */
98 /* OBSOLETE */
99 /* OBSOLETE if (ret != KERN_SUCCESS) */
100 /* OBSOLETE warning ("fetch_inferior_registers: %s ", */
101 /* OBSOLETE mach_error_string (ret)); */
102 /* OBSOLETE#if 0 */
103 /* OBSOLETE /* It may be more effective to store validate all of them, */
104 /* OBSOLETE * since we fetched them all anyway */
105 /* OBSOLETE */ */
106 /* OBSOLETE else if (regno != -1) */
107 /* OBSOLETE supply_register (regno, (char *) state + reg_offset[regno]); */
108 /* OBSOLETE#endif */
109 /* OBSOLETE else */
110 /* OBSOLETE { */
111 /* OBSOLETE for (index = 0; index < NUM_REGS; index++) */
112 /* OBSOLETE supply_register (index, (char *) state + reg_offset[index]); */
113 /* OBSOLETE } */
114 /* OBSOLETE */
115 /* OBSOLETE if (must_suspend_thread) */
116 /* OBSOLETE setup_thread (current_thread, 0); */
117 /* OBSOLETE} */
118 /* OBSOLETE\f */
119 /* OBSOLETE/* Store our register values back into the inferior. */
120 /* OBSOLETE * If REGNO is -1, do this for all registers. */
121 /* OBSOLETE * Otherwise, REGNO specifies which register */
122 /* OBSOLETE * */
123 /* OBSOLETE * On mach3 all registers are always saved in one call. */
124 /* OBSOLETE */ */
125 /* OBSOLETEvoid */
126 /* OBSOLETEstore_inferior_registers (int regno) */
127 /* OBSOLETE{ */
128 /* OBSOLETE kern_return_t ret; */
129 /* OBSOLETE thread_state_data_t state; */
130 /* OBSOLETE unsigned int stateCnt = NS532_COMBINED_STATE_COUNT; */
131 /* OBSOLETE register int index; */
132 /* OBSOLETE */
133 /* OBSOLETE if (!MACH_PORT_VALID (current_thread)) */
134 /* OBSOLETE error ("store inferior registers: Invalid thread"); */
135 /* OBSOLETE */
136 /* OBSOLETE if (must_suspend_thread) */
137 /* OBSOLETE setup_thread (current_thread, 1); */
138 /* OBSOLETE */
139 /* OBSOLETE /* Fetch the state of the current thread */ */
140 /* OBSOLETE ret = thread_get_state (current_thread, */
141 /* OBSOLETE NS532_COMBINED_STATE, */
142 /* OBSOLETE state, */
143 /* OBSOLETE &stateCnt); */
144 /* OBSOLETE */
145 /* OBSOLETE if (ret != KERN_SUCCESS) */
146 /* OBSOLETE { */
147 /* OBSOLETE warning ("store_inferior_registers (get): %s", */
148 /* OBSOLETE mach_error_string (ret)); */
149 /* OBSOLETE if (must_suspend_thread) */
150 /* OBSOLETE setup_thread (current_thread, 0); */
151 /* OBSOLETE return; */
152 /* OBSOLETE } */
153 /* OBSOLETE */
154 /* OBSOLETE /* move gdb's registers to thread's state */
155 /* OBSOLETE */
156 /* OBSOLETE * Since we save all registers anyway, save the ones */
157 /* OBSOLETE * that gdb thinks are valid (e.g. ignore the regno */
158 /* OBSOLETE * parameter) */
159 /* OBSOLETE */ */
160 /* OBSOLETE#if 0 */
161 /* OBSOLETE if (regno != -1) */
162 /* OBSOLETE STORE_REGS (state, regno, 1); */
163 /* OBSOLETE else */
164 /* OBSOLETE#endif */
165 /* OBSOLETE { */
166 /* OBSOLETE for (index = 0; index < NUM_REGS; index++) */
167 /* OBSOLETE STORE_REGS (state, index, 1); */
168 /* OBSOLETE } */
169 /* OBSOLETE */
170 /* OBSOLETE /* Write gdb's current view of register to the thread */
171 /* OBSOLETE */ */
172 /* OBSOLETE ret = thread_set_state (current_thread, */
173 /* OBSOLETE NS532_COMBINED_STATE, */
174 /* OBSOLETE state, */
175 /* OBSOLETE NS532_COMBINED_STATE_COUNT); */
176 /* OBSOLETE */
177 /* OBSOLETE if (ret != KERN_SUCCESS) */
178 /* OBSOLETE warning ("store_inferior_registers (set): %s", */
179 /* OBSOLETE mach_error_string (ret)); */
180 /* OBSOLETE */
181 /* OBSOLETE if (must_suspend_thread) */
182 /* OBSOLETE setup_thread (current_thread, 0); */
183 /* OBSOLETE} */
This page took 0.033098 seconds and 4 git commands to generate.