import gdb-1999-06-07 snapshot
[binutils-gdb.git] / gdb / gdbarch.h
1 /* Architecture commands for GDB, the GNU debugger.
2 Copyright 1998-1999, Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
20 #ifndef GDBARCH_H
21 #define GDBARCH_H
22
23 #ifdef __STDC__
24 struct frame_info;
25 struct value;
26 enum lval_type;
27 #endif
28
29 /* The target-system-dependant byte order is dynamic */
30
31 /* TARGET_BYTE_ORDER_SELECTABLE_P determines if the target endianness
32 is selectable at runtime. The user can use the ``set endian''
33 command to change it. TARGET_BYTE_ORDER_AUTO is nonzero when
34 target_byte_order should be auto-detected (from the program image
35 say). */
36
37 #ifndef TARGET_BYTE_ORDER_SELECTABLE_P
38 /* compat - Catch old targets that define TARGET_BYTE_ORDER_SLECTABLE
39 when they should have defined TARGET_BYTE_ORDER_SELECTABLE_P 1 */
40 #ifdef TARGET_BYTE_ORDER_SELECTABLE
41 #define TARGET_BYTE_ORDER_SELECTABLE_P 1
42 #else
43 #define TARGET_BYTE_ORDER_SELECTABLE_P 0
44 #endif
45 #endif
46
47 extern int target_byte_order;
48 #ifdef TARGET_BYTE_ORDER_SELECTABLE
49 /* compat - Catch old targets that define TARGET_BYTE_ORDER_SELECTABLE
50 and expect defs.h to re-define TARGET_BYTE_ORDER. */
51 #undef TARGET_BYTE_ORDER
52 #endif
53 #ifndef TARGET_BYTE_ORDER
54 #define TARGET_BYTE_ORDER (target_byte_order + 0)
55 #endif
56
57 extern int target_byte_order_auto;
58 #ifndef TARGET_BYTE_ORDER_AUTO
59 #define TARGET_BYTE_ORDER_AUTO (target_byte_order_auto + 0)
60 #endif
61
62
63
64 /* The target-system-dependant BFD architecture is dynamic */
65
66 extern int target_architecture_auto;
67 #ifndef TARGET_ARCHITECTURE_AUTO
68 #define TARGET_ARCHITECTURE_AUTO (target_architecture_auto + 0)
69 #endif
70
71 extern const struct bfd_arch_info *target_architecture;
72 #ifndef TARGET_ARCHITECTURE
73 #define TARGET_ARCHITECTURE (target_architecture + 0)
74 #endif
75
76 /* Notify the target dependant backend of a change to the selected
77 architecture. A zero return status indicates that the target did
78 not like the change. */
79
80 extern int (*target_architecture_hook) PARAMS ((const struct bfd_arch_info *));
81
82
83
84 /* The target-system-dependant disassembler is semi-dynamic */
85
86 #include "dis-asm.h" /* Get defs for disassemble_info */
87
88 extern int dis_asm_read_memory PARAMS ((bfd_vma memaddr, bfd_byte *myaddr,
89 int len, disassemble_info *info));
90
91 extern void dis_asm_memory_error PARAMS ((int status, bfd_vma memaddr,
92 disassemble_info *info));
93
94 extern void dis_asm_print_address PARAMS ((bfd_vma addr,
95 disassemble_info *info));
96
97 extern int (*tm_print_insn) PARAMS ((bfd_vma, disassemble_info*));
98 extern disassemble_info tm_print_insn_info;
99 #ifndef TARGET_PRINT_INSN
100 #define TARGET_PRINT_INSN(vma, info) (*tm_print_insn) (vma, info)
101 #endif
102 #ifndef TARGET_PRINT_INSN_INFO
103 #define TARGET_PRINT_INSN_INFO (&tm_print_insn_info)
104 #endif
105
106
107
108 /* Explicit test for D10V architecture.
109 USE of these macro's is *STRONGLY* discouraged. */
110
111 #define GDB_TARGET_IS_D10V (TARGET_ARCHITECTURE->arch == bfd_arch_d10v)
112 #ifndef D10V_MAKE_DADDR
113 #define D10V_MAKE_DADDR(X) (abort (), 0)
114 #endif
115 #ifndef D10V_MAKE_IADDR
116 #define D10V_MAKE_IADDR(X) (abort (), 0)
117 #endif
118
119
120 /* Fallback definition of FRAMELESS_FUNCTION_INVOCATION */
121 #ifndef FRAMELESS_FUNCTION_INVOCATION
122 #define FRAMELESS_FUNCTION_INVOCATION(FI) (0)
123 #endif
124
125
126 /* Fallback definition of REGISTER_CONVERTIBLE etc */
127 #ifndef REGISTER_CONVERTIBLE
128 #define REGISTER_CONVERTIBLE(x) (0)
129 #endif
130 #ifndef REGISTER_CONVERT_TO_VIRTUAL
131 #define REGISTER_CONVERT_TO_VIRTUAL(x, y, z, a)
132 #endif
133 #ifndef REGISTER_CONVERT_TO_RAW
134 #define REGISTER_CONVERT_TO_RAW(x, y, z, a)
135 #endif
136
137
138 /* Fallback definition for EXTRACT_STRUCT_VALUE_ADDRESS */
139 #ifndef EXTRACT_STRUCT_VALUE_ADDRESS
140 #define EXTRACT_STRUCT_VALUE_ADDRESS_P (0)
141 #define EXTRACT_STRUCT_VALUE_ADDRESS(X) (abort (), 0)
142 #else
143 #ifndef EXTRACT_STRUCT_VALUE_ADDRESS_P
144 #define EXTRACT_STRUCT_VALUE_ADDRESS_P (1)
145 #endif
146 #endif
147
148
149 /* Fallback definition for REGISTER_NAME for systems still defining
150 REGISTER_NAMES. */
151 #ifndef REGISTER_NAME
152 extern char *gdb_register_names[];
153 #define REGISTER_NAME(i) gdb_register_names[i]
154 #endif
155
156
157 /* Set the dynamic target-system-dependant parameters (architecture,
158 byte-order, ...) using information found in the BFD */
159
160 extern void set_gdbarch_from_file PARAMS ((bfd *));
161
162
163 /* Explicitly set the dynamic target-system-dependant parameters based
164 on bfd_architecture and machine. */
165
166 extern void set_architecture_from_arch_mach PARAMS ((enum bfd_architecture, unsigned long));
167
168
169 /* Helper function for targets that don't know how my arguments are
170 being passed */
171
172 extern int frame_num_args_unknown PARAMS ((struct frame_info *fi));
173
174
175 /* gdbarch trace variable */
176 extern int gdbarch_debug;
177
178 #endif