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