Commit | Line | Data |
---|---|---|
0543f387 | 1 | /* Target-dependent code for the VAX. |
464e0365 | 2 | |
6aba47ca | 3 | Copyright (C) 1986, 1989, 1991, 1992, 1995, 1996, 1998, 1999, 2000, 2002, |
7b6bb8da JB |
4 | 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011 |
5 | Free Software Foundation, Inc. | |
c906108c | 6 | |
c5aa993b | 7 | This file is part of GDB. |
c906108c | 8 | |
c5aa993b JM |
9 | This program is free software; you can redistribute it and/or modify |
10 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 11 | the Free Software Foundation; either version 3 of the License, or |
c5aa993b | 12 | (at your option) any later version. |
c906108c | 13 | |
c5aa993b JM |
14 | This program is distributed in the hope that it will be useful, |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
c906108c | 18 | |
c5aa993b | 19 | You should have received a copy of the GNU General Public License |
a9762ec7 | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
c906108c SS |
21 | |
22 | #include "defs.h" | |
0543f387 MK |
23 | #include "arch-utils.h" |
24 | #include "dis-asm.h" | |
0a3e99f6 | 25 | #include "floatformat.h" |
c11c3a98 | 26 | #include "frame.h" |
7def7fef MK |
27 | #include "frame-base.h" |
28 | #include "frame-unwind.h" | |
0543f387 MK |
29 | #include "gdbcore.h" |
30 | #include "gdbtypes.h" | |
4be87837 | 31 | #include "osabi.h" |
0543f387 | 32 | #include "regcache.h" |
8b910bab | 33 | #include "regset.h" |
0543f387 MK |
34 | #include "trad-frame.h" |
35 | #include "value.h" | |
8b910bab MK |
36 | |
37 | #include "gdb_string.h" | |
f267bd6a JT |
38 | |
39 | #include "vax-tdep.h" | |
40 | ||
5e6b39ff MK |
41 | /* Return the name of register REGNUM. */ |
42 | ||
fa88f677 | 43 | static const char * |
d93859e2 | 44 | vax_register_name (struct gdbarch *gdbarch, int regnum) |
51eb8b08 JT |
45 | { |
46 | static char *register_names[] = | |
47 | { | |
5e6b39ff MK |
48 | "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", |
49 | "r8", "r9", "r10", "r11", "ap", "fp", "sp", "pc", | |
51eb8b08 JT |
50 | "ps", |
51 | }; | |
52 | ||
5e6b39ff MK |
53 | if (regnum >= 0 && regnum < ARRAY_SIZE (register_names)) |
54 | return register_names[regnum]; | |
51eb8b08 | 55 | |
5e6b39ff | 56 | return NULL; |
51eb8b08 JT |
57 | } |
58 | ||
5e6b39ff | 59 | /* Return the GDB type object for the "standard" data type of data in |
581e13c1 | 60 | register REGNUM. */ |
51eb8b08 | 61 | |
f267bd6a | 62 | static struct type * |
5e6b39ff | 63 | vax_register_type (struct gdbarch *gdbarch, int regnum) |
51eb8b08 | 64 | { |
0dfff4cb | 65 | return builtin_type (gdbarch)->builtin_int; |
51eb8b08 JT |
66 | } |
67 | \f | |
8b910bab MK |
68 | /* Core file support. */ |
69 | ||
70 | /* Supply register REGNUM from the buffer specified by GREGS and LEN | |
71 | in the general-purpose register set REGSET to register cache | |
72 | REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ | |
73 | ||
74 | static void | |
75 | vax_supply_gregset (const struct regset *regset, struct regcache *regcache, | |
76 | int regnum, const void *gregs, size_t len) | |
77 | { | |
8cc49c48 | 78 | const gdb_byte *regs = gregs; |
8b910bab MK |
79 | int i; |
80 | ||
81 | for (i = 0; i < VAX_NUM_REGS; i++) | |
82 | { | |
83 | if (regnum == i || regnum == -1) | |
84 | regcache_raw_supply (regcache, i, regs + i * 4); | |
85 | } | |
86 | } | |
52efde73 | 87 | |
8b910bab MK |
88 | /* VAX register set. */ |
89 | ||
90 | static struct regset vax_gregset = | |
91 | { | |
92 | NULL, | |
93 | vax_supply_gregset | |
94 | }; | |
95 | ||
96 | /* Return the appropriate register set for the core section identified | |
97 | by SECT_NAME and SECT_SIZE. */ | |
98 | ||
99 | static const struct regset * | |
100 | vax_regset_from_core_section (struct gdbarch *gdbarch, | |
101 | const char *sect_name, size_t sect_size) | |
102 | { | |
103 | if (strcmp (sect_name, ".reg") == 0 && sect_size >= VAX_NUM_REGS * 4) | |
104 | return &vax_gregset; | |
105 | ||
106 | return NULL; | |
107 | } | |
108 | \f | |
4cd80476 | 109 | /* The VAX UNIX calling convention uses R1 to pass a structure return |
67b441e1 MK |
110 | value address instead of passing it as a first (hidden) argument as |
111 | the VMS calling convention suggests. */ | |
112 | ||
7346c184 MK |
113 | static CORE_ADDR |
114 | vax_store_arguments (struct regcache *regcache, int nargs, | |
67b441e1 | 115 | struct value **args, CORE_ADDR sp) |
52efde73 | 116 | { |
e17a4113 UW |
117 | struct gdbarch *gdbarch = get_regcache_arch (regcache); |
118 | enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); | |
8cc49c48 | 119 | gdb_byte buf[4]; |
7346c184 MK |
120 | int count = 0; |
121 | int i; | |
52efde73 | 122 | |
7346c184 MK |
123 | /* We create an argument list on the stack, and make the argument |
124 | pointer to it. */ | |
52efde73 | 125 | |
7346c184 MK |
126 | /* Push arguments in reverse order. */ |
127 | for (i = nargs - 1; i >= 0; i--) | |
52efde73 | 128 | { |
4754a64e | 129 | int len = TYPE_LENGTH (value_enclosing_type (args[i])); |
7346c184 MK |
130 | |
131 | sp -= (len + 3) & ~3; | |
132 | count += (len + 3) / 4; | |
46615f07 | 133 | write_memory (sp, value_contents_all (args[i]), len); |
52efde73 | 134 | } |
a33f7558 | 135 | |
7346c184 MK |
136 | /* Push argument count. */ |
137 | sp -= 4; | |
e17a4113 | 138 | store_unsigned_integer (buf, 4, byte_order, count); |
7346c184 | 139 | write_memory (sp, buf, 4); |
a33f7558 | 140 | |
7346c184 | 141 | /* Update the argument pointer. */ |
e17a4113 | 142 | store_unsigned_integer (buf, 4, byte_order, sp); |
7346c184 | 143 | regcache_cooked_write (regcache, VAX_AP_REGNUM, buf); |
a33f7558 | 144 | |
7346c184 MK |
145 | return sp; |
146 | } | |
147 | ||
148 | static CORE_ADDR | |
7d9b040b | 149 | vax_push_dummy_call (struct gdbarch *gdbarch, struct value *function, |
7346c184 MK |
150 | struct regcache *regcache, CORE_ADDR bp_addr, int nargs, |
151 | struct value **args, CORE_ADDR sp, int struct_return, | |
152 | CORE_ADDR struct_addr) | |
153 | { | |
e17a4113 | 154 | enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
7346c184 | 155 | CORE_ADDR fp = sp; |
8cc49c48 | 156 | gdb_byte buf[4]; |
7346c184 MK |
157 | |
158 | /* Set up the function arguments. */ | |
67b441e1 MK |
159 | sp = vax_store_arguments (regcache, nargs, args, sp); |
160 | ||
161 | /* Store return value address. */ | |
162 | if (struct_return) | |
163 | regcache_cooked_write_unsigned (regcache, VAX_R1_REGNUM, struct_addr); | |
7346c184 MK |
164 | |
165 | /* Store return address in the PC slot. */ | |
166 | sp -= 4; | |
e17a4113 | 167 | store_unsigned_integer (buf, 4, byte_order, bp_addr); |
7346c184 MK |
168 | write_memory (sp, buf, 4); |
169 | ||
170 | /* Store the (fake) frame pointer in the FP slot. */ | |
171 | sp -= 4; | |
e17a4113 | 172 | store_unsigned_integer (buf, 4, byte_order, fp); |
7346c184 MK |
173 | write_memory (sp, buf, 4); |
174 | ||
175 | /* Skip the AP slot. */ | |
176 | sp -= 4; | |
177 | ||
178 | /* Store register save mask and control bits. */ | |
179 | sp -= 4; | |
e17a4113 | 180 | store_unsigned_integer (buf, 4, byte_order, 0); |
7346c184 MK |
181 | write_memory (sp, buf, 4); |
182 | ||
183 | /* Store condition handler. */ | |
184 | sp -= 4; | |
e17a4113 | 185 | store_unsigned_integer (buf, 4, byte_order, 0); |
7346c184 MK |
186 | write_memory (sp, buf, 4); |
187 | ||
188 | /* Update the stack pointer and frame pointer. */ | |
e17a4113 | 189 | store_unsigned_integer (buf, 4, byte_order, sp); |
7346c184 MK |
190 | regcache_cooked_write (regcache, VAX_SP_REGNUM, buf); |
191 | regcache_cooked_write (regcache, VAX_FP_REGNUM, buf); | |
192 | ||
193 | /* Return the saved (fake) frame pointer. */ | |
194 | return fp; | |
195 | } | |
196 | ||
197 | static struct frame_id | |
94afd7a6 | 198 | vax_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) |
a33f7558 | 199 | { |
7346c184 MK |
200 | CORE_ADDR fp; |
201 | ||
94afd7a6 UW |
202 | fp = get_frame_register_unsigned (this_frame, VAX_FP_REGNUM); |
203 | return frame_id_build (fp, get_frame_pc (this_frame)); | |
a33f7558 | 204 | } |
ab62c900 | 205 | \f |
7346c184 | 206 | |
67b441e1 | 207 | static enum return_value_convention |
c055b101 CV |
208 | vax_return_value (struct gdbarch *gdbarch, struct type *func_type, |
209 | struct type *type, struct regcache *regcache, | |
210 | gdb_byte *readbuf, const gdb_byte *writebuf) | |
ea74468c | 211 | { |
67b441e1 | 212 | int len = TYPE_LENGTH (type); |
8cc49c48 | 213 | gdb_byte buf[8]; |
ea74468c | 214 | |
67b441e1 | 215 | if (TYPE_CODE (type) == TYPE_CODE_STRUCT |
caed1a45 | 216 | || TYPE_CODE (type) == TYPE_CODE_UNION |
67b441e1 | 217 | || TYPE_CODE (type) == TYPE_CODE_ARRAY) |
e5483145 MK |
218 | { |
219 | /* The default on VAX is to return structures in static memory. | |
220 | Consequently a function must return the address where we can | |
221 | find the return value. */ | |
222 | ||
223 | if (readbuf) | |
224 | { | |
225 | ULONGEST addr; | |
226 | ||
227 | regcache_raw_read_unsigned (regcache, VAX_R0_REGNUM, &addr); | |
228 | read_memory (addr, readbuf, len); | |
229 | } | |
230 | ||
231 | return RETURN_VALUE_ABI_RETURNS_ADDRESS; | |
232 | } | |
ea74468c | 233 | |
67b441e1 MK |
234 | if (readbuf) |
235 | { | |
236 | /* Read the contents of R0 and (if necessary) R1. */ | |
237 | regcache_cooked_read (regcache, VAX_R0_REGNUM, buf); | |
238 | if (len > 4) | |
239 | regcache_cooked_read (regcache, VAX_R1_REGNUM, buf + 4); | |
240 | memcpy (readbuf, buf, len); | |
241 | } | |
242 | if (writebuf) | |
243 | { | |
244 | /* Read the contents to R0 and (if necessary) R1. */ | |
245 | memcpy (buf, writebuf, len); | |
246 | regcache_cooked_write (regcache, VAX_R0_REGNUM, buf); | |
247 | if (len > 4) | |
248 | regcache_cooked_write (regcache, VAX_R1_REGNUM, buf + 4); | |
249 | } | |
250 | ||
251 | return RETURN_VALUE_REGISTER_CONVENTION; | |
ea74468c | 252 | } |
ea74468c | 253 | \f |
5e6b39ff MK |
254 | |
255 | /* Use the program counter to determine the contents and size of a | |
256 | breakpoint instruction. Return a pointer to a string of bytes that | |
257 | encode a breakpoint instruction, store the length of the string in | |
258 | *LEN and optionally adjust *PC to point to the correct memory | |
259 | location for inserting the breakpoint. */ | |
260 | ||
8cc49c48 | 261 | static const gdb_byte * |
67d57894 | 262 | vax_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc, int *len) |
1d049c5e | 263 | { |
8cc49c48 | 264 | static gdb_byte break_insn[] = { 3 }; |
1d049c5e | 265 | |
5e6b39ff MK |
266 | *len = sizeof (break_insn); |
267 | return break_insn; | |
1d049c5e JT |
268 | } |
269 | \f | |
b83266a0 SS |
270 | /* Advance PC across any function entry prologue instructions |
271 | to reach some "real" code. */ | |
272 | ||
f267bd6a | 273 | static CORE_ADDR |
6093d2eb | 274 | vax_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) |
b83266a0 | 275 | { |
e17a4113 UW |
276 | enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
277 | gdb_byte op = read_memory_unsigned_integer (pc, 1, byte_order); | |
0543f387 | 278 | |
b83266a0 | 279 | if (op == 0x11) |
c5aa993b | 280 | pc += 2; /* skip brb */ |
b83266a0 | 281 | if (op == 0x31) |
c5aa993b | 282 | pc += 3; /* skip brw */ |
b83266a0 | 283 | if (op == 0xC2 |
e17a4113 | 284 | && read_memory_unsigned_integer (pc + 2, 1, byte_order) == 0x5E) |
c5aa993b | 285 | pc += 3; /* skip subl2 */ |
b83266a0 | 286 | if (op == 0x9E |
e17a4113 UW |
287 | && read_memory_unsigned_integer (pc + 1, 1, byte_order) == 0xAE |
288 | && read_memory_unsigned_integer (pc + 3, 1, byte_order) == 0x5E) | |
c5aa993b | 289 | pc += 4; /* skip movab */ |
b83266a0 | 290 | if (op == 0x9E |
e17a4113 UW |
291 | && read_memory_unsigned_integer (pc + 1, 1, byte_order) == 0xCE |
292 | && read_memory_unsigned_integer (pc + 4, 1, byte_order) == 0x5E) | |
c5aa993b | 293 | pc += 5; /* skip movab */ |
b83266a0 | 294 | if (op == 0x9E |
e17a4113 UW |
295 | && read_memory_unsigned_integer (pc + 1, 1, byte_order) == 0xEE |
296 | && read_memory_unsigned_integer (pc + 6, 1, byte_order) == 0x5E) | |
c5aa993b | 297 | pc += 7; /* skip movab */ |
0543f387 | 298 | |
b83266a0 SS |
299 | return pc; |
300 | } | |
7def7fef MK |
301 | \f |
302 | ||
303 | /* Unwinding the stack is relatively easy since the VAX has a | |
304 | dedicated frame pointer, and frames are set up automatically as the | |
305 | result of a function call. Most of the relevant information can be | |
306 | inferred from the documentation of the Procedure Call Instructions | |
307 | in the VAX MACRO and Instruction Set Reference Manual. */ | |
308 | ||
309 | struct vax_frame_cache | |
310 | { | |
311 | /* Base address. */ | |
312 | CORE_ADDR base; | |
313 | ||
314 | /* Table of saved registers. */ | |
315 | struct trad_frame_saved_reg *saved_regs; | |
316 | }; | |
317 | ||
63807e1d | 318 | static struct vax_frame_cache * |
94afd7a6 | 319 | vax_frame_cache (struct frame_info *this_frame, void **this_cache) |
7def7fef MK |
320 | { |
321 | struct vax_frame_cache *cache; | |
322 | CORE_ADDR addr; | |
323 | ULONGEST mask; | |
324 | int regnum; | |
325 | ||
326 | if (*this_cache) | |
327 | return *this_cache; | |
328 | ||
329 | /* Allocate a new cache. */ | |
330 | cache = FRAME_OBSTACK_ZALLOC (struct vax_frame_cache); | |
94afd7a6 | 331 | cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); |
7def7fef MK |
332 | |
333 | /* The frame pointer is used as the base for the frame. */ | |
94afd7a6 | 334 | cache->base = get_frame_register_unsigned (this_frame, VAX_FP_REGNUM); |
7def7fef MK |
335 | if (cache->base == 0) |
336 | return cache; | |
337 | ||
338 | /* The register save mask and control bits determine the layout of | |
339 | the stack frame. */ | |
94afd7a6 | 340 | mask = get_frame_memory_unsigned (this_frame, cache->base + 4, 4) >> 16; |
7def7fef MK |
341 | |
342 | /* These are always saved. */ | |
343 | cache->saved_regs[VAX_PC_REGNUM].addr = cache->base + 16; | |
344 | cache->saved_regs[VAX_FP_REGNUM].addr = cache->base + 12; | |
345 | cache->saved_regs[VAX_AP_REGNUM].addr = cache->base + 8; | |
346 | cache->saved_regs[VAX_PS_REGNUM].addr = cache->base + 4; | |
347 | ||
348 | /* Scan the register save mask and record the location of the saved | |
349 | registers. */ | |
350 | addr = cache->base + 20; | |
351 | for (regnum = 0; regnum < VAX_AP_REGNUM; regnum++) | |
352 | { | |
353 | if (mask & (1 << regnum)) | |
354 | { | |
355 | cache->saved_regs[regnum].addr = addr; | |
356 | addr += 4; | |
357 | } | |
358 | } | |
359 | ||
360 | /* The CALLS/CALLG flag determines whether this frame has a General | |
361 | Argument List or a Stack Argument List. */ | |
362 | if (mask & (1 << 13)) | |
363 | { | |
364 | ULONGEST numarg; | |
365 | ||
366 | /* This is a procedure with Stack Argument List. Adjust the | |
e36ad527 | 367 | stack address for the arguments that were pushed onto the |
7def7fef MK |
368 | stack. The return instruction will automatically pop the |
369 | arguments from the stack. */ | |
94afd7a6 | 370 | numarg = get_frame_memory_unsigned (this_frame, addr, 1); |
7def7fef MK |
371 | addr += 4 + numarg * 4; |
372 | } | |
373 | ||
374 | /* Bits 1:0 of the stack pointer were saved in the control bits. */ | |
375 | trad_frame_set_value (cache->saved_regs, VAX_SP_REGNUM, addr + (mask >> 14)); | |
376 | ||
377 | return cache; | |
378 | } | |
379 | ||
380 | static void | |
94afd7a6 | 381 | vax_frame_this_id (struct frame_info *this_frame, void **this_cache, |
7def7fef MK |
382 | struct frame_id *this_id) |
383 | { | |
94afd7a6 | 384 | struct vax_frame_cache *cache = vax_frame_cache (this_frame, this_cache); |
7def7fef MK |
385 | |
386 | /* This marks the outermost frame. */ | |
387 | if (cache->base == 0) | |
388 | return; | |
389 | ||
94afd7a6 | 390 | (*this_id) = frame_id_build (cache->base, get_frame_func (this_frame)); |
7def7fef MK |
391 | } |
392 | ||
94afd7a6 UW |
393 | static struct value * |
394 | vax_frame_prev_register (struct frame_info *this_frame, | |
395 | void **this_cache, int regnum) | |
7def7fef | 396 | { |
94afd7a6 | 397 | struct vax_frame_cache *cache = vax_frame_cache (this_frame, this_cache); |
7def7fef | 398 | |
94afd7a6 | 399 | return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum); |
7def7fef MK |
400 | } |
401 | ||
402 | static const struct frame_unwind vax_frame_unwind = | |
403 | { | |
404 | NORMAL_FRAME, | |
405 | vax_frame_this_id, | |
94afd7a6 UW |
406 | vax_frame_prev_register, |
407 | NULL, | |
408 | default_frame_sniffer | |
7def7fef | 409 | }; |
7def7fef MK |
410 | \f |
411 | ||
412 | static CORE_ADDR | |
94afd7a6 | 413 | vax_frame_base_address (struct frame_info *this_frame, void **this_cache) |
7def7fef | 414 | { |
94afd7a6 | 415 | struct vax_frame_cache *cache = vax_frame_cache (this_frame, this_cache); |
7def7fef MK |
416 | |
417 | return cache->base; | |
418 | } | |
b83266a0 | 419 | |
f267bd6a | 420 | static CORE_ADDR |
94afd7a6 | 421 | vax_frame_args_address (struct frame_info *this_frame, void **this_cache) |
7def7fef | 422 | { |
94afd7a6 | 423 | return get_frame_register_unsigned (this_frame, VAX_AP_REGNUM); |
7def7fef MK |
424 | } |
425 | ||
426 | static const struct frame_base vax_frame_base = | |
a33f7558 | 427 | { |
7def7fef MK |
428 | &vax_frame_unwind, |
429 | vax_frame_base_address, | |
430 | vax_frame_base_address, | |
431 | vax_frame_args_address | |
432 | }; | |
433 | ||
434 | /* Return number of arguments for FRAME. */ | |
435 | ||
436 | static int | |
437 | vax_frame_num_args (struct frame_info *frame) | |
438 | { | |
439 | CORE_ADDR args; | |
440 | ||
441 | /* Assume that the argument pointer for the outermost frame is | |
442 | hosed, as is the case on NetBSD/vax ELF. */ | |
a54f9a00 | 443 | if (get_frame_base_address (frame) == 0) |
7def7fef MK |
444 | return 0; |
445 | ||
446 | args = get_frame_register_unsigned (frame, VAX_AP_REGNUM); | |
447 | return get_frame_memory_unsigned (frame, args, 1); | |
448 | } | |
449 | ||
450 | static CORE_ADDR | |
451 | vax_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) | |
452 | { | |
453 | return frame_unwind_register_unsigned (next_frame, VAX_PC_REGNUM); | |
a33f7558 JT |
454 | } |
455 | \f | |
7def7fef | 456 | |
f267bd6a JT |
457 | /* Initialize the current architecture based on INFO. If possible, re-use an |
458 | architecture from ARCHES, which is a list of architectures already created | |
459 | during this debugging session. | |
460 | ||
461 | Called e.g. at program startup, when reading a core file, and when reading | |
462 | a binary file. */ | |
463 | ||
464 | static struct gdbarch * | |
465 | vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | |
466 | { | |
467 | struct gdbarch *gdbarch; | |
468 | ||
4be87837 DJ |
469 | /* If there is already a candidate, use it. */ |
470 | arches = gdbarch_list_lookup_by_info (arches, &info); | |
471 | if (arches != NULL) | |
472 | return arches->gdbarch; | |
f267bd6a | 473 | |
4be87837 | 474 | gdbarch = gdbarch_alloc (&info, NULL); |
4791e091 | 475 | |
8da61cc4 DJ |
476 | set_gdbarch_float_format (gdbarch, floatformats_vax_f); |
477 | set_gdbarch_double_format (gdbarch, floatformats_vax_d); | |
478 | set_gdbarch_long_double_format (gdbarch, floatformats_vax_d); | |
479 | set_gdbarch_long_double_bit (gdbarch, 64); | |
0a3e99f6 | 480 | |
f267bd6a JT |
481 | /* Register info */ |
482 | set_gdbarch_num_regs (gdbarch, VAX_NUM_REGS); | |
5e6b39ff MK |
483 | set_gdbarch_register_name (gdbarch, vax_register_name); |
484 | set_gdbarch_register_type (gdbarch, vax_register_type); | |
f267bd6a | 485 | set_gdbarch_sp_regnum (gdbarch, VAX_SP_REGNUM); |
f267bd6a JT |
486 | set_gdbarch_pc_regnum (gdbarch, VAX_PC_REGNUM); |
487 | set_gdbarch_ps_regnum (gdbarch, VAX_PS_REGNUM); | |
488 | ||
8b910bab MK |
489 | set_gdbarch_regset_from_core_section |
490 | (gdbarch, vax_regset_from_core_section); | |
491 | ||
f267bd6a JT |
492 | /* Frame and stack info */ |
493 | set_gdbarch_skip_prologue (gdbarch, vax_skip_prologue); | |
f267bd6a | 494 | set_gdbarch_frame_num_args (gdbarch, vax_frame_num_args); |
f267bd6a JT |
495 | set_gdbarch_frame_args_skip (gdbarch, 4); |
496 | ||
5e6b39ff | 497 | /* Stack grows downward. */ |
f267bd6a JT |
498 | set_gdbarch_inner_than (gdbarch, core_addr_lessthan); |
499 | ||
500 | /* Return value info */ | |
67b441e1 | 501 | set_gdbarch_return_value (gdbarch, vax_return_value); |
f267bd6a | 502 | |
7346c184 MK |
503 | /* Call dummy code. */ |
504 | set_gdbarch_push_dummy_call (gdbarch, vax_push_dummy_call); | |
94afd7a6 | 505 | set_gdbarch_dummy_id (gdbarch, vax_dummy_id); |
f267bd6a JT |
506 | |
507 | /* Breakpoint info */ | |
1d049c5e | 508 | set_gdbarch_breakpoint_from_pc (gdbarch, vax_breakpoint_from_pc); |
f267bd6a JT |
509 | |
510 | /* Misc info */ | |
782263ab | 511 | set_gdbarch_deprecated_function_start_offset (gdbarch, 2); |
1d049c5e | 512 | set_gdbarch_believe_pcc_promotion (gdbarch, 1); |
f267bd6a | 513 | |
0543f387 MK |
514 | set_gdbarch_print_insn (gdbarch, print_insn_vax); |
515 | ||
7def7fef MK |
516 | set_gdbarch_unwind_pc (gdbarch, vax_unwind_pc); |
517 | ||
518 | frame_base_set_default (gdbarch, &vax_frame_base); | |
519 | ||
4791e091 | 520 | /* Hook in ABI-specific overrides, if they have been registered. */ |
4be87837 | 521 | gdbarch_init_osabi (info, gdbarch); |
4791e091 | 522 | |
94afd7a6 | 523 | frame_unwind_append_unwinder (gdbarch, &vax_frame_unwind); |
7def7fef | 524 | |
f267bd6a JT |
525 | return (gdbarch); |
526 | } | |
c906108c | 527 | |
0543f387 MK |
528 | /* Provide a prototype to silence -Wmissing-prototypes. */ |
529 | void _initialize_vax_tdep (void); | |
a78f21af | 530 | |
c906108c | 531 | void |
fba45db2 | 532 | _initialize_vax_tdep (void) |
c906108c | 533 | { |
4be87837 | 534 | gdbarch_register (bfd_arch_vax, vax_gdbarch_init, NULL); |
c906108c | 535 | } |