2002-11-28 Andrew Cagney <ac131313@redhat.com>
[deliverable/binutils-gdb.git] / gdb / vax-tdep.c
1 /* Print VAX instructions for GDB, the GNU debugger.
2 Copyright 1986, 1989, 1991, 1992, 1995, 1996, 1998, 1999, 2000, 2002
3 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 "symtab.h"
24 #include "opcode/vax.h"
25 #include "gdbcore.h"
26 #include "inferior.h"
27 #include "regcache.h"
28 #include "frame.h"
29 #include "value.h"
30 #include "arch-utils.h"
31 #include "gdb_string.h"
32
33 #include "vax-tdep.h"
34
35 static gdbarch_register_name_ftype vax_register_name;
36 static gdbarch_register_byte_ftype vax_register_byte;
37 static gdbarch_register_raw_size_ftype vax_register_raw_size;
38 static gdbarch_register_virtual_size_ftype vax_register_virtual_size;
39 static gdbarch_register_virtual_type_ftype vax_register_virtual_type;
40
41 static gdbarch_skip_prologue_ftype vax_skip_prologue;
42 static gdbarch_saved_pc_after_call_ftype vax_saved_pc_after_call;
43 static gdbarch_frame_num_args_ftype vax_frame_num_args;
44 static gdbarch_frame_chain_ftype vax_frame_chain;
45 static gdbarch_frame_saved_pc_ftype vax_frame_saved_pc;
46 static gdbarch_frame_args_address_ftype vax_frame_args_address;
47 static gdbarch_frame_locals_address_ftype vax_frame_locals_address;
48 static gdbarch_frame_init_saved_regs_ftype vax_frame_init_saved_regs;
49
50 static gdbarch_store_struct_return_ftype vax_store_struct_return;
51 static gdbarch_deprecated_extract_return_value_ftype vax_extract_return_value;
52 static gdbarch_deprecated_extract_struct_value_address_ftype
53 vax_extract_struct_value_address;
54
55 static gdbarch_push_dummy_frame_ftype vax_push_dummy_frame;
56 static gdbarch_pop_frame_ftype vax_pop_frame;
57 static gdbarch_fix_call_dummy_ftype vax_fix_call_dummy;
58
59 /* Return 1 if P points to an invalid floating point value.
60 LEN is the length in bytes -- not relevant on the Vax. */
61
62 /* FIXME: cagney/2002-01-19: The macro below was originally defined in
63 tm-vax.h and used in values.c. Two problems. Firstly this is a
64 very non-portable and secondly it is wrong. The VAX should be
65 using floatformat and associated methods to identify and handle
66 invalid floating-point values. Adding to the poor target's woes
67 there is no floatformat_vax_{f,d} and no TARGET_FLOAT_FORMAT
68 et.al.. */
69
70 /* FIXME: cagney/2002-01-19: It turns out that the only thing that
71 uses this macro is the vax disassembler code (so how old is this
72 target?). This target should instead be using the opcodes
73 disassembler. That allowing the macro to be eliminated. */
74
75 #define INVALID_FLOAT(p, len) ((*(short *) p & 0xff80) == 0x8000)
76
77 /* Vax instructions are never longer than this. */
78 #define MAXLEN 62
79
80 /* Number of elements in the opcode table. */
81 #define NOPCODES (sizeof votstrs / sizeof votstrs[0])
82
83 static unsigned char *print_insn_arg ();
84 \f
85 static const char *
86 vax_register_name (int regno)
87 {
88 static char *register_names[] =
89 {
90 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
91 "r8", "r9", "r10", "r11", "ap", "fp", "sp", "pc",
92 "ps",
93 };
94
95 if (regno < 0)
96 return (NULL);
97 if (regno >= (sizeof(register_names) / sizeof(*register_names)))
98 return (NULL);
99 return (register_names[regno]);
100 }
101
102 static int
103 vax_register_byte (int regno)
104 {
105 return (regno * 4);
106 }
107
108 static int
109 vax_register_raw_size (int regno)
110 {
111 return (4);
112 }
113
114 static int
115 vax_register_virtual_size (int regno)
116 {
117 return (4);
118 }
119
120 static struct type *
121 vax_register_virtual_type (int regno)
122 {
123 return (builtin_type_int);
124 }
125 \f
126 static void
127 vax_frame_init_saved_regs (struct frame_info *frame)
128 {
129 int regnum, regmask;
130 CORE_ADDR next_addr;
131
132 if (frame->saved_regs)
133 return;
134
135 frame_saved_regs_zalloc (frame);
136
137 regmask = read_memory_integer (frame->frame + 4, 4) >> 16;
138
139 next_addr = frame->frame + 16;
140
141 /* regmask's low bit is for register 0, which is the first one
142 what would be pushed. */
143 for (regnum = 0; regnum < VAX_AP_REGNUM; regnum++)
144 {
145 if (regmask & (1 << regnum))
146 frame->saved_regs[regnum] = next_addr += 4;
147 }
148
149 frame->saved_regs[SP_REGNUM] = next_addr + 4;
150 if (regmask & (1 << FP_REGNUM))
151 frame->saved_regs[SP_REGNUM] +=
152 4 + (4 * read_memory_integer (next_addr + 4, 4));
153
154 frame->saved_regs[PC_REGNUM] = frame->frame + 16;
155 frame->saved_regs[FP_REGNUM] = frame->frame + 12;
156 frame->saved_regs[VAX_AP_REGNUM] = frame->frame + 8;
157 frame->saved_regs[PS_REGNUM] = frame->frame + 4;
158 }
159
160 /* Get saved user PC for sigtramp from sigcontext for BSD style sigtramp. */
161
162 static CORE_ADDR
163 vax_sigtramp_saved_pc (struct frame_info *frame)
164 {
165 CORE_ADDR sigcontext_addr;
166 char *buf;
167 int ptrbytes = TYPE_LENGTH (builtin_type_void_func_ptr);
168 int sigcontext_offs = (2 * TARGET_INT_BIT) / TARGET_CHAR_BIT;
169
170 buf = alloca (ptrbytes);
171 /* Get sigcontext address, it is the third parameter on the stack. */
172 if (frame->next)
173 sigcontext_addr = read_memory_typed_address
174 (FRAME_ARGS_ADDRESS (frame->next) + FRAME_ARGS_SKIP + sigcontext_offs,
175 builtin_type_void_data_ptr);
176 else
177 sigcontext_addr = read_memory_typed_address
178 (read_register (SP_REGNUM) + sigcontext_offs, builtin_type_void_data_ptr);
179
180 /* Don't cause a memory_error when accessing sigcontext in case the stack
181 layout has changed or the stack is corrupt. */
182 target_read_memory (sigcontext_addr + SIGCONTEXT_PC_OFFSET, buf, ptrbytes);
183 return extract_typed_address (buf, builtin_type_void_func_ptr);
184 }
185
186 static CORE_ADDR
187 vax_frame_saved_pc (struct frame_info *frame)
188 {
189 if ((get_frame_type (frame) == SIGTRAMP_FRAME))
190 return (vax_sigtramp_saved_pc (frame)); /* XXXJRT */
191
192 return (read_memory_integer (frame->frame + 16, 4));
193 }
194
195 CORE_ADDR
196 vax_frame_args_address_correct (struct frame_info *frame)
197 {
198 /* Cannot find the AP register value directly from the FP value. Must
199 find it saved in the frame called by this one, or in the AP register
200 for the innermost frame. However, there is no way to tell the
201 difference between the innermost frame and a frame for which we
202 just don't know the frame that it called (e.g. "info frame 0x7ffec789").
203 For the sake of argument, suppose that the stack is somewhat trashed
204 (which is one reason that "info frame" exists). So, return 0 (indicating
205 we don't know the address of the arglist) if we don't know what frame
206 this frame calls. */
207 if (frame->next)
208 return (read_memory_integer (frame->next->frame + 8, 4));
209
210 return (0);
211 }
212
213 static CORE_ADDR
214 vax_frame_args_address (struct frame_info *frame)
215 {
216 /* In most of GDB, getting the args address is too important to
217 just say "I don't know". This is sometimes wrong for functions
218 that aren't on top of the stack, but c'est la vie. */
219 if (frame->next)
220 return (read_memory_integer (frame->next->frame + 8, 4));
221
222 return (read_register (VAX_AP_REGNUM));
223 }
224
225 static CORE_ADDR
226 vax_frame_locals_address (struct frame_info *frame)
227 {
228 return (frame->frame);
229 }
230
231 static int
232 vax_frame_num_args (struct frame_info *fi)
233 {
234 return (0xff & read_memory_integer (FRAME_ARGS_ADDRESS (fi), 1));
235 }
236
237 static CORE_ADDR
238 vax_frame_chain (struct frame_info *frame)
239 {
240 /* In the case of the VAX, the frame's nominal address is the FP value,
241 and 12 bytes later comes the saved previous FP value as a 4-byte word. */
242 if (inside_entry_file (frame->pc))
243 return (0);
244
245 return (read_memory_integer (frame->frame + 12, 4));
246 }
247 \f
248 static void
249 vax_push_dummy_frame (void)
250 {
251 CORE_ADDR sp = read_register (SP_REGNUM);
252 int regnum;
253
254 sp = push_word (sp, 0); /* arglist */
255 for (regnum = 11; regnum >= 0; regnum--)
256 sp = push_word (sp, read_register (regnum));
257 sp = push_word (sp, read_register (PC_REGNUM));
258 sp = push_word (sp, read_register (FP_REGNUM));
259 sp = push_word (sp, read_register (VAX_AP_REGNUM));
260 sp = push_word (sp, (read_register (PS_REGNUM) & 0xffef) + 0x2fff0000);
261 sp = push_word (sp, 0);
262 write_register (SP_REGNUM, sp);
263 write_register (FP_REGNUM, sp);
264 write_register (VAX_AP_REGNUM, sp + (17 * 4));
265 }
266
267 static void
268 vax_pop_frame (void)
269 {
270 CORE_ADDR fp = read_register (FP_REGNUM);
271 int regnum;
272 int regmask = read_memory_integer (fp + 4, 4);
273
274 write_register (PS_REGNUM,
275 (regmask & 0xffff)
276 | (read_register (PS_REGNUM) & 0xffff0000));
277 write_register (PC_REGNUM, read_memory_integer (fp + 16, 4));
278 write_register (FP_REGNUM, read_memory_integer (fp + 12, 4));
279 write_register (VAX_AP_REGNUM, read_memory_integer (fp + 8, 4));
280 fp += 16;
281 for (regnum = 0; regnum < 12; regnum++)
282 if (regmask & (0x10000 << regnum))
283 write_register (regnum, read_memory_integer (fp += 4, 4));
284 fp = fp + 4 + ((regmask >> 30) & 3);
285 if (regmask & 0x20000000)
286 {
287 regnum = read_memory_integer (fp, 4);
288 fp += (regnum + 1) * 4;
289 }
290 write_register (SP_REGNUM, fp);
291 flush_cached_frames ();
292 }
293
294 /* The VAX call dummy sequence:
295
296 calls #69, @#32323232
297 bpt
298
299 It is 8 bytes long. The address and argc are patched by
300 vax_fix_call_dummy(). */
301 static LONGEST vax_call_dummy_words[] = { 0x329f69fb, 0x03323232 };
302 static int sizeof_vax_call_dummy_words = sizeof(vax_call_dummy_words);
303
304 static void
305 vax_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
306 struct value **args, struct type *type, int gcc_p)
307 {
308 dummy[1] = nargs;
309 store_unsigned_integer (dummy + 3, 4, fun);
310 }
311 \f
312 static void
313 vax_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
314 {
315 write_register (1, addr);
316 }
317
318 static void
319 vax_extract_return_value (struct type *valtype, char *regbuf, char *valbuf)
320 {
321 memcpy (valbuf, regbuf + REGISTER_BYTE (0), TYPE_LENGTH (valtype));
322 }
323
324 static void
325 vax_store_return_value (struct type *valtype, char *valbuf)
326 {
327 deprecated_write_register_bytes (0, valbuf, TYPE_LENGTH (valtype));
328 }
329
330 static CORE_ADDR
331 vax_extract_struct_value_address (char *regbuf)
332 {
333 return (extract_address (regbuf + REGISTER_BYTE (0), REGISTER_RAW_SIZE (0)));
334 }
335 \f
336 static const unsigned char *
337 vax_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
338 {
339 static const unsigned char vax_breakpoint[] = { 3 };
340
341 *lenptr = sizeof(vax_breakpoint);
342 return (vax_breakpoint);
343 }
344 \f
345 /* Advance PC across any function entry prologue instructions
346 to reach some "real" code. */
347
348 static CORE_ADDR
349 vax_skip_prologue (CORE_ADDR pc)
350 {
351 register int op = (unsigned char) read_memory_integer (pc, 1);
352 if (op == 0x11)
353 pc += 2; /* skip brb */
354 if (op == 0x31)
355 pc += 3; /* skip brw */
356 if (op == 0xC2
357 && ((unsigned char) read_memory_integer (pc + 2, 1)) == 0x5E)
358 pc += 3; /* skip subl2 */
359 if (op == 0x9E
360 && ((unsigned char) read_memory_integer (pc + 1, 1)) == 0xAE
361 && ((unsigned char) read_memory_integer (pc + 3, 1)) == 0x5E)
362 pc += 4; /* skip movab */
363 if (op == 0x9E
364 && ((unsigned char) read_memory_integer (pc + 1, 1)) == 0xCE
365 && ((unsigned char) read_memory_integer (pc + 4, 1)) == 0x5E)
366 pc += 5; /* skip movab */
367 if (op == 0x9E
368 && ((unsigned char) read_memory_integer (pc + 1, 1)) == 0xEE
369 && ((unsigned char) read_memory_integer (pc + 6, 1)) == 0x5E)
370 pc += 7; /* skip movab */
371 return pc;
372 }
373
374 static CORE_ADDR
375 vax_saved_pc_after_call (struct frame_info *frame)
376 {
377 return (FRAME_SAVED_PC(frame));
378 }
379 \f
380 /* Print the vax instruction at address MEMADDR in debugged memory,
381 from disassembler info INFO.
382 Returns length of the instruction, in bytes. */
383
384 static int
385 vax_print_insn (CORE_ADDR memaddr, disassemble_info *info)
386 {
387 unsigned char buffer[MAXLEN];
388 register int i;
389 register unsigned char *p;
390 const char *d;
391
392 int status = (*info->read_memory_func) (memaddr, buffer, MAXLEN, info);
393 if (status != 0)
394 {
395 (*info->memory_error_func) (status, memaddr, info);
396 return -1;
397 }
398
399 for (i = 0; i < NOPCODES; i++)
400 if (votstrs[i].detail.code == buffer[0]
401 || votstrs[i].detail.code == *(unsigned short *) buffer)
402 break;
403
404 /* Handle undefined instructions. */
405 if (i == NOPCODES)
406 {
407 (*info->fprintf_func) (info->stream, "0%o", buffer[0]);
408 return 1;
409 }
410
411 (*info->fprintf_func) (info->stream, "%s", votstrs[i].name);
412
413 /* Point at first byte of argument data,
414 and at descriptor for first argument. */
415 p = buffer + 1 + (votstrs[i].detail.code >= 0x100);
416 d = votstrs[i].detail.args;
417
418 if (*d)
419 (*info->fprintf_func) (info->stream, " ");
420
421 while (*d)
422 {
423 p = print_insn_arg (d, p, memaddr + (p - buffer), info);
424 d += 2;
425 if (*d)
426 (*info->fprintf_func) (info->stream, ",");
427 }
428 return p - buffer;
429 }
430 \f
431 static unsigned char *
432 print_insn_arg (char *d, register char *p, CORE_ADDR addr,
433 disassemble_info *info)
434 {
435 register int regnum = *p & 0xf;
436 float floatlitbuf;
437
438 if (*d == 'b')
439 {
440 if (d[1] == 'b')
441 (*info->fprintf_func) (info->stream, "0x%x", addr + *p++ + 1);
442 else
443 {
444 (*info->fprintf_func) (info->stream, "0x%x", addr + *(short *) p + 2);
445 p += 2;
446 }
447 }
448 else
449 switch ((*p++ >> 4) & 0xf)
450 {
451 case 0:
452 case 1:
453 case 2:
454 case 3: /* Literal mode */
455 if (d[1] == 'd' || d[1] == 'f' || d[1] == 'g' || d[1] == 'h')
456 {
457 *(int *) &floatlitbuf = 0x4000 + ((p[-1] & 0x3f) << 4);
458 (*info->fprintf_func) (info->stream, "$%f", floatlitbuf);
459 }
460 else
461 (*info->fprintf_func) (info->stream, "$%d", p[-1] & 0x3f);
462 break;
463
464 case 4: /* Indexed */
465 p = (char *) print_insn_arg (d, p, addr + 1, info);
466 (*info->fprintf_func) (info->stream, "[%s]", REGISTER_NAME (regnum));
467 break;
468
469 case 5: /* Register */
470 (*info->fprintf_func) (info->stream, REGISTER_NAME (regnum));
471 break;
472
473 case 7: /* Autodecrement */
474 (*info->fprintf_func) (info->stream, "-");
475 case 6: /* Register deferred */
476 (*info->fprintf_func) (info->stream, "(%s)", REGISTER_NAME (regnum));
477 break;
478
479 case 9: /* Autoincrement deferred */
480 (*info->fprintf_func) (info->stream, "@");
481 if (regnum == PC_REGNUM)
482 {
483 (*info->fprintf_func) (info->stream, "#");
484 info->target = *(long *) p;
485 (*info->print_address_func) (info->target, info);
486 p += 4;
487 break;
488 }
489 case 8: /* Autoincrement */
490 if (regnum == PC_REGNUM)
491 {
492 (*info->fprintf_func) (info->stream, "#");
493 switch (d[1])
494 {
495 case 'b':
496 (*info->fprintf_func) (info->stream, "%d", *p++);
497 break;
498
499 case 'w':
500 (*info->fprintf_func) (info->stream, "%d", *(short *) p);
501 p += 2;
502 break;
503
504 case 'l':
505 (*info->fprintf_func) (info->stream, "%d", *(long *) p);
506 p += 4;
507 break;
508
509 case 'q':
510 (*info->fprintf_func) (info->stream, "0x%x%08x",
511 ((long *) p)[1], ((long *) p)[0]);
512 p += 8;
513 break;
514
515 case 'o':
516 (*info->fprintf_func) (info->stream, "0x%x%08x%08x%08x",
517 ((long *) p)[3], ((long *) p)[2],
518 ((long *) p)[1], ((long *) p)[0]);
519 p += 16;
520 break;
521
522 case 'f':
523 if (INVALID_FLOAT (p, 4))
524 (*info->fprintf_func) (info->stream,
525 "<<invalid float 0x%x>>",
526 *(int *) p);
527 else
528 (*info->fprintf_func) (info->stream, "%f", *(float *) p);
529 p += 4;
530 break;
531
532 case 'd':
533 if (INVALID_FLOAT (p, 8))
534 (*info->fprintf_func) (info->stream,
535 "<<invalid float 0x%x%08x>>",
536 ((long *) p)[1], ((long *) p)[0]);
537 else
538 (*info->fprintf_func) (info->stream, "%f", *(double *) p);
539 p += 8;
540 break;
541
542 case 'g':
543 (*info->fprintf_func) (info->stream, "g-float");
544 p += 8;
545 break;
546
547 case 'h':
548 (*info->fprintf_func) (info->stream, "h-float");
549 p += 16;
550 break;
551
552 }
553 }
554 else
555 (*info->fprintf_func) (info->stream, "(%s)+", REGISTER_NAME (regnum));
556 break;
557
558 case 11: /* Byte displacement deferred */
559 (*info->fprintf_func) (info->stream, "@");
560 case 10: /* Byte displacement */
561 if (regnum == PC_REGNUM)
562 {
563 info->target = addr + *p + 2;
564 (*info->print_address_func) (info->target, info);
565 }
566 else
567 (*info->fprintf_func) (info->stream, "%d(%s)", *p, REGISTER_NAME (regnum));
568 p += 1;
569 break;
570
571 case 13: /* Word displacement deferred */
572 (*info->fprintf_func) (info->stream, "@");
573 case 12: /* Word displacement */
574 if (regnum == PC_REGNUM)
575 {
576 info->target = addr + *(short *) p + 3;
577 (*info->print_address_func) (info->target, info);
578 }
579 else
580 (*info->fprintf_func) (info->stream, "%d(%s)",
581 *(short *) p, REGISTER_NAME (regnum));
582 p += 2;
583 break;
584
585 case 15: /* Long displacement deferred */
586 (*info->fprintf_func) (info->stream, "@");
587 case 14: /* Long displacement */
588 if (regnum == PC_REGNUM)
589 {
590 info->target = addr + *(short *) p + 5;
591 (*info->print_address_func) (info->target, info);
592 }
593 else
594 (*info->fprintf_func) (info->stream, "%d(%s)",
595 *(long *) p, REGISTER_NAME (regnum));
596 p += 4;
597 }
598
599 return (unsigned char *) p;
600 }
601 \f
602 /* Initialize the current architecture based on INFO. If possible, re-use an
603 architecture from ARCHES, which is a list of architectures already created
604 during this debugging session.
605
606 Called e.g. at program startup, when reading a core file, and when reading
607 a binary file. */
608
609 static struct gdbarch *
610 vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
611 {
612 struct gdbarch_tdep *tdep;
613 struct gdbarch *gdbarch;
614 enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
615
616 /* Try to determine the ABI of the object we are loading. */
617
618 if (info.abfd != NULL)
619 osabi = gdbarch_lookup_osabi (info.abfd);
620
621 /* Find a candidate among extant architectures. */
622 for (arches = gdbarch_list_lookup_by_info (arches, &info);
623 arches != NULL;
624 arches = gdbarch_list_lookup_by_info (arches->next, &info))
625 {
626 /* Make sure the ABI selection matches. */
627 tdep = gdbarch_tdep (arches->gdbarch);
628 if (tdep && tdep->osabi == osabi)
629 return arches->gdbarch;
630 }
631
632 tdep = xmalloc (sizeof (struct gdbarch_tdep));
633 gdbarch = gdbarch_alloc (&info, tdep);
634
635 tdep->osabi = osabi;
636
637 /* Register info */
638 set_gdbarch_num_regs (gdbarch, VAX_NUM_REGS);
639 set_gdbarch_sp_regnum (gdbarch, VAX_SP_REGNUM);
640 set_gdbarch_fp_regnum (gdbarch, VAX_FP_REGNUM);
641 set_gdbarch_pc_regnum (gdbarch, VAX_PC_REGNUM);
642 set_gdbarch_ps_regnum (gdbarch, VAX_PS_REGNUM);
643
644 set_gdbarch_register_name (gdbarch, vax_register_name);
645 set_gdbarch_register_size (gdbarch, VAX_REGISTER_SIZE);
646 set_gdbarch_register_bytes (gdbarch, VAX_REGISTER_BYTES);
647 set_gdbarch_register_byte (gdbarch, vax_register_byte);
648 set_gdbarch_register_raw_size (gdbarch, vax_register_raw_size);
649 set_gdbarch_max_register_raw_size (gdbarch, VAX_MAX_REGISTER_RAW_SIZE);
650 set_gdbarch_register_virtual_size (gdbarch, vax_register_virtual_size);
651 set_gdbarch_max_register_virtual_size (gdbarch,
652 VAX_MAX_REGISTER_VIRTUAL_SIZE);
653 set_gdbarch_register_virtual_type (gdbarch, vax_register_virtual_type);
654
655 /* Frame and stack info */
656 set_gdbarch_skip_prologue (gdbarch, vax_skip_prologue);
657 set_gdbarch_saved_pc_after_call (gdbarch, vax_saved_pc_after_call);
658
659 set_gdbarch_frame_num_args (gdbarch, vax_frame_num_args);
660 set_gdbarch_frameless_function_invocation (gdbarch,
661 generic_frameless_function_invocation_not);
662
663 set_gdbarch_frame_chain (gdbarch, vax_frame_chain);
664 set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid);
665 set_gdbarch_frame_saved_pc (gdbarch, vax_frame_saved_pc);
666
667 set_gdbarch_frame_args_address (gdbarch, vax_frame_args_address);
668 set_gdbarch_frame_locals_address (gdbarch, vax_frame_locals_address);
669
670 set_gdbarch_frame_init_saved_regs (gdbarch, vax_frame_init_saved_regs);
671
672 set_gdbarch_frame_args_skip (gdbarch, 4);
673
674 set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
675
676 /* Return value info */
677 set_gdbarch_store_struct_return (gdbarch, vax_store_struct_return);
678 set_gdbarch_deprecated_extract_return_value (gdbarch, vax_extract_return_value);
679 set_gdbarch_deprecated_store_return_value (gdbarch, vax_store_return_value);
680 set_gdbarch_deprecated_extract_struct_value_address (gdbarch, vax_extract_struct_value_address);
681
682 /* Call dummy info */
683 set_gdbarch_push_dummy_frame (gdbarch, vax_push_dummy_frame);
684 set_gdbarch_pop_frame (gdbarch, vax_pop_frame);
685 set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
686 set_gdbarch_call_dummy_p (gdbarch, 1);
687 set_gdbarch_call_dummy_words (gdbarch, vax_call_dummy_words);
688 set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof_vax_call_dummy_words);
689 set_gdbarch_fix_call_dummy (gdbarch, vax_fix_call_dummy);
690 set_gdbarch_call_dummy_start_offset (gdbarch, 0);
691 set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
692 set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 7);
693 set_gdbarch_deprecated_use_generic_dummy_frames (gdbarch, 0);
694 set_gdbarch_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_on_stack);
695 set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
696
697 /* Breakpoint info */
698 set_gdbarch_breakpoint_from_pc (gdbarch, vax_breakpoint_from_pc);
699 set_gdbarch_decr_pc_after_break (gdbarch, 0);
700
701 /* Misc info */
702 set_gdbarch_function_start_offset (gdbarch, 2);
703 set_gdbarch_believe_pcc_promotion (gdbarch, 1);
704
705 /* Hook in ABI-specific overrides, if they have been registered. */
706 gdbarch_init_osabi (info, gdbarch, osabi);
707
708 return (gdbarch);
709 }
710
711 static void
712 vax_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
713 {
714 struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
715
716 if (tdep == NULL)
717 return;
718
719 fprintf_unfiltered (file, "vax_dump_tdep: OS ABI = %s\n",
720 gdbarch_osabi_name (tdep->osabi));
721 }
722
723 void
724 _initialize_vax_tdep (void)
725 {
726 gdbarch_register (bfd_arch_vax, vax_gdbarch_init, vax_dump_tdep);
727
728 tm_print_insn = vax_print_insn;
729 }
This page took 0.048271 seconds and 5 git commands to generate.