s/Linux/.../
[deliverable/binutils-gdb.git] / gdb / config / alpha / tm-alpha.h
1 /* Definitions to make GDB run on an Alpha box under OSF1. This is
2 also used by the Alpha/Netware and Alpha GNU/Linux targets.
3
4 Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2002 Free
5 Software Foundation, Inc.
6
7 This file is part of GDB.
8
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
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
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.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
23
24 #ifndef TM_ALPHA_H
25 #define TM_ALPHA_H
26
27 #include "regcache.h"
28 #include "bfd.h"
29 #include "coff/sym.h" /* Needed for PDR below. */
30 #include "coff/symconst.h"
31
32 struct frame_info;
33 struct type;
34 struct value;
35 struct symbol;
36
37 /* Redefine some target bit sizes from the default. */
38
39 #define TARGET_LONG_BIT 64
40 #define TARGET_LONG_LONG_BIT 64
41 #define TARGET_PTR_BIT 64
42
43 /* Number of traps that happen between exec'ing the shell
44 * to run an inferior, and when we finally get to
45 * the inferior code. This is 2 on most implementations.
46 */
47 #define START_INFERIOR_TRAPS_EXPECTED 3
48
49 /* Offset from address of function to start of its code.
50 Zero on most machines. */
51
52 #define FUNCTION_START_OFFSET 0
53
54 /* Advance PC across any function entry prologue instructions
55 to reach some "real" code. */
56
57 #define SKIP_PROLOGUE(pc) alpha_skip_prologue((pc))
58 extern CORE_ADDR alpha_skip_prologue (CORE_ADDR addr);
59
60 /* Immediately after a function call, return the saved pc.
61 Can't always go through the frames for this because on some machines
62 the new frame is not set up until the new function executes
63 some instructions. */
64
65 #define SAVED_PC_AFTER_CALL(frame) alpha_saved_pc_after_call(frame)
66 extern CORE_ADDR alpha_saved_pc_after_call (struct frame_info *);
67
68 /* Are we currently handling a signal ? */
69
70 #define IN_SIGTRAMP(pc, name) alpha_osf_in_sigtramp ((pc), (name))
71 extern int alpha_osf_in_sigtramp (CORE_ADDR, char *);
72
73 /* Stack grows downward. */
74
75 #define INNER_THAN(lhs,rhs) core_addr_lessthan ((lhs), (rhs))
76
77 #define BREAKPOINT {0x80, 0, 0, 0} /* call_pal bpt */
78
79 /* Amount PC must be decremented by after a breakpoint.
80 This is often the number of bytes in BREAKPOINT
81 but not always. */
82
83 #ifndef DECR_PC_AFTER_BREAK
84 #define DECR_PC_AFTER_BREAK 4
85 #endif
86
87 /* Say how long (ordinary) registers are. This is a piece of bogosity
88 used in push_word and a few other places; REGISTER_RAW_SIZE is the
89 real way to know how big a register is. */
90
91 #define REGISTER_SIZE 8
92
93 /* Number of machine registers */
94
95 #define NUM_REGS 66
96
97
98 /* Return the name of register REGNO. */
99
100 #define REGISTER_NAME(regno) alpha_register_name ((regno))
101 extern char *alpha_register_name (int);
102
103
104 /* Register numbers of various important registers.
105 Note that most of these values are "real" register numbers,
106 and correspond to the general registers of the machine,
107 and FP_REGNUM is a "phony" register number which is too large
108 to be an actual register number as far as the user is concerned
109 but serves to get the desired value when passed to read_register. */
110
111 #define V0_REGNUM 0 /* Function integer return value */
112 #define T7_REGNUM 8 /* Return address register for OSF/1 __add* */
113 #define GCC_FP_REGNUM 15 /* Used by gcc as frame register */
114 #define A0_REGNUM 16 /* Loc of first arg during a subr call */
115 #define T9_REGNUM 23 /* Return address register for OSF/1 __div* */
116 #define T12_REGNUM 27 /* Contains start addr of current proc */
117 #define SP_REGNUM 30 /* Contains address of top of stack */
118 #define RA_REGNUM 26 /* Contains return address value */
119 #define ZERO_REGNUM 31 /* Read-only register, always 0 */
120 #define FP0_REGNUM 32 /* Floating point register 0 */
121 #define FPA0_REGNUM 48 /* First float arg during a subr call */
122 #define FPCR_REGNUM 63 /* Floating point control register */
123 #define PC_REGNUM 64 /* Contains program counter */
124 #define FP_REGNUM 65 /* Virtual frame pointer */
125
126 #define CANNOT_FETCH_REGISTER(regno) \
127 alpha_cannot_fetch_register ((regno))
128 extern int alpha_cannot_fetch_register (int);
129
130 #define CANNOT_STORE_REGISTER(regno) \
131 alpha_cannot_store_register ((regno))
132 extern int alpha_cannot_store_register (int);
133
134 /* Total amount of space needed to store our copies of the machine's
135 register state, the array `registers'. */
136 #define REGISTER_BYTES (NUM_REGS * 8)
137
138 /* Index within `registers' of the first byte of the space for
139 register N. */
140
141 #define REGISTER_BYTE(N) alpha_register_byte ((N))
142 extern int alpha_register_byte (int);
143
144 /* Number of bytes of storage in the actual machine representation
145 for register N. On Alphas, all regs are 8 bytes. */
146
147 #define REGISTER_RAW_SIZE(N) alpha_register_raw_size ((N))
148 extern int alpha_register_raw_size (int);
149
150 /* Number of bytes of storage in the program's representation
151 for register N. On Alphas, all regs are 8 bytes. */
152
153 #define REGISTER_VIRTUAL_SIZE(N) alpha_register_virtual_size ((N))
154 extern int alpha_register_virtual_size (int);
155
156 /* Largest value REGISTER_RAW_SIZE can have. */
157
158 #define MAX_REGISTER_RAW_SIZE 8
159
160 /* Largest value REGISTER_VIRTUAL_SIZE can have. */
161
162 #define MAX_REGISTER_VIRTUAL_SIZE 8
163
164 /* Nonzero if register N requires conversion
165 from raw format to virtual format.
166 The alpha needs a conversion between register and memory format if
167 the register is a floating point register and
168 memory format is float, as the register format must be double
169 or
170 memory format is an integer with 4 bytes or less, as the representation
171 of integers in floating point registers is different. */
172
173 #define REGISTER_CONVERTIBLE(N) alpha_register_convertible ((N))
174 extern int alpha_register_convertible (int);
175
176 /* Convert data from raw format for register REGNUM in buffer FROM
177 to virtual format with type TYPE in buffer TO. */
178
179 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM, TYPE, FROM, TO) \
180 alpha_register_convert_to_virtual (REGNUM, TYPE, FROM, TO)
181 extern void
182 alpha_register_convert_to_virtual (int, struct type *, char *, char *);
183
184 /* Convert data from virtual format with type TYPE in buffer FROM
185 to raw format for register REGNUM in buffer TO. */
186
187 #define REGISTER_CONVERT_TO_RAW(TYPE, REGNUM, FROM, TO) \
188 alpha_register_convert_to_raw (TYPE, REGNUM, FROM, TO)
189 extern void
190 alpha_register_convert_to_raw (struct type *, int, char *, char *);
191
192 /* Return the GDB type object for the "standard" data type
193 of data in register N. */
194
195 #define REGISTER_VIRTUAL_TYPE(N) alpha_register_virtual_type ((N))
196 extern struct type * alpha_register_virtual_type (int);
197
198 /* Store the address of the place in which to copy the structure the
199 subroutine will return. Handled by alpha_push_arguments. */
200
201 #define STORE_STRUCT_RETURN(addr, sp) \
202 alpha_store_struct_return ((addr), (sp))
203 extern void alpha_store_struct_return (CORE_ADDR, CORE_ADDR);
204 /**/
205
206 /* Extract from an array REGBUF containing the (raw) register state
207 a function return value of type TYPE, and copy that, in virtual format,
208 into VALBUF. */
209
210 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
211 alpha_extract_return_value(TYPE, REGBUF, VALBUF)
212 extern void alpha_extract_return_value (struct type *, char *, char *);
213
214 /* Write into appropriate registers a function return value
215 of type TYPE, given in virtual format. */
216
217 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
218 alpha_store_return_value(TYPE, VALBUF)
219 extern void alpha_store_return_value (struct type *, char *);
220
221 /* Extract from an array REGBUF containing the (raw) register state
222 the address in which a function should return its structure value,
223 as a CORE_ADDR (or an expression that can be used as one). */
224 /* The address is passed in a0 upon entry to the function, but when
225 the function exits, the compiler has copied the value to v0. This
226 convention is specified by the System V ABI, so I think we can rely
227 on it. */
228
229 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
230 alpha_extract_struct_value_address (REGBUF)
231 extern CORE_ADDR alpha_extract_struct_value_address (char *);
232
233 /* Structures are returned by ref in extra arg0 */
234 #define USE_STRUCT_CONVENTION(gcc_p, type) \
235 alpha_use_struct_convention ((gcc_p), (type))
236 extern int alpha_use_struct_convention (int, struct type *);
237 \f
238
239 /* Describe the pointer in each stack frame to the previous stack frame
240 (its caller). */
241
242 /* FRAME_CHAIN takes a frame's nominal address
243 and produces the frame's chain-pointer. */
244
245 #define FRAME_CHAIN(thisframe) alpha_frame_chain (thisframe)
246 extern CORE_ADDR alpha_frame_chain (struct frame_info *);
247
248 /* Define other aspects of the stack frame. */
249
250
251 /* An expression that tells us whether the function invocation represented
252 by FI does not have a frame on the stack associated with it. */
253 /* We handle this differently for alpha, and maybe we should not */
254
255 #define FRAMELESS_FUNCTION_INVOCATION(FI) \
256 generic_frameless_function_invocation_not ((FI))
257
258 /* Saved Pc. */
259
260 #define FRAME_SAVED_PC(FRAME) alpha_frame_saved_pc(FRAME)
261 extern CORE_ADDR alpha_frame_saved_pc (struct frame_info *);
262
263 /* The alpha has two different virtual pointers for arguments and locals.
264
265 The virtual argument pointer is pointing to the bottom of the argument
266 transfer area, which is located immediately below the virtual frame
267 pointer. Its size is fixed for the native compiler, it is either zero
268 (for the no arguments case) or large enough to hold all argument registers.
269 gcc uses a variable sized argument transfer area. As it has
270 to stay compatible with the native debugging tools it has to use the same
271 virtual argument pointer and adjust the argument offsets accordingly.
272
273 The virtual local pointer is localoff bytes below the virtual frame
274 pointer, the value of localoff is obtained from the PDR. */
275
276 #define ALPHA_NUM_ARG_REGS 6
277
278 #define FRAME_ARGS_ADDRESS(fi) alpha_frame_args_address ((fi))
279 extern CORE_ADDR alpha_frame_args_address (struct frame_info *);
280
281 #define FRAME_LOCALS_ADDRESS(fi) alpha_frame_locals_address ((fi))
282 extern CORE_ADDR alpha_frame_locals_address (struct frame_info *);
283
284 /* Return number of args passed to a frame.
285 Can return -1, meaning no way to tell. */
286
287 #define FRAME_NUM_ARGS(fi) frame_num_args_unknown ((fi))
288
289 /* Return number of bytes at start of arglist that are not really args. */
290
291 #define FRAME_ARGS_SKIP 0
292
293 /* Put here the code to store, into a struct frame_saved_regs,
294 the addresses of the saved registers of frame described by FRAME_INFO.
295 This includes special registers such as pc and fp saved in special
296 ways in the stack frame. sp is even more special:
297 the address we return for it IS the sp for the next frame. */
298
299 #define FRAME_INIT_SAVED_REGS(frame_info) \
300 alpha_frame_init_saved_regs (frame_info)
301 extern void alpha_frame_init_saved_regs (struct frame_info *);
302 \f
303
304 /* Things needed for making the inferior call functions. */
305
306 #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
307 (alpha_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr)))
308 extern CORE_ADDR
309 alpha_push_arguments (int, struct value **, CORE_ADDR, int, CORE_ADDR);
310
311 /* Push an empty stack frame, to record the current PC, etc. */
312
313 #define PUSH_DUMMY_FRAME alpha_push_dummy_frame()
314 extern void alpha_push_dummy_frame (void);
315
316 /* Discard from the stack the innermost frame, restoring all registers. */
317
318 #define POP_FRAME alpha_pop_frame()
319 extern void alpha_pop_frame (void);
320
321 /* Alpha OSF/1 inhibits execution of code on the stack.
322 But there is no need for a dummy on the alpha. PUSH_ARGUMENTS
323 takes care of all argument handling and bp_call_dummy takes care
324 of stopping the dummy. */
325
326 #define CALL_DUMMY_LOCATION AT_ENTRY_POINT
327
328 /* On the Alpha the call dummy code is never copied to user space,
329 stopping the user call is achieved via a bp_call_dummy breakpoint.
330 But we need a fake CALL_DUMMY definition to enable the proper
331 call_function_by_hand and to avoid zero length array warnings
332 in valops.c */
333
334 #define CALL_DUMMY_P (1)
335
336 #define CALL_DUMMY_WORDS alpha_call_dummy_words
337 extern LONGEST alpha_call_dummy_words[];
338
339 #define SIZEOF_CALL_DUMMY_WORDS 0
340
341 #define CALL_DUMMY_START_OFFSET (0)
342
343 #define CALL_DUMMY_BREAKPOINT_OFFSET (0)
344
345 #define CALL_DUMMY_ADDRESS() alpha_call_dummy_address()
346 extern CORE_ADDR alpha_call_dummy_address (void);
347
348 /* Insert the specified number of args and function address
349 into a call sequence of the above form stored at DUMMYNAME.
350 We only have to set RA_REGNUM to the dummy breakpoint address
351 and T12_REGNUM (the `procedure value register') to the function address. */
352
353 #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
354 alpha_fix_call_dummy ((dummyname), (pc), (fun), (nargs), (args), \
355 (type), (gcc_p))
356 extern void alpha_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, int,
357 struct value **, struct type *, int);
358
359 /* There's a mess in stack frame creation. See comments in blockframe.c
360 near reference to INIT_FRAME_PC_FIRST. */
361
362 #define INIT_FRAME_PC(fromleaf, prev) init_frame_pc_noop ((fromleaf), (prev))
363
364 #define INIT_FRAME_PC_FIRST(fromleaf, prev) \
365 alpha_init_frame_pc_first ((fromleaf), (prev))
366 extern void alpha_init_frame_pc_first (int, struct frame_info *);
367
368 /* Special symbol found in blocks associated with routines. We can hang
369 alpha_extra_func_info_t's off of this. */
370
371 #define MIPS_EFI_SYMBOL_NAME "__GDB_EFI_INFO__"
372 extern void ecoff_relocate_efi (struct symbol *, CORE_ADDR);
373
374 /* Specific information about a procedure.
375 This overlays the ALPHA's PDR records,
376 alpharead.c (ab)uses this to save memory */
377
378 typedef struct alpha_extra_func_info
379 {
380 long numargs; /* number of args to procedure (was iopt) */
381 PDR pdr; /* Procedure descriptor record */
382 }
383 *alpha_extra_func_info_t;
384
385 /* Define the extra_func_info that mipsread.c needs.
386 FIXME: We should define our own PDR interface, perhaps in a separate
387 header file. This would get rid of the <bfd.h> inclusion in all sources
388 and would abstract the mips/alpha interface from ecoff. */
389 #define mips_extra_func_info alpha_extra_func_info
390 #define mips_extra_func_info_t alpha_extra_func_info_t
391
392
393 #define INIT_EXTRA_FRAME_INFO(fromleaf, fci) \
394 alpha_init_extra_frame_info(fromleaf, fci)
395 extern void alpha_init_extra_frame_info (int, struct frame_info *);
396
397 #define PRINT_EXTRA_FRAME_INFO(fi) alpha_print_extra_frame_info ((fi))
398 extern void alpha_print_extra_frame_info (struct frame_info *);
399
400
401 /* It takes two values to specify a frame on the ALPHA. Sigh.
402
403 In fact, at the moment, the *PC* is the primary value that sets up
404 a frame. The PC is looked up to see what function it's in; symbol
405 information from that function tells us which register is the frame
406 pointer base, and what offset from there is the "virtual frame pointer".
407 (This is usually an offset from SP.) FIXME -- this should be cleaned
408 up so that the primary value is the SP, and the PC is used to disambiguate
409 multiple functions with the same SP that are at different stack levels. */
410
411 #define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv)
412 extern struct frame_info *setup_arbitrary_frame (int, CORE_ADDR *);
413
414 /* This is used by heuristic_proc_start. It should be shot it the head. */
415 #ifndef VM_MIN_ADDRESS
416 #define VM_MIN_ADDRESS (CORE_ADDR)0x120000000
417 #endif
418
419 /* If PC is in a shared library trampoline code, return the PC
420 where the function itself actually starts. If not, return 0. */
421 #define SKIP_TRAMPOLINE_CODE(pc) find_solib_trampoline_target (pc)
422
423 /* If the current gcc for for this target does not produce correct debugging
424 information for float parameters, both prototyped and unprototyped, then
425 define this macro. This forces gdb to always assume that floats are
426 passed as doubles and then converted in the callee.
427
428 For the alpha, it appears that the debug info marks the parameters as
429 floats regardless of whether the function is prototyped, but the actual
430 values are always passed in as doubles. Thus by setting this to 1, both
431 types of calls will work. */
432
433 #define COERCE_FLOAT_TO_DOUBLE(formal, actual) \
434 standard_coerce_float_to_double ((formal), (actual))
435
436 /* Return TRUE if procedure descriptor PROC is a procedure descriptor
437 that refers to a dynamically generated sigtramp function.
438
439 OSF/1 doesn't use dynamic sigtramp functions, so this is always
440 FALSE. */
441
442 #define PROC_DESC_IS_DYN_SIGTRAMP(proc) (0)
443 #define SET_PROC_DESC_IS_DYN_SIGTRAMP(proc)
444
445 /* If PC is inside a dynamically generated sigtramp function, return
446 how many bytes the program counter is beyond the start of that
447 function. Otherwise, return a negative value.
448
449 OSF/1 doesn't use dynamic sigtramp functions, so this always
450 returns -1. */
451
452 #define DYNAMIC_SIGTRAMP_OFFSET(pc) (-1)
453
454 /* Translate a signal handler frame into the address of the sigcontext
455 structure. */
456
457 #define SIGCONTEXT_ADDR(frame) \
458 (read_memory_integer ((frame)->next ? frame->next->frame : frame->frame, 8))
459
460 /* If FRAME refers to a sigtramp frame, return the address of the next
461 frame. */
462
463 #define FRAME_PAST_SIGTRAMP_FRAME(frame, pc) \
464 (alpha_osf_skip_sigtramp_frame (frame, pc))
465 extern CORE_ADDR alpha_osf_skip_sigtramp_frame (struct frame_info *,
466 CORE_ADDR);
467
468 /* Single step based on where the current instruction will take us. */
469 extern void alpha_software_single_step (enum target_signal, int);
470
471 #endif /* TM_ALPHA_H */
This page took 0.038375 seconds and 4 git commands to generate.