OSDN Git Service

2002-09-27 David Carlton <carlton@math.stanford.edu>
[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
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 static CORE_ADDR
161 vax_frame_saved_pc (struct frame_info *frame)
162 {
163   if (frame->signal_handler_caller)
164     return (sigtramp_saved_pc (frame)); /* XXXJRT */
165
166   return (read_memory_integer (frame->frame + 16, 4));
167 }
168
169 CORE_ADDR
170 vax_frame_args_address_correct (struct frame_info *frame)
171 {
172   /* Cannot find the AP register value directly from the FP value.  Must
173      find it saved in the frame called by this one, or in the AP register
174      for the innermost frame.  However, there is no way to tell the
175      difference between the innermost frame and a frame for which we
176      just don't know the frame that it called (e.g. "info frame 0x7ffec789").
177      For the sake of argument, suppose that the stack is somewhat trashed
178      (which is one reason that "info frame" exists).  So, return 0 (indicating
179      we don't know the address of the arglist) if we don't know what frame
180      this frame calls.  */
181   if (frame->next)
182     return (read_memory_integer (frame->next->frame + 8, 4));
183
184   return (0);
185 }
186
187 static CORE_ADDR
188 vax_frame_args_address (struct frame_info *frame)
189 {
190   /* In most of GDB, getting the args address is too important to
191      just say "I don't know".  This is sometimes wrong for functions
192      that aren't on top of the stack, but c'est la vie.  */
193   if (frame->next)
194     return (read_memory_integer (frame->next->frame + 8, 4));
195
196   return (read_register (VAX_AP_REGNUM));
197 }
198
199 static CORE_ADDR
200 vax_frame_locals_address (struct frame_info *frame)
201 {
202   return (frame->frame);
203 }
204
205 static int
206 vax_frame_num_args (struct frame_info *fi)
207 {
208   return (0xff & read_memory_integer (FRAME_ARGS_ADDRESS (fi), 1));
209 }
210
211 static CORE_ADDR
212 vax_frame_chain (struct frame_info *frame)
213 {
214   /* In the case of the VAX, the frame's nominal address is the FP value,
215      and 12 bytes later comes the saved previous FP value as a 4-byte word.  */
216   if (inside_entry_file (frame->pc))
217     return (0);
218
219   return (read_memory_integer (frame->frame + 12, 4));
220 }
221 \f
222 static void
223 vax_push_dummy_frame (void)
224 {
225   CORE_ADDR sp = read_register (SP_REGNUM);
226   int regnum;
227
228   sp = push_word (sp, 0);       /* arglist */
229   for (regnum = 11; regnum >= 0; regnum--)
230     sp = push_word (sp, read_register (regnum));
231   sp = push_word (sp, read_register (PC_REGNUM));
232   sp = push_word (sp, read_register (FP_REGNUM));
233   sp = push_word (sp, read_register (VAX_AP_REGNUM));
234   sp = push_word (sp, (read_register (PS_REGNUM) & 0xffef) + 0x2fff0000);
235   sp = push_word (sp, 0);
236   write_register (SP_REGNUM, sp);
237   write_register (FP_REGNUM, sp);
238   write_register (VAX_AP_REGNUM, sp + (17 * 4));
239 }
240
241 static void
242 vax_pop_frame (void)
243 {
244   CORE_ADDR fp = read_register (FP_REGNUM);
245   int regnum;
246   int regmask = read_memory_integer (fp + 4, 4);
247
248   write_register (PS_REGNUM,
249                   (regmask & 0xffff)
250                   | (read_register (PS_REGNUM) & 0xffff0000));
251   write_register (PC_REGNUM, read_memory_integer (fp + 16, 4));
252   write_register (FP_REGNUM, read_memory_integer (fp + 12, 4));
253   write_register (VAX_AP_REGNUM, read_memory_integer (fp + 8, 4));
254   fp += 16;
255   for (regnum = 0; regnum < 12; regnum++)
256     if (regmask & (0x10000 << regnum))
257       write_register (regnum, read_memory_integer (fp += 4, 4));
258   fp = fp + 4 + ((regmask >> 30) & 3);
259   if (regmask & 0x20000000)
260     {
261       regnum = read_memory_integer (fp, 4);
262       fp += (regnum + 1) * 4;
263     }
264   write_register (SP_REGNUM, fp);
265   flush_cached_frames ();
266 }
267
268 /* The VAX call dummy sequence:
269
270         calls #69, @#32323232
271         bpt
272
273    It is 8 bytes long.  The address and argc are patched by
274    vax_fix_call_dummy().  */
275 static LONGEST vax_call_dummy_words[] = { 0x329f69fb, 0x03323232 };
276 static int sizeof_vax_call_dummy_words = sizeof(vax_call_dummy_words);
277
278 static void
279 vax_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
280                     struct value **args, struct type *type, int gcc_p)
281 {
282   dummy[1] = nargs;
283   store_unsigned_integer (dummy + 3, 4, fun);
284 }
285 \f
286 static void
287 vax_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
288 {
289   write_register (1, addr);
290 }
291
292 static void
293 vax_extract_return_value (struct type *valtype, char *regbuf, char *valbuf)
294 {
295   memcpy (valbuf, regbuf + REGISTER_BYTE (0), TYPE_LENGTH (valtype));
296 }
297
298 static void
299 vax_store_return_value (struct type *valtype, char *valbuf)
300 {
301   write_register_bytes (0, valbuf, TYPE_LENGTH (valtype));
302 }
303
304 static CORE_ADDR
305 vax_extract_struct_value_address (char *regbuf)
306 {
307   return (extract_address (regbuf + REGISTER_BYTE (0), REGISTER_RAW_SIZE (0)));
308 }
309 \f
310 static const unsigned char *
311 vax_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
312 {
313   static const unsigned char vax_breakpoint[] = { 3 };
314
315   *lenptr = sizeof(vax_breakpoint);
316   return (vax_breakpoint);
317 }
318 \f
319 /* Advance PC across any function entry prologue instructions
320    to reach some "real" code.  */
321
322 static CORE_ADDR
323 vax_skip_prologue (CORE_ADDR pc)
324 {
325   register int op = (unsigned char) read_memory_integer (pc, 1);
326   if (op == 0x11)
327     pc += 2;                    /* skip brb */
328   if (op == 0x31)
329     pc += 3;                    /* skip brw */
330   if (op == 0xC2
331       && ((unsigned char) read_memory_integer (pc + 2, 1)) == 0x5E)
332     pc += 3;                    /* skip subl2 */
333   if (op == 0x9E
334       && ((unsigned char) read_memory_integer (pc + 1, 1)) == 0xAE
335       && ((unsigned char) read_memory_integer (pc + 3, 1)) == 0x5E)
336     pc += 4;                    /* skip movab */
337   if (op == 0x9E
338       && ((unsigned char) read_memory_integer (pc + 1, 1)) == 0xCE
339       && ((unsigned char) read_memory_integer (pc + 4, 1)) == 0x5E)
340     pc += 5;                    /* skip movab */
341   if (op == 0x9E
342       && ((unsigned char) read_memory_integer (pc + 1, 1)) == 0xEE
343       && ((unsigned char) read_memory_integer (pc + 6, 1)) == 0x5E)
344     pc += 7;                    /* skip movab */
345   return pc;
346 }
347
348 static CORE_ADDR
349 vax_saved_pc_after_call (struct frame_info *frame)
350 {
351   return (FRAME_SAVED_PC(frame));
352 }
353 \f
354 /* Print the vax instruction at address MEMADDR in debugged memory,
355    from disassembler info INFO.
356    Returns length of the instruction, in bytes.  */
357
358 static int
359 vax_print_insn (CORE_ADDR memaddr, disassemble_info *info)
360 {
361   unsigned char buffer[MAXLEN];
362   register int i;
363   register unsigned char *p;
364   const char *d;
365
366   int status = (*info->read_memory_func) (memaddr, buffer, MAXLEN, info);
367   if (status != 0)
368     {
369       (*info->memory_error_func) (status, memaddr, info);
370       return -1;
371     }
372
373   for (i = 0; i < NOPCODES; i++)
374     if (votstrs[i].detail.code == buffer[0]
375         || votstrs[i].detail.code == *(unsigned short *) buffer)
376       break;
377
378   /* Handle undefined instructions.  */
379   if (i == NOPCODES)
380     {
381       (*info->fprintf_func) (info->stream, "0%o", buffer[0]);
382       return 1;
383     }
384
385   (*info->fprintf_func) (info->stream, "%s", votstrs[i].name);
386
387   /* Point at first byte of argument data,
388      and at descriptor for first argument.  */
389   p = buffer + 1 + (votstrs[i].detail.code >= 0x100);
390   d = votstrs[i].detail.args;
391
392   if (*d)
393     (*info->fprintf_func) (info->stream, " ");
394
395   while (*d)
396     {
397       p = print_insn_arg (d, p, memaddr + (p - buffer), info);
398       d += 2;
399       if (*d)
400         (*info->fprintf_func) (info->stream, ",");
401     }
402   return p - buffer;
403 }
404 \f
405 static unsigned char *
406 print_insn_arg (char *d, register char *p, CORE_ADDR addr,
407                 disassemble_info *info)
408 {
409   register int regnum = *p & 0xf;
410   float floatlitbuf;
411
412   if (*d == 'b')
413     {
414       if (d[1] == 'b')
415         (*info->fprintf_func) (info->stream, "0x%x", addr + *p++ + 1);
416       else
417         {
418           (*info->fprintf_func) (info->stream, "0x%x", addr + *(short *) p + 2);
419           p += 2;
420         }
421     }
422   else
423     switch ((*p++ >> 4) & 0xf)
424       {
425       case 0:
426       case 1:
427       case 2:
428       case 3:                   /* Literal mode */
429         if (d[1] == 'd' || d[1] == 'f' || d[1] == 'g' || d[1] == 'h')
430           {
431             *(int *) &floatlitbuf = 0x4000 + ((p[-1] & 0x3f) << 4);
432             (*info->fprintf_func) (info->stream, "$%f", floatlitbuf);
433           }
434         else
435           (*info->fprintf_func) (info->stream, "$%d", p[-1] & 0x3f);
436         break;
437
438       case 4:                   /* Indexed */
439         p = (char *) print_insn_arg (d, p, addr + 1, info);
440         (*info->fprintf_func) (info->stream, "[%s]", REGISTER_NAME (regnum));
441         break;
442
443       case 5:                   /* Register */
444         (*info->fprintf_func) (info->stream, REGISTER_NAME (regnum));
445         break;
446
447       case 7:                   /* Autodecrement */
448         (*info->fprintf_func) (info->stream, "-");
449       case 6:                   /* Register deferred */
450         (*info->fprintf_func) (info->stream, "(%s)", REGISTER_NAME (regnum));
451         break;
452
453       case 9:                   /* Autoincrement deferred */
454         (*info->fprintf_func) (info->stream, "@");
455         if (regnum == PC_REGNUM)
456           {
457             (*info->fprintf_func) (info->stream, "#");
458             info->target = *(long *) p;
459             (*info->print_address_func) (info->target, info);
460             p += 4;
461             break;
462           }
463       case 8:                   /* Autoincrement */
464         if (regnum == PC_REGNUM)
465           {
466             (*info->fprintf_func) (info->stream, "#");
467             switch (d[1])
468               {
469               case 'b':
470                 (*info->fprintf_func) (info->stream, "%d", *p++);
471                 break;
472
473               case 'w':
474                 (*info->fprintf_func) (info->stream, "%d", *(short *) p);
475                 p += 2;
476                 break;
477
478               case 'l':
479                 (*info->fprintf_func) (info->stream, "%d", *(long *) p);
480                 p += 4;
481                 break;
482
483               case 'q':
484                 (*info->fprintf_func) (info->stream, "0x%x%08x",
485                                        ((long *) p)[1], ((long *) p)[0]);
486                 p += 8;
487                 break;
488
489               case 'o':
490                 (*info->fprintf_func) (info->stream, "0x%x%08x%08x%08x",
491                                        ((long *) p)[3], ((long *) p)[2],
492                                        ((long *) p)[1], ((long *) p)[0]);
493                 p += 16;
494                 break;
495
496               case 'f':
497                 if (INVALID_FLOAT (p, 4))
498                   (*info->fprintf_func) (info->stream,
499                                          "<<invalid float 0x%x>>",
500                                          *(int *) p);
501                 else
502                   (*info->fprintf_func) (info->stream, "%f", *(float *) p);
503                 p += 4;
504                 break;
505
506               case 'd':
507                 if (INVALID_FLOAT (p, 8))
508                   (*info->fprintf_func) (info->stream,
509                                          "<<invalid float 0x%x%08x>>",
510                                          ((long *) p)[1], ((long *) p)[0]);
511                 else
512                   (*info->fprintf_func) (info->stream, "%f", *(double *) p);
513                 p += 8;
514                 break;
515
516               case 'g':
517                 (*info->fprintf_func) (info->stream, "g-float");
518                 p += 8;
519                 break;
520
521               case 'h':
522                 (*info->fprintf_func) (info->stream, "h-float");
523                 p += 16;
524                 break;
525
526               }
527           }
528         else
529           (*info->fprintf_func) (info->stream, "(%s)+", REGISTER_NAME (regnum));
530         break;
531
532       case 11:                  /* Byte displacement deferred */
533         (*info->fprintf_func) (info->stream, "@");
534       case 10:                  /* Byte displacement */
535         if (regnum == PC_REGNUM)
536           {
537             info->target = addr + *p + 2;
538             (*info->print_address_func) (info->target, info);
539           }
540         else
541           (*info->fprintf_func) (info->stream, "%d(%s)", *p, REGISTER_NAME (regnum));
542         p += 1;
543         break;
544
545       case 13:                  /* Word displacement deferred */
546         (*info->fprintf_func) (info->stream, "@");
547       case 12:                  /* Word displacement */
548         if (regnum == PC_REGNUM)
549           {
550             info->target = addr + *(short *) p + 3;
551             (*info->print_address_func) (info->target, info);
552           }
553         else
554           (*info->fprintf_func) (info->stream, "%d(%s)",
555                                  *(short *) p, REGISTER_NAME (regnum));
556         p += 2;
557         break;
558
559       case 15:                  /* Long displacement deferred */
560         (*info->fprintf_func) (info->stream, "@");
561       case 14:                  /* Long displacement */
562         if (regnum == PC_REGNUM)
563           {
564             info->target = addr + *(short *) p + 5;
565             (*info->print_address_func) (info->target, info);
566           }
567         else
568           (*info->fprintf_func) (info->stream, "%d(%s)",
569                                  *(long *) p, REGISTER_NAME (regnum));
570         p += 4;
571       }
572
573   return (unsigned char *) p;
574 }
575 \f
576 /* Initialize the current architecture based on INFO.  If possible, re-use an
577    architecture from ARCHES, which is a list of architectures already created
578    during this debugging session.
579
580    Called e.g. at program startup, when reading a core file, and when reading
581    a binary file.  */
582
583 static struct gdbarch *
584 vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
585 {
586   struct gdbarch_tdep *tdep;
587   struct gdbarch *gdbarch;
588   enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
589
590   /* Try to determine the ABI of the object we are loading.  */
591
592   if (info.abfd != NULL)
593     osabi = gdbarch_lookup_osabi (info.abfd);
594
595   /* Find a candidate among extant architectures.  */
596   for (arches = gdbarch_list_lookup_by_info (arches, &info);
597        arches != NULL;
598        arches = gdbarch_list_lookup_by_info (arches->next, &info))
599     {
600       /* Make sure the ABI selection matches.  */
601       tdep = gdbarch_tdep (arches->gdbarch);
602       if (tdep && tdep->osabi == osabi)
603         return arches->gdbarch;
604     }
605
606   tdep = xmalloc (sizeof (struct gdbarch_tdep));
607   gdbarch = gdbarch_alloc (&info, tdep);
608
609   tdep->osabi = osabi;
610
611   /* Register info */
612   set_gdbarch_num_regs (gdbarch, VAX_NUM_REGS);
613   set_gdbarch_sp_regnum (gdbarch, VAX_SP_REGNUM);
614   set_gdbarch_fp_regnum (gdbarch, VAX_FP_REGNUM);
615   set_gdbarch_pc_regnum (gdbarch, VAX_PC_REGNUM);
616   set_gdbarch_ps_regnum (gdbarch, VAX_PS_REGNUM);
617
618   set_gdbarch_register_name (gdbarch, vax_register_name);
619   set_gdbarch_register_size (gdbarch, VAX_REGISTER_SIZE);
620   set_gdbarch_register_bytes (gdbarch, VAX_REGISTER_BYTES);
621   set_gdbarch_register_byte (gdbarch, vax_register_byte);
622   set_gdbarch_register_raw_size (gdbarch, vax_register_raw_size);
623   set_gdbarch_max_register_raw_size (gdbarch, VAX_MAX_REGISTER_RAW_SIZE);
624   set_gdbarch_register_virtual_size (gdbarch, vax_register_virtual_size);
625   set_gdbarch_max_register_virtual_size (gdbarch,
626                                          VAX_MAX_REGISTER_VIRTUAL_SIZE);
627   set_gdbarch_register_virtual_type (gdbarch, vax_register_virtual_type);
628
629   /* Frame and stack info */
630   set_gdbarch_skip_prologue (gdbarch, vax_skip_prologue);
631   set_gdbarch_saved_pc_after_call (gdbarch, vax_saved_pc_after_call);
632
633   set_gdbarch_frame_num_args (gdbarch, vax_frame_num_args);
634   set_gdbarch_frameless_function_invocation (gdbarch,
635                                    generic_frameless_function_invocation_not);
636
637   set_gdbarch_frame_chain (gdbarch, vax_frame_chain);
638   set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid);
639   set_gdbarch_frame_saved_pc (gdbarch, vax_frame_saved_pc);
640
641   set_gdbarch_frame_args_address (gdbarch, vax_frame_args_address);
642   set_gdbarch_frame_locals_address (gdbarch, vax_frame_locals_address);
643
644   set_gdbarch_frame_init_saved_regs (gdbarch, vax_frame_init_saved_regs);
645
646   set_gdbarch_frame_args_skip (gdbarch, 4);
647
648   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
649
650   /* Return value info */
651   set_gdbarch_store_struct_return (gdbarch, vax_store_struct_return);
652   set_gdbarch_deprecated_extract_return_value (gdbarch, vax_extract_return_value);
653   set_gdbarch_deprecated_store_return_value (gdbarch, vax_store_return_value);
654   set_gdbarch_deprecated_extract_struct_value_address (gdbarch, vax_extract_struct_value_address);
655
656   /* Call dummy info */
657   set_gdbarch_push_dummy_frame (gdbarch, vax_push_dummy_frame);
658   set_gdbarch_pop_frame (gdbarch, vax_pop_frame);
659   set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
660   set_gdbarch_call_dummy_p (gdbarch, 1);
661   set_gdbarch_call_dummy_words (gdbarch, vax_call_dummy_words);
662   set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof_vax_call_dummy_words);
663   set_gdbarch_fix_call_dummy (gdbarch, vax_fix_call_dummy);
664   set_gdbarch_call_dummy_start_offset (gdbarch, 0);
665   set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
666   set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 7);
667   set_gdbarch_use_generic_dummy_frames (gdbarch, 0);
668   set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack);
669   set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
670
671   /* Breakpoint info */
672   set_gdbarch_breakpoint_from_pc (gdbarch, vax_breakpoint_from_pc);
673   set_gdbarch_decr_pc_after_break (gdbarch, 0);
674
675   /* Misc info */
676   set_gdbarch_function_start_offset (gdbarch, 2);
677   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
678
679   /* Hook in ABI-specific overrides, if they have been registered.  */
680   gdbarch_init_osabi (info, gdbarch, osabi);
681
682   return (gdbarch);
683 }
684
685 static void
686 vax_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
687 {
688   struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
689
690   if (tdep == NULL)
691     return;
692
693   fprintf_unfiltered (file, "vax_dump_tdep: OS ABI = %s\n",
694                       gdbarch_osabi_name (tdep->osabi));
695 }
696
697 void
698 _initialize_vax_tdep (void)
699 {
700   gdbarch_register (bfd_arch_vax, vax_gdbarch_init, vax_dump_tdep);
701
702   tm_print_insn = vax_print_insn;
703 }