OSDN Git Service

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