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