1 |
578 |
markom |
/* Native support for Motorola 88k running Harris CX/UX.
|
2 |
|
|
Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000,
|
3 |
|
|
2001 Free Software Foundation, Inc.
|
4 |
|
|
|
5 |
|
|
This file is part of GDB.
|
6 |
|
|
|
7 |
|
|
This program is free software; you can redistribute it and/or modify
|
8 |
|
|
it under the terms of the GNU General Public License as published by
|
9 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
10 |
|
|
(at your option) any later version.
|
11 |
|
|
|
12 |
|
|
This program is distributed in the hope that it will be useful,
|
13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
GNU General Public License for more details.
|
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License
|
18 |
|
|
along with this program; if not, write to the Free Software
|
19 |
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
20 |
|
|
Boston, MA 02111-1307, USA. */
|
21 |
|
|
|
22 |
|
|
#include "defs.h"
|
23 |
|
|
#include "frame.h"
|
24 |
|
|
#include "inferior.h"
|
25 |
|
|
|
26 |
|
|
#include <sys/types.h>
|
27 |
|
|
#include <sys/param.h>
|
28 |
|
|
#include <sys/dir.h>
|
29 |
|
|
#include <signal.h>
|
30 |
|
|
#include "gdbcore.h"
|
31 |
|
|
#include <sys/user.h>
|
32 |
|
|
|
33 |
|
|
#include "bfd.h"
|
34 |
|
|
#include "symfile.h"
|
35 |
|
|
#include "objfiles.h"
|
36 |
|
|
#include "symtab.h"
|
37 |
|
|
#include "regcache.h"
|
38 |
|
|
|
39 |
|
|
#ifndef USER /* added to support BCS ptrace_user */
|
40 |
|
|
#define USER ptrace_user
|
41 |
|
|
#endif
|
42 |
|
|
#include <sys/ioctl.h>
|
43 |
|
|
#include <fcntl.h>
|
44 |
|
|
#include <sys/file.h>
|
45 |
|
|
#include "gdb_stat.h"
|
46 |
|
|
|
47 |
|
|
#include "symtab.h"
|
48 |
|
|
#include "setjmp.h"
|
49 |
|
|
#include "value.h"
|
50 |
|
|
|
51 |
|
|
#include <sys/ptrace.h>
|
52 |
|
|
|
53 |
|
|
/* CX/UX provides them already, but as word offsets instead of char offsets */
|
54 |
|
|
#define SXIP_OFFSET (PT_SXIP * 4)
|
55 |
|
|
#define SNIP_OFFSET (PT_SNIP * 4)
|
56 |
|
|
#define SFIP_OFFSET (PT_SFIP * 4)
|
57 |
|
|
#define PSR_OFFSET (PT_PSR * sizeof(int))
|
58 |
|
|
#define FPSR_OFFSET (PT_FPSR * sizeof(int))
|
59 |
|
|
#define FPCR_OFFSET (PT_FPCR * sizeof(int))
|
60 |
|
|
|
61 |
|
|
#define XREGADDR(r) (((char *)&u.pt_x0-(char *)&u) + \
|
62 |
|
|
((r)-X0_REGNUM)*sizeof(X_REGISTER_RAW_TYPE))
|
63 |
|
|
|
64 |
|
|
extern int have_symbol_file_p ();
|
65 |
|
|
|
66 |
|
|
extern jmp_buf stack_jmp;
|
67 |
|
|
|
68 |
|
|
extern int errno;
|
69 |
|
|
|
70 |
|
|
void
|
71 |
|
|
fetch_inferior_registers (int regno)
|
72 |
|
|
{
|
73 |
|
|
register unsigned int regaddr;
|
74 |
|
|
char buf[MAX_REGISTER_RAW_SIZE];
|
75 |
|
|
register int i;
|
76 |
|
|
|
77 |
|
|
struct USER u;
|
78 |
|
|
unsigned int offset;
|
79 |
|
|
|
80 |
|
|
offset = (char *) &u.pt_r0 - (char *) &u;
|
81 |
|
|
regaddr = offset; /* byte offset to r0; */
|
82 |
|
|
|
83 |
|
|
/* offset = ptrace (3, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) offset, 0) - KERNEL_U_ADDR; */
|
84 |
|
|
for (regno = 0; regno < PC_REGNUM; regno++)
|
85 |
|
|
{
|
86 |
|
|
/*regaddr = register_addr (regno, offset); */
|
87 |
|
|
/* 88k enhancement */
|
88 |
|
|
|
89 |
|
|
for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
|
90 |
|
|
{
|
91 |
|
|
*(int *) &buf[i] = ptrace (3, PIDGET (inferior_ptid),
|
92 |
|
|
(PTRACE_ARG3_TYPE) regaddr, 0);
|
93 |
|
|
regaddr += sizeof (int);
|
94 |
|
|
}
|
95 |
|
|
supply_register (regno, buf);
|
96 |
|
|
}
|
97 |
|
|
/* now load up registers 32-37; special pc registers */
|
98 |
|
|
*(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid),
|
99 |
|
|
(PTRACE_ARG3_TYPE) PSR_OFFSET, 0);
|
100 |
|
|
supply_register (PSR_REGNUM, buf);
|
101 |
|
|
*(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid),
|
102 |
|
|
(PTRACE_ARG3_TYPE) FPSR_OFFSET, 0);
|
103 |
|
|
supply_register (FPSR_REGNUM, buf);
|
104 |
|
|
*(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid),
|
105 |
|
|
(PTRACE_ARG3_TYPE) FPCR_OFFSET, 0);
|
106 |
|
|
supply_register (FPCR_REGNUM, buf);
|
107 |
|
|
*(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid),
|
108 |
|
|
(PTRACE_ARG3_TYPE) SXIP_OFFSET, 0);
|
109 |
|
|
supply_register (SXIP_REGNUM, buf);
|
110 |
|
|
*(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid),
|
111 |
|
|
(PTRACE_ARG3_TYPE) SNIP_OFFSET, 0);
|
112 |
|
|
supply_register (SNIP_REGNUM, buf);
|
113 |
|
|
*(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid),
|
114 |
|
|
(PTRACE_ARG3_TYPE) SFIP_OFFSET, 0);
|
115 |
|
|
supply_register (SFIP_REGNUM, buf);
|
116 |
|
|
|
117 |
|
|
if (target_is_m88110)
|
118 |
|
|
{
|
119 |
|
|
for (regaddr = XREGADDR (X0_REGNUM), regno = X0_REGNUM;
|
120 |
|
|
regno < NUM_REGS;
|
121 |
|
|
regno++, regaddr += 16)
|
122 |
|
|
{
|
123 |
|
|
X_REGISTER_RAW_TYPE xval;
|
124 |
|
|
|
125 |
|
|
*(int *) &xval.w1 = ptrace (3, PIDGET (inferior_ptid),
|
126 |
|
|
(PTRACE_ARG3_TYPE) regaddr, 0);
|
127 |
|
|
*(int *) &xval.w2 = ptrace (3, PIDGET (inferior_ptid),
|
128 |
|
|
(PTRACE_ARG3_TYPE) (regaddr + 4), 0);
|
129 |
|
|
*(int *) &xval.w3 = ptrace (3, PIDGET (inferior_ptid),
|
130 |
|
|
(PTRACE_ARG3_TYPE) (regaddr + 8), 0);
|
131 |
|
|
*(int *) &xval.w4 = ptrace (3, PIDGET (inferior_ptid),
|
132 |
|
|
(PTRACE_ARG3_TYPE) (regaddr + 12), 0);
|
133 |
|
|
supply_register (regno, (void *) &xval);
|
134 |
|
|
}
|
135 |
|
|
}
|
136 |
|
|
}
|
137 |
|
|
|
138 |
|
|
/* Store our register values back into the inferior.
|
139 |
|
|
If REGNO is -1, do this for all registers.
|
140 |
|
|
Otherwise, REGNO specifies which register (so we can save time). */
|
141 |
|
|
|
142 |
|
|
void
|
143 |
|
|
store_inferior_registers (int regno)
|
144 |
|
|
{
|
145 |
|
|
register unsigned int regaddr;
|
146 |
|
|
char buf[80];
|
147 |
|
|
|
148 |
|
|
struct USER u;
|
149 |
|
|
|
150 |
|
|
unsigned int offset = (char *) &u.pt_r0 - (char *) &u;
|
151 |
|
|
|
152 |
|
|
regaddr = offset;
|
153 |
|
|
|
154 |
|
|
/* Don't try to deal with EXIP_REGNUM or ENIP_REGNUM, because I think either
|
155 |
|
|
svr3 doesn't run on an 88110, or the kernel isolates the different (not
|
156 |
|
|
completely sure this is true, but seems to be. */
|
157 |
|
|
if (regno >= 0)
|
158 |
|
|
{
|
159 |
|
|
/* regaddr = register_addr (regno, offset); */
|
160 |
|
|
if (regno < PC_REGNUM)
|
161 |
|
|
{
|
162 |
|
|
regaddr = offset + regno * sizeof (int);
|
163 |
|
|
errno = 0;
|
164 |
|
|
ptrace (6, PIDGET (inferior_ptid),
|
165 |
|
|
(PTRACE_ARG3_TYPE) regaddr, read_register (regno));
|
166 |
|
|
if (errno != 0)
|
167 |
|
|
{
|
168 |
|
|
sprintf (buf, "writing register number %d", regno);
|
169 |
|
|
perror_with_name (buf);
|
170 |
|
|
}
|
171 |
|
|
}
|
172 |
|
|
else if (regno == PSR_REGNUM)
|
173 |
|
|
ptrace (6, PIDGET (inferior_ptid),
|
174 |
|
|
(PTRACE_ARG3_TYPE) PSR_OFFSET, read_register (regno));
|
175 |
|
|
else if (regno == FPSR_REGNUM)
|
176 |
|
|
ptrace (6, PIDGET (inferior_ptid),
|
177 |
|
|
(PTRACE_ARG3_TYPE) FPSR_OFFSET, read_register (regno));
|
178 |
|
|
else if (regno == FPCR_REGNUM)
|
179 |
|
|
ptrace (6, PIDGET (inferior_ptid),
|
180 |
|
|
(PTRACE_ARG3_TYPE) FPCR_OFFSET, read_register (regno));
|
181 |
|
|
else if (regno == SXIP_REGNUM)
|
182 |
|
|
ptrace (6, PIDGET (inferior_ptid),
|
183 |
|
|
(PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register (regno));
|
184 |
|
|
else if (regno == SNIP_REGNUM)
|
185 |
|
|
ptrace (6, PIDGET (inferior_ptid),
|
186 |
|
|
(PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register (regno));
|
187 |
|
|
else if (regno == SFIP_REGNUM)
|
188 |
|
|
ptrace (6, PIDGET (inferior_ptid),
|
189 |
|
|
(PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register (regno));
|
190 |
|
|
else if (target_is_m88110 && regno < NUM_REGS)
|
191 |
|
|
{
|
192 |
|
|
X_REGISTER_RAW_TYPE xval;
|
193 |
|
|
|
194 |
|
|
read_register_bytes (REGISTER_BYTE (regno), (char *) &xval,
|
195 |
|
|
sizeof (X_REGISTER_RAW_TYPE));
|
196 |
|
|
regaddr = XREGADDR (regno);
|
197 |
|
|
ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr, xval.w1);
|
198 |
|
|
ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr + 4, xval.w2);
|
199 |
|
|
ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr + 8, xval.w3);
|
200 |
|
|
ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr + 12, xval.w4);
|
201 |
|
|
}
|
202 |
|
|
else
|
203 |
|
|
printf_unfiltered ("Bad register number for store_inferior routine\n");
|
204 |
|
|
}
|
205 |
|
|
else
|
206 |
|
|
{
|
207 |
|
|
for (regno = 0; regno < PC_REGNUM; regno++)
|
208 |
|
|
{
|
209 |
|
|
/* regaddr = register_addr (regno, offset); */
|
210 |
|
|
errno = 0;
|
211 |
|
|
regaddr = offset + regno * sizeof (int);
|
212 |
|
|
ptrace (6, PIDGET (inferior_ptid),
|
213 |
|
|
(PTRACE_ARG3_TYPE) regaddr, read_register (regno));
|
214 |
|
|
if (errno != 0)
|
215 |
|
|
{
|
216 |
|
|
sprintf (buf, "writing register number %d", regno);
|
217 |
|
|
perror_with_name (buf);
|
218 |
|
|
}
|
219 |
|
|
}
|
220 |
|
|
ptrace (6, PIDGET (inferior_ptid),
|
221 |
|
|
(PTRACE_ARG3_TYPE) PSR_OFFSET, read_register (regno));
|
222 |
|
|
ptrace (6, PIDGET (inferior_ptid),
|
223 |
|
|
(PTRACE_ARG3_TYPE) FPSR_OFFSET, read_register (regno));
|
224 |
|
|
ptrace (6, PIDGET (inferior_ptid),
|
225 |
|
|
(PTRACE_ARG3_TYPE) FPCR_OFFSET, read_register (regno));
|
226 |
|
|
ptrace (6, PIDGET (inferior_ptid),
|
227 |
|
|
(PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register (SXIP_REGNUM));
|
228 |
|
|
ptrace (6, PIDGET (inferior_ptid),
|
229 |
|
|
(PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register (SNIP_REGNUM));
|
230 |
|
|
ptrace (6, PIDGET (inferior_ptid),
|
231 |
|
|
(PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register (SFIP_REGNUM));
|
232 |
|
|
if (target_is_m88110)
|
233 |
|
|
{
|
234 |
|
|
for (regno = X0_REGNUM; regno < NUM_REGS; regno++)
|
235 |
|
|
{
|
236 |
|
|
X_REGISTER_RAW_TYPE xval;
|
237 |
|
|
|
238 |
|
|
read_register_bytes (REGISTER_BYTE (regno), (char *) &xval,
|
239 |
|
|
sizeof (X_REGISTER_RAW_TYPE));
|
240 |
|
|
regaddr = XREGADDR (regno);
|
241 |
|
|
ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr, xval.w1);
|
242 |
|
|
ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) (regaddr + 4), xval.w2);
|
243 |
|
|
ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) (regaddr + 8), xval.w3);
|
244 |
|
|
ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) (regaddr + 12), xval.w4);
|
245 |
|
|
}
|
246 |
|
|
}
|
247 |
|
|
}
|
248 |
|
|
}
|
249 |
|
|
|
250 |
|
|
/* blockend is the address of the end of the user structure */
|
251 |
|
|
|
252 |
|
|
m88k_register_u_addr (int blockend, int regnum)
|
253 |
|
|
{
|
254 |
|
|
struct USER u;
|
255 |
|
|
int ustart = blockend - sizeof (struct USER);
|
256 |
|
|
|
257 |
|
|
if (regnum < PSR_REGNUM)
|
258 |
|
|
return (ustart + ((int) &u.pt_r0 - (int) &u) +
|
259 |
|
|
REGISTER_SIZE * regnum);
|
260 |
|
|
else if (regnum == PSR_REGNUM)
|
261 |
|
|
return (ustart + ((int) &u.pt_psr) - (int) &u);
|
262 |
|
|
else if (regnum == FPSR_REGNUM)
|
263 |
|
|
return (ustart + ((int) &u.pt_fpsr) - (int) &u);
|
264 |
|
|
else if (regnum == FPCR_REGNUM)
|
265 |
|
|
return (ustart + ((int) &u.pt_fpcr) - (int) &u);
|
266 |
|
|
else if (regnum == SXIP_REGNUM)
|
267 |
|
|
return (ustart + SXIP_OFFSET);
|
268 |
|
|
else if (regnum == SNIP_REGNUM)
|
269 |
|
|
return (ustart + SNIP_OFFSET);
|
270 |
|
|
else if (regnum == SFIP_REGNUM)
|
271 |
|
|
return (ustart + SFIP_OFFSET);
|
272 |
|
|
else if (target_is_m88110)
|
273 |
|
|
return (ustart + ((int) &u.pt_x0 - (int) &u) + /* Must be X register */
|
274 |
|
|
sizeof (u.pt_x0) * (regnum - X0_REGNUM));
|
275 |
|
|
else
|
276 |
|
|
return (blockend + REGISTER_SIZE * regnum);
|
277 |
|
|
}
|
278 |
|
|
|
279 |
|
|
#ifdef USE_PROC_FS
|
280 |
|
|
|
281 |
|
|
#include <sys/procfs.h>
|
282 |
|
|
|
283 |
|
|
/* Prototypes for supply_gregset etc. */
|
284 |
|
|
#include "gregset.h"
|
285 |
|
|
|
286 |
|
|
/* Given a pointer to a general register set in /proc format (gregset_t *),
|
287 |
|
|
unpack the register contents and supply them as gdb's idea of the current
|
288 |
|
|
register values. */
|
289 |
|
|
|
290 |
|
|
void
|
291 |
|
|
supply_gregset (gregset_t *gregsetp)
|
292 |
|
|
{
|
293 |
|
|
register int regi;
|
294 |
|
|
register greg_t *regp = (greg_t *) gregsetp;
|
295 |
|
|
|
296 |
|
|
for (regi = 0; regi <= SP_REGNUM; regi++)
|
297 |
|
|
supply_register (regi, (char *) (regp + regi));
|
298 |
|
|
|
299 |
|
|
supply_register (SXIP_REGNUM, (char *) (regp + R_XIP));
|
300 |
|
|
supply_register (SNIP_REGNUM, (char *) (regp + R_NIP));
|
301 |
|
|
supply_register (SFIP_REGNUM, (char *) (regp + R_FIP));
|
302 |
|
|
supply_register (PSR_REGNUM, (char *) (regp + R_PSR));
|
303 |
|
|
supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR));
|
304 |
|
|
supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR));
|
305 |
|
|
}
|
306 |
|
|
|
307 |
|
|
void
|
308 |
|
|
fill_gregset (gregset_t *gregsetp, int regno)
|
309 |
|
|
{
|
310 |
|
|
int regi;
|
311 |
|
|
register greg_t *regp = (greg_t *) gregsetp;
|
312 |
|
|
|
313 |
|
|
for (regi = 0; regi <= R_R31; regi++)
|
314 |
|
|
if ((regno == -1) || (regno == regi))
|
315 |
|
|
*(regp + regi) = *(int *) ®isters[REGISTER_BYTE (regi)];
|
316 |
|
|
|
317 |
|
|
if ((regno == -1) || (regno == SXIP_REGNUM))
|
318 |
|
|
*(regp + R_XIP) = *(int *) ®isters[REGISTER_BYTE (SXIP_REGNUM)];
|
319 |
|
|
if ((regno == -1) || (regno == SNIP_REGNUM))
|
320 |
|
|
*(regp + R_NIP) = *(int *) ®isters[REGISTER_BYTE (SNIP_REGNUM)];
|
321 |
|
|
if ((regno == -1) || (regno == SFIP_REGNUM))
|
322 |
|
|
*(regp + R_FIP) = *(int *) ®isters[REGISTER_BYTE (SFIP_REGNUM)];
|
323 |
|
|
if ((regno == -1) || (regno == PSR_REGNUM))
|
324 |
|
|
*(regp + R_PSR) = *(int *) ®isters[REGISTER_BYTE (PSR_REGNUM)];
|
325 |
|
|
if ((regno == -1) || (regno == FPSR_REGNUM))
|
326 |
|
|
*(regp + R_FPSR) = *(int *) ®isters[REGISTER_BYTE (FPSR_REGNUM)];
|
327 |
|
|
if ((regno == -1) || (regno == FPCR_REGNUM))
|
328 |
|
|
*(regp + R_FPCR) = *(int *) ®isters[REGISTER_BYTE (FPCR_REGNUM)];
|
329 |
|
|
}
|
330 |
|
|
|
331 |
|
|
#endif /* USE_PROC_FS */
|
332 |
|
|
|
333 |
|
|
/* This support adds the equivalent of adb's % command. When
|
334 |
|
|
the `add-shared-symbol-files' command is given, this routine scans
|
335 |
|
|
the dynamic linker's link map and reads the minimal symbols
|
336 |
|
|
from each shared object file listed in the map. */
|
337 |
|
|
|
338 |
|
|
struct link_map
|
339 |
|
|
{
|
340 |
|
|
unsigned long l_addr; /* address at which object is mapped */
|
341 |
|
|
char *l_name; /* full name of loaded object */
|
342 |
|
|
void *l_ld; /* dynamic structure of object */
|
343 |
|
|
struct link_map *l_next; /* next link object */
|
344 |
|
|
struct link_map *l_prev; /* previous link object */
|
345 |
|
|
};
|
346 |
|
|
|
347 |
|
|
#define LINKS_MAP_POINTER "_ld_tail"
|
348 |
|
|
#define LIBC_FILE "/usr/lib/libc.so.1"
|
349 |
|
|
#define SHARED_OFFSET 0xf0001000
|
350 |
|
|
|
351 |
|
|
#ifndef PATH_MAX
|
352 |
|
|
#define PATH_MAX 1023 /* maximum size of path name on OS */
|
353 |
|
|
#endif
|
354 |
|
|
|
355 |
|
|
void
|
356 |
|
|
add_shared_symbol_files (void)
|
357 |
|
|
{
|
358 |
|
|
void *desc;
|
359 |
|
|
struct link_map *ld_map, *lm, lms;
|
360 |
|
|
struct minimal_symbol *minsym;
|
361 |
|
|
struct objfile *objfile;
|
362 |
|
|
char *path_name;
|
363 |
|
|
|
364 |
|
|
if (ptid_equal (inferior_ptid, null_ptid))
|
365 |
|
|
{
|
366 |
|
|
warning ("The program has not yet been started.");
|
367 |
|
|
return;
|
368 |
|
|
}
|
369 |
|
|
|
370 |
|
|
objfile = symbol_file_add (LIBC_FILE, 0, NULL, 0, OBJF_READNOW);
|
371 |
|
|
minsym = lookup_minimal_symbol (LINKS_MAP_POINTER, objfile);
|
372 |
|
|
|
373 |
|
|
ld_map = (struct link_map *)
|
374 |
|
|
read_memory_integer (((int) SYMBOL_VALUE_ADDRESS (minsym) + SHARED_OFFSET), 4);
|
375 |
|
|
lm = ld_map;
|
376 |
|
|
while (lm)
|
377 |
|
|
{
|
378 |
|
|
int local_errno = 0;
|
379 |
|
|
|
380 |
|
|
read_memory ((CORE_ADDR) lm, (char *) &lms, sizeof (struct link_map));
|
381 |
|
|
if (lms.l_name)
|
382 |
|
|
{
|
383 |
|
|
if (target_read_string ((CORE_ADDR) lms.l_name, &path_name,
|
384 |
|
|
PATH_MAX, &local_errno))
|
385 |
|
|
{
|
386 |
|
|
struct section_addr_info section_addrs;
|
387 |
|
|
memset (§ion_addrs, 0, sizeof (section_addrs));
|
388 |
|
|
section_addrs.other[0].addr = lms.l_addr;
|
389 |
|
|
section_addrs.other[0].name = ".text";
|
390 |
|
|
symbol_file_add (path_name, 1, §ion_addrs, 0, 0);
|
391 |
|
|
xfree (path_name);
|
392 |
|
|
}
|
393 |
|
|
}
|
394 |
|
|
/* traverse links in reverse order so that we get the
|
395 |
|
|
the symbols the user actually gets. */
|
396 |
|
|
lm = lms.l_prev;
|
397 |
|
|
}
|
398 |
|
|
|
399 |
|
|
/* Getting new symbols may change our opinion about what is
|
400 |
|
|
frameless. */
|
401 |
|
|
reinit_frame_cache ();
|
402 |
|
|
}
|
403 |
|
|
|
404 |
|
|
#if defined(_ES_MP)
|
405 |
|
|
|
406 |
|
|
#include <sys/regset.h>
|
407 |
|
|
|
408 |
|
|
unsigned int
|
409 |
|
|
m88k_harris_core_register_addr (int regno, int reg_ptr)
|
410 |
|
|
{
|
411 |
|
|
unsigned int word_offset;
|
412 |
|
|
|
413 |
|
|
switch (regno)
|
414 |
|
|
{
|
415 |
|
|
case PSR_REGNUM:
|
416 |
|
|
word_offset = R_EPSR;
|
417 |
|
|
break;
|
418 |
|
|
case FPSR_REGNUM:
|
419 |
|
|
word_offset = R_FPSR;
|
420 |
|
|
break;
|
421 |
|
|
case FPCR_REGNUM:
|
422 |
|
|
word_offset = R_FPCR;
|
423 |
|
|
break;
|
424 |
|
|
case SXIP_REGNUM:
|
425 |
|
|
word_offset = R_EXIP;
|
426 |
|
|
break;
|
427 |
|
|
case SNIP_REGNUM:
|
428 |
|
|
word_offset = R_ENIP;
|
429 |
|
|
break;
|
430 |
|
|
case SFIP_REGNUM:
|
431 |
|
|
word_offset = R_EFIP;
|
432 |
|
|
break;
|
433 |
|
|
default:
|
434 |
|
|
if (regno <= FP_REGNUM)
|
435 |
|
|
word_offset = regno;
|
436 |
|
|
else
|
437 |
|
|
word_offset = ((regno - X0_REGNUM) * 4);
|
438 |
|
|
}
|
439 |
|
|
return (word_offset * 4);
|
440 |
|
|
}
|
441 |
|
|
|
442 |
|
|
#endif /* _ES_MP */
|
443 |
|
|
|
444 |
|
|
void
|
445 |
|
|
_initialize_m88k_nat (void)
|
446 |
|
|
{
|
447 |
|
|
#ifdef _ES_MP
|
448 |
|
|
/* Enable 88110 support, as we don't support the 88100 under ES/MP. */
|
449 |
|
|
|
450 |
|
|
target_is_m88110 = 1;
|
451 |
|
|
#elif defined(_CX_UX)
|
452 |
|
|
/* Determine whether we're running on an 88100 or an 88110. */
|
453 |
|
|
target_is_m88110 = (sinfo (SYSMACHINE, 0) == SYS5800);
|
454 |
|
|
#endif /* _CX_UX */
|
455 |
|
|
}
|
456 |
|
|
|
457 |
|
|
#ifdef _ES_MP
|
458 |
|
|
/* Given a pointer to a general register set in /proc format (gregset_t *),
|
459 |
|
|
unpack the register contents and supply them as gdb's idea of the current
|
460 |
|
|
register values. */
|
461 |
|
|
|
462 |
|
|
void
|
463 |
|
|
supply_gregset (gregset_t *gregsetp)
|
464 |
|
|
{
|
465 |
|
|
register int regi;
|
466 |
|
|
register greg_t *regp = (greg_t *) gregsetp;
|
467 |
|
|
|
468 |
|
|
for (regi = 0; regi < R_R31; regi++)
|
469 |
|
|
{
|
470 |
|
|
supply_register (regi, (char *) (regp + regi));
|
471 |
|
|
}
|
472 |
|
|
supply_register (PSR_REGNUM, (char *) (regp + R_EPSR));
|
473 |
|
|
supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR));
|
474 |
|
|
supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR));
|
475 |
|
|
supply_register (SXIP_REGNUM, (char *) (regp + R_EXIP));
|
476 |
|
|
supply_register (SNIP_REGNUM, (char *) (regp + R_ENIP));
|
477 |
|
|
supply_register (SFIP_REGNUM, (char *) (regp + R_EFIP));
|
478 |
|
|
}
|
479 |
|
|
|
480 |
|
|
/* Given a pointer to a floating point register set in /proc format
|
481 |
|
|
(fpregset_t *), unpack the register contents and supply them as gdb's
|
482 |
|
|
idea of the current floating point register values. */
|
483 |
|
|
|
484 |
|
|
void
|
485 |
|
|
supply_fpregset (fpregset_t *fpregsetp)
|
486 |
|
|
{
|
487 |
|
|
register int regi;
|
488 |
|
|
char *from;
|
489 |
|
|
|
490 |
|
|
for (regi = FP0_REGNUM; regi <= FPLAST_REGNUM; regi++)
|
491 |
|
|
{
|
492 |
|
|
from = (char *) &((*fpregsetp)[regi - FP0_REGNUM]);
|
493 |
|
|
supply_register (regi, from);
|
494 |
|
|
}
|
495 |
|
|
}
|
496 |
|
|
|
497 |
|
|
#endif /* _ES_MP */
|
498 |
|
|
|
499 |
|
|
#ifdef _CX_UX
|
500 |
|
|
|
501 |
|
|
#include <sys/regset.h>
|
502 |
|
|
|
503 |
|
|
unsigned int
|
504 |
|
|
m88k_harris_core_register_addr (int regno, int reg_ptr)
|
505 |
|
|
{
|
506 |
|
|
unsigned int word_offset;
|
507 |
|
|
|
508 |
|
|
switch (regno)
|
509 |
|
|
{
|
510 |
|
|
case PSR_REGNUM:
|
511 |
|
|
word_offset = R_PSR;
|
512 |
|
|
break;
|
513 |
|
|
case FPSR_REGNUM:
|
514 |
|
|
word_offset = R_FPSR;
|
515 |
|
|
break;
|
516 |
|
|
case FPCR_REGNUM:
|
517 |
|
|
word_offset = R_FPCR;
|
518 |
|
|
break;
|
519 |
|
|
case SXIP_REGNUM:
|
520 |
|
|
word_offset = R_XIP;
|
521 |
|
|
break;
|
522 |
|
|
case SNIP_REGNUM:
|
523 |
|
|
word_offset = R_NIP;
|
524 |
|
|
break;
|
525 |
|
|
case SFIP_REGNUM:
|
526 |
|
|
word_offset = R_FIP;
|
527 |
|
|
break;
|
528 |
|
|
default:
|
529 |
|
|
if (regno <= FP_REGNUM)
|
530 |
|
|
word_offset = regno;
|
531 |
|
|
else
|
532 |
|
|
word_offset = ((regno - X0_REGNUM) * 4) + R_X0;
|
533 |
|
|
}
|
534 |
|
|
return (word_offset * 4);
|
535 |
|
|
}
|
536 |
|
|
|
537 |
|
|
#endif /* _CX_UX */
|