Commit | Line | Data |
---|---|---|
adf40b2e | 1 | /* Dynamic architecture support for GDB, the GNU debugger. |
b83266a0 | 2 | Copyright 1998-1999, Free Software Foundation, Inc. |
c906108c | 3 | |
96baa820 JM |
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. | |
c906108c | 10 | |
96baa820 JM |
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. | |
c906108c | 15 | |
96baa820 JM |
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, | |
19 | Boston, MA 02111-1307, USA. */ | |
adf40b2e | 20 | |
104c1213 JM |
21 | /* *INDENT-OFF* */ /* ``typedef (f)();'' confuses indent */ |
22 | ||
23 | /* This file was created with the aid of ``gdbarch.sh''. | |
24 | ||
25 | The bourn shell script ``gdbarch.sh'' creates the files | |
26 | ``new-gdbarch.c'' and ``new-gdbarch.h and then compares them | |
27 | against the existing ``gdbarch.[hc]''. Any differences found | |
28 | being reported. | |
29 | ||
30 | If editing this file, please also run gdbarch.sh and merge any | |
31 | changes into that script. Conversely, when makeing sweeping changes | |
32 | to this file, modifying gdbarch.sh and using its output may prove | |
33 | easier. */ | |
c906108c | 34 | |
c906108c SS |
35 | |
36 | #include "defs.h" | |
c906108c | 37 | |
0f71a2f6 JM |
38 | #if GDB_MULTI_ARCH |
39 | #include "gdbcmd.h" | |
adf40b2e | 40 | #include "inferior.h" /* enum CALL_DUMMY_LOCATION et.al. */ |
0f71a2f6 | 41 | #else |
7a292a7a SS |
42 | /* Just include everything in sight so that the every old definition |
43 | of macro is visible. */ | |
44 | #include "gdb_string.h" | |
45 | #include <ctype.h> | |
46 | #include "symtab.h" | |
47 | #include "frame.h" | |
48 | #include "inferior.h" | |
49 | #include "breakpoint.h" | |
50 | #include "wait.h" | |
51 | #include "gdbcore.h" | |
52 | #include "gdbcmd.h" | |
53 | #include "target.h" | |
54 | #include "gdbthread.h" | |
55 | #include "annotate.h" | |
56 | #include "symfile.h" /* for overlay functions */ | |
0f71a2f6 | 57 | #endif |
7a292a7a | 58 | #include "symcat.h" |
c906108c SS |
59 | |
60 | ||
104c1213 JM |
61 | /* Static function declarations */ |
62 | ||
63 | static void verify_gdbarch (struct gdbarch *gdbarch); | |
64 | static void init_gdbarch_data (struct gdbarch *); | |
65 | static void init_gdbarch_swap (struct gdbarch *); | |
66 | static void swapout_gdbarch_swap (struct gdbarch *); | |
67 | static void swapin_gdbarch_swap (struct gdbarch *); | |
68 | ||
0f71a2f6 JM |
69 | /* Convenience macro for allocting typesafe memory. */ |
70 | ||
71 | #ifndef XMALLOC | |
72 | #define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE)) | |
73 | #endif | |
74 | ||
75 | ||
76 | /* Non-zero if we want to trace architecture code. */ | |
77 | ||
78 | #ifndef GDBARCH_DEBUG | |
79 | #define GDBARCH_DEBUG 0 | |
80 | #endif | |
81 | int gdbarch_debug = GDBARCH_DEBUG; | |
82 | ||
83 | ||
84 | /* Maintain the struct gdbarch object */ | |
85 | ||
86 | struct gdbarch | |
adf40b2e JM |
87 | { |
88 | /* basic architectural information */ | |
89 | const struct bfd_arch_info * bfd_arch_info; | |
90 | int byte_order; | |
0f71a2f6 | 91 | |
adf40b2e JM |
92 | /* target specific vector. */ |
93 | struct gdbarch_tdep *tdep; | |
0f71a2f6 | 94 | |
adf40b2e JM |
95 | /* per-architecture data-pointers */ |
96 | int nr_data; | |
97 | void **data; | |
0f71a2f6 | 98 | |
adf40b2e JM |
99 | /* per-architecture swap-regions */ |
100 | struct gdbarch_swap *swap; | |
0f71a2f6 | 101 | |
adf40b2e | 102 | /* Multi-arch values. |
0f71a2f6 | 103 | |
adf40b2e | 104 | When extending this structure you must: |
0f71a2f6 | 105 | |
adf40b2e | 106 | Add the field below. |
0f71a2f6 | 107 | |
adf40b2e JM |
108 | Declare set/get functions and define the corresponding |
109 | macro in gdbarch.h. | |
0f71a2f6 | 110 | |
adf40b2e JM |
111 | gdbarch_alloc(): If zero/NULL is not a suitable default, |
112 | initialize the new field. | |
0f71a2f6 | 113 | |
adf40b2e JM |
114 | verify_gdbarch(): Confirm that the target updated the field |
115 | correctly. | |
0f71a2f6 | 116 | |
adf40b2e JM |
117 | gdbarch_dump(): Add a fprintf_unfiltered call to so that the new |
118 | field is dumped out | |
0f71a2f6 | 119 | |
adf40b2e JM |
120 | ``default_gdbarch()'': Append an initial value to the static |
121 | variable (base values on the host's c-type system). | |
0f71a2f6 | 122 | |
adf40b2e JM |
123 | get_gdbarch(): Implement the set/get functions (probably using |
124 | the macro's as shortcuts). | |
0f71a2f6 JM |
125 | |
126 | */ | |
127 | ||
adf40b2e JM |
128 | int ptr_bit; |
129 | int short_bit; | |
130 | int int_bit; | |
131 | int long_bit; | |
132 | int long_long_bit; | |
133 | int float_bit; | |
134 | int double_bit; | |
135 | int long_double_bit; | |
136 | gdbarch_read_pc_ftype *read_pc; | |
137 | gdbarch_write_pc_ftype *write_pc; | |
138 | gdbarch_read_fp_ftype *read_fp; | |
139 | gdbarch_write_fp_ftype *write_fp; | |
140 | gdbarch_read_sp_ftype *read_sp; | |
141 | gdbarch_write_sp_ftype *write_sp; | |
142 | int num_regs; | |
143 | int sp_regnum; | |
144 | int fp_regnum; | |
145 | int pc_regnum; | |
146 | gdbarch_register_name_ftype *register_name; | |
147 | int register_size; | |
148 | int register_bytes; | |
149 | gdbarch_register_byte_ftype *register_byte; | |
150 | gdbarch_register_raw_size_ftype *register_raw_size; | |
151 | int max_register_raw_size; | |
152 | gdbarch_register_virtual_size_ftype *register_virtual_size; | |
153 | int max_register_virtual_size; | |
154 | gdbarch_register_virtual_type_ftype *register_virtual_type; | |
155 | int use_generic_dummy_frames; | |
156 | int call_dummy_location; | |
157 | gdbarch_call_dummy_address_ftype *call_dummy_address; | |
158 | CORE_ADDR call_dummy_start_offset; | |
159 | CORE_ADDR call_dummy_breakpoint_offset; | |
160 | int call_dummy_breakpoint_offset_p; | |
161 | int call_dummy_length; | |
162 | gdbarch_pc_in_call_dummy_ftype *pc_in_call_dummy; | |
163 | int call_dummy_p; | |
164 | LONGEST * call_dummy_words; | |
165 | int sizeof_call_dummy_words; | |
166 | int call_dummy_stack_adjust_p; | |
167 | int call_dummy_stack_adjust; | |
168 | gdbarch_fix_call_dummy_ftype *fix_call_dummy; | |
169 | int believe_pcc_promotion; | |
170 | int believe_pcc_promotion_type; | |
171 | gdbarch_get_saved_register_ftype *get_saved_register; | |
172 | gdbarch_register_convertible_ftype *register_convertible; | |
173 | gdbarch_register_convert_to_virtual_ftype *register_convert_to_virtual; | |
174 | gdbarch_register_convert_to_raw_ftype *register_convert_to_raw; | |
175 | gdbarch_extract_return_value_ftype *extract_return_value; | |
176 | gdbarch_push_arguments_ftype *push_arguments; | |
177 | gdbarch_push_dummy_frame_ftype *push_dummy_frame; | |
178 | gdbarch_push_return_address_ftype *push_return_address; | |
179 | gdbarch_pop_frame_ftype *pop_frame; | |
180 | gdbarch_d10v_make_daddr_ftype *d10v_make_daddr; | |
181 | gdbarch_d10v_make_iaddr_ftype *d10v_make_iaddr; | |
182 | gdbarch_d10v_daddr_p_ftype *d10v_daddr_p; | |
183 | gdbarch_d10v_iaddr_p_ftype *d10v_iaddr_p; | |
184 | gdbarch_d10v_convert_daddr_to_raw_ftype *d10v_convert_daddr_to_raw; | |
185 | gdbarch_d10v_convert_iaddr_to_raw_ftype *d10v_convert_iaddr_to_raw; | |
186 | gdbarch_store_struct_return_ftype *store_struct_return; | |
187 | gdbarch_store_return_value_ftype *store_return_value; | |
188 | gdbarch_extract_struct_value_address_ftype *extract_struct_value_address; | |
189 | gdbarch_use_struct_convention_ftype *use_struct_convention; | |
190 | gdbarch_frame_init_saved_regs_ftype *frame_init_saved_regs; | |
191 | gdbarch_init_extra_frame_info_ftype *init_extra_frame_info; | |
192 | gdbarch_skip_prologue_ftype *skip_prologue; | |
193 | gdbarch_inner_than_ftype *inner_than; | |
194 | gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc; | |
917317f4 JM |
195 | gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint; |
196 | gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint; | |
adf40b2e JM |
197 | CORE_ADDR decr_pc_after_break; |
198 | CORE_ADDR function_start_offset; | |
199 | gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address; | |
200 | CORE_ADDR frame_args_skip; | |
201 | gdbarch_frameless_function_invocation_ftype *frameless_function_invocation; | |
202 | gdbarch_frame_chain_ftype *frame_chain; | |
203 | gdbarch_frame_chain_valid_ftype *frame_chain_valid; | |
204 | gdbarch_frame_saved_pc_ftype *frame_saved_pc; | |
205 | gdbarch_frame_args_address_ftype *frame_args_address; | |
206 | gdbarch_frame_locals_address_ftype *frame_locals_address; | |
207 | gdbarch_saved_pc_after_call_ftype *saved_pc_after_call; | |
208 | gdbarch_frame_num_args_ftype *frame_num_args; | |
209 | }; | |
0f71a2f6 JM |
210 | |
211 | ||
212 | /* The default architecture uses host values (for want of a better | |
213 | choice). */ | |
214 | ||
215 | extern const struct bfd_arch_info bfd_default_arch_struct; | |
216 | ||
adf40b2e | 217 | struct gdbarch default_gdbarch = { |
0f71a2f6 JM |
218 | /* basic architecture information */ |
219 | &bfd_default_arch_struct, | |
220 | BIG_ENDIAN, | |
221 | /* target specific vector */ | |
222 | NULL, | |
223 | /*per-architecture data-pointers and swap regions */ | |
224 | 0, NULL, NULL, | |
225 | /* Multi-arch values */ | |
adf40b2e | 226 | 8 * sizeof (void*), |
0f71a2f6 JM |
227 | 8 * sizeof (short), |
228 | 8 * sizeof (int), | |
229 | 8 * sizeof (long), | |
230 | 8 * sizeof (LONGEST), | |
231 | 8 * sizeof (float), | |
232 | 8 * sizeof (double), | |
233 | 8 * sizeof (long double), | |
234 | 0, | |
235 | 0, | |
236 | 0, | |
237 | 0, | |
238 | 0, | |
239 | 0, | |
240 | 0, | |
241 | 0, | |
242 | 0, | |
243 | 0, | |
244 | 0, | |
245 | 0, | |
246 | 0, | |
247 | 0, | |
248 | 0, | |
249 | 0, | |
250 | 0, | |
251 | 0, | |
252 | 0, | |
253 | 0, | |
254 | 0, | |
255 | 0, | |
256 | 0, | |
257 | 0, | |
258 | 0, | |
259 | 0, | |
260 | 0, | |
261 | 0, | |
262 | 0, | |
263 | 0, | |
264 | 0, | |
265 | 0, | |
266 | 0, | |
267 | 0, | |
268 | 0, | |
269 | generic_get_saved_register, | |
270 | 0, | |
271 | 0, | |
272 | 0, | |
273 | 0, | |
274 | 0, | |
275 | 0, | |
276 | 0, | |
277 | 0, | |
278 | 0, | |
279 | 0, | |
280 | 0, | |
281 | 0, | |
282 | 0, | |
283 | 0, | |
284 | 0, | |
285 | 0, | |
286 | 0, | |
287 | 0, | |
288 | 0, | |
289 | 0, | |
290 | 0, | |
291 | 0, | |
292 | 0, | |
293 | 0, | |
294 | 0, | |
295 | 0, | |
296 | 0, | |
297 | 0, | |
298 | 0, | |
299 | 0, | |
300 | 0, | |
301 | 0, | |
302 | 0, | |
303 | 0, | |
304 | 0, | |
917317f4 JM |
305 | 0, |
306 | 0, | |
0f71a2f6 JM |
307 | /* default_gdbarch() */ |
308 | }; | |
309 | struct gdbarch *current_gdbarch = &default_gdbarch; | |
310 | ||
311 | ||
312 | /* Create a new ``struct gdbarch'' based in information provided by | |
313 | ``struct gdbarch_info''. */ | |
314 | ||
315 | struct gdbarch * | |
104c1213 JM |
316 | gdbarch_alloc (const struct gdbarch_info *info, |
317 | struct gdbarch_tdep *tdep) | |
0f71a2f6 JM |
318 | { |
319 | struct gdbarch *gdbarch = XMALLOC (struct gdbarch); | |
320 | memset (gdbarch, 0, sizeof (*gdbarch)); | |
321 | ||
322 | gdbarch->tdep = tdep; | |
323 | ||
324 | gdbarch->bfd_arch_info = info->bfd_arch_info; | |
325 | gdbarch->byte_order = info->byte_order; | |
326 | ||
327 | /* Force the explicit initialization of these. */ | |
328 | gdbarch->num_regs = -1; | |
329 | gdbarch->sp_regnum = -1; | |
330 | gdbarch->fp_regnum = -1; | |
331 | gdbarch->pc_regnum = -1; | |
332 | gdbarch->register_size = -1; | |
333 | gdbarch->register_bytes = -1; | |
334 | gdbarch->max_register_raw_size = -1; | |
335 | gdbarch->max_register_virtual_size = -1; | |
336 | gdbarch->use_generic_dummy_frames = -1; | |
337 | gdbarch->call_dummy_start_offset = -1; | |
338 | gdbarch->call_dummy_breakpoint_offset = -1; | |
339 | gdbarch->call_dummy_breakpoint_offset_p = -1; | |
340 | gdbarch->call_dummy_length = -1; | |
341 | gdbarch->call_dummy_p = -1; | |
342 | gdbarch->call_dummy_stack_adjust_p = -1; | |
917317f4 JM |
343 | gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint; |
344 | gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint; | |
0f71a2f6 JM |
345 | gdbarch->decr_pc_after_break = -1; |
346 | gdbarch->function_start_offset = -1; | |
347 | gdbarch->frame_args_skip = -1; | |
348 | /* gdbarch_alloc() */ | |
349 | ||
350 | return gdbarch; | |
351 | } | |
352 | ||
353 | ||
354 | /* Ensure that all values in a GDBARCH are reasonable. */ | |
355 | ||
0f71a2f6 | 356 | static void |
104c1213 | 357 | verify_gdbarch (struct gdbarch *gdbarch) |
0f71a2f6 JM |
358 | { |
359 | /* Only perform sanity checks on a multi-arch target. */ | |
360 | if (GDB_MULTI_ARCH <= 0) | |
361 | return; | |
362 | /* fundamental */ | |
363 | if (gdbarch->byte_order == 0) | |
96baa820 | 364 | internal_error ("verify_gdbarch: byte-order unset"); |
0f71a2f6 | 365 | if (gdbarch->bfd_arch_info == NULL) |
96baa820 | 366 | internal_error ("verify_gdbarch: bfd_arch_info unset"); |
0f71a2f6 JM |
367 | /* Check those that need to be defined for the given multi-arch level. */ |
368 | if ((GDB_MULTI_ARCH >= 1) | |
369 | && (gdbarch->ptr_bit == 0)) | |
96baa820 | 370 | internal_error ("gdbarch: verify_gdbarch: ptr_bit invalid"); |
0f71a2f6 JM |
371 | if ((GDB_MULTI_ARCH >= 1) |
372 | && (gdbarch->short_bit == 0)) | |
96baa820 | 373 | internal_error ("gdbarch: verify_gdbarch: short_bit invalid"); |
0f71a2f6 JM |
374 | if ((GDB_MULTI_ARCH >= 1) |
375 | && (gdbarch->int_bit == 0)) | |
96baa820 | 376 | internal_error ("gdbarch: verify_gdbarch: int_bit invalid"); |
0f71a2f6 JM |
377 | if ((GDB_MULTI_ARCH >= 1) |
378 | && (gdbarch->long_bit == 0)) | |
96baa820 | 379 | internal_error ("gdbarch: verify_gdbarch: long_bit invalid"); |
0f71a2f6 JM |
380 | if ((GDB_MULTI_ARCH >= 1) |
381 | && (gdbarch->long_long_bit == 0)) | |
96baa820 | 382 | internal_error ("gdbarch: verify_gdbarch: long_long_bit invalid"); |
0f71a2f6 JM |
383 | if ((GDB_MULTI_ARCH >= 1) |
384 | && (gdbarch->float_bit == 0)) | |
96baa820 | 385 | internal_error ("gdbarch: verify_gdbarch: float_bit invalid"); |
0f71a2f6 JM |
386 | if ((GDB_MULTI_ARCH >= 1) |
387 | && (gdbarch->double_bit == 0)) | |
96baa820 | 388 | internal_error ("gdbarch: verify_gdbarch: double_bit invalid"); |
0f71a2f6 JM |
389 | if ((GDB_MULTI_ARCH >= 1) |
390 | && (gdbarch->long_double_bit == 0)) | |
96baa820 | 391 | internal_error ("gdbarch: verify_gdbarch: long_double_bit invalid"); |
0f71a2f6 JM |
392 | if ((GDB_MULTI_ARCH >= 1) |
393 | && (gdbarch->read_pc == 0)) | |
96baa820 | 394 | internal_error ("gdbarch: verify_gdbarch: read_pc invalid"); |
0f71a2f6 JM |
395 | if ((GDB_MULTI_ARCH >= 1) |
396 | && (gdbarch->write_pc == 0)) | |
96baa820 | 397 | internal_error ("gdbarch: verify_gdbarch: write_pc invalid"); |
0f71a2f6 JM |
398 | if ((GDB_MULTI_ARCH >= 1) |
399 | && (gdbarch->read_fp == 0)) | |
96baa820 | 400 | internal_error ("gdbarch: verify_gdbarch: read_fp invalid"); |
0f71a2f6 JM |
401 | if ((GDB_MULTI_ARCH >= 1) |
402 | && (gdbarch->write_fp == 0)) | |
96baa820 | 403 | internal_error ("gdbarch: verify_gdbarch: write_fp invalid"); |
0f71a2f6 JM |
404 | if ((GDB_MULTI_ARCH >= 1) |
405 | && (gdbarch->read_sp == 0)) | |
96baa820 | 406 | internal_error ("gdbarch: verify_gdbarch: read_sp invalid"); |
0f71a2f6 JM |
407 | if ((GDB_MULTI_ARCH >= 1) |
408 | && (gdbarch->write_sp == 0)) | |
96baa820 | 409 | internal_error ("gdbarch: verify_gdbarch: write_sp invalid"); |
0f71a2f6 JM |
410 | if ((GDB_MULTI_ARCH >= 2) |
411 | && (gdbarch->num_regs == -1)) | |
96baa820 | 412 | internal_error ("gdbarch: verify_gdbarch: num_regs invalid"); |
0f71a2f6 JM |
413 | if ((GDB_MULTI_ARCH >= 2) |
414 | && (gdbarch->sp_regnum == -1)) | |
96baa820 | 415 | internal_error ("gdbarch: verify_gdbarch: sp_regnum invalid"); |
0f71a2f6 JM |
416 | if ((GDB_MULTI_ARCH >= 2) |
417 | && (gdbarch->fp_regnum == -1)) | |
96baa820 | 418 | internal_error ("gdbarch: verify_gdbarch: fp_regnum invalid"); |
0f71a2f6 JM |
419 | if ((GDB_MULTI_ARCH >= 2) |
420 | && (gdbarch->pc_regnum == -1)) | |
96baa820 | 421 | internal_error ("gdbarch: verify_gdbarch: pc_regnum invalid"); |
0f71a2f6 JM |
422 | if ((GDB_MULTI_ARCH >= 2) |
423 | && (gdbarch->register_name == 0)) | |
96baa820 | 424 | internal_error ("gdbarch: verify_gdbarch: register_name invalid"); |
0f71a2f6 JM |
425 | if ((GDB_MULTI_ARCH >= 2) |
426 | && (gdbarch->register_size == -1)) | |
96baa820 | 427 | internal_error ("gdbarch: verify_gdbarch: register_size invalid"); |
0f71a2f6 JM |
428 | if ((GDB_MULTI_ARCH >= 2) |
429 | && (gdbarch->register_bytes == -1)) | |
96baa820 | 430 | internal_error ("gdbarch: verify_gdbarch: register_bytes invalid"); |
0f71a2f6 JM |
431 | if ((GDB_MULTI_ARCH >= 2) |
432 | && (gdbarch->register_byte == 0)) | |
96baa820 | 433 | internal_error ("gdbarch: verify_gdbarch: register_byte invalid"); |
0f71a2f6 JM |
434 | if ((GDB_MULTI_ARCH >= 2) |
435 | && (gdbarch->register_raw_size == 0)) | |
96baa820 | 436 | internal_error ("gdbarch: verify_gdbarch: register_raw_size invalid"); |
0f71a2f6 JM |
437 | if ((GDB_MULTI_ARCH >= 2) |
438 | && (gdbarch->max_register_raw_size == -1)) | |
96baa820 | 439 | internal_error ("gdbarch: verify_gdbarch: max_register_raw_size invalid"); |
0f71a2f6 JM |
440 | if ((GDB_MULTI_ARCH >= 2) |
441 | && (gdbarch->register_virtual_size == 0)) | |
96baa820 | 442 | internal_error ("gdbarch: verify_gdbarch: register_virtual_size invalid"); |
0f71a2f6 JM |
443 | if ((GDB_MULTI_ARCH >= 2) |
444 | && (gdbarch->max_register_virtual_size == -1)) | |
96baa820 | 445 | internal_error ("gdbarch: verify_gdbarch: max_register_virtual_size invalid"); |
0f71a2f6 JM |
446 | if ((GDB_MULTI_ARCH >= 2) |
447 | && (gdbarch->register_virtual_type == 0)) | |
96baa820 | 448 | internal_error ("gdbarch: verify_gdbarch: register_virtual_type invalid"); |
0f71a2f6 JM |
449 | if ((GDB_MULTI_ARCH >= 1) |
450 | && (gdbarch->use_generic_dummy_frames == -1)) | |
96baa820 | 451 | internal_error ("gdbarch: verify_gdbarch: use_generic_dummy_frames invalid"); |
0f71a2f6 JM |
452 | if ((GDB_MULTI_ARCH >= 2) |
453 | && (gdbarch->call_dummy_location == 0)) | |
96baa820 | 454 | internal_error ("gdbarch: verify_gdbarch: call_dummy_location invalid"); |
0f71a2f6 JM |
455 | if ((GDB_MULTI_ARCH >= 2) |
456 | && (gdbarch->call_dummy_location == AT_ENTRY_POINT && gdbarch->call_dummy_address == 0)) | |
96baa820 | 457 | internal_error ("gdbarch: verify_gdbarch: call_dummy_address invalid"); |
0f71a2f6 JM |
458 | if ((GDB_MULTI_ARCH >= 2) |
459 | && (gdbarch->call_dummy_start_offset == -1)) | |
96baa820 | 460 | internal_error ("gdbarch: verify_gdbarch: call_dummy_start_offset invalid"); |
0f71a2f6 JM |
461 | if ((GDB_MULTI_ARCH >= 2) |
462 | && (gdbarch->call_dummy_breakpoint_offset == -1)) | |
96baa820 | 463 | internal_error ("gdbarch: verify_gdbarch: call_dummy_breakpoint_offset invalid"); |
0f71a2f6 JM |
464 | if ((GDB_MULTI_ARCH >= 1) |
465 | && (gdbarch->call_dummy_breakpoint_offset_p == -1)) | |
96baa820 | 466 | internal_error ("gdbarch: verify_gdbarch: call_dummy_breakpoint_offset_p invalid"); |
0f71a2f6 JM |
467 | if ((GDB_MULTI_ARCH >= 2) |
468 | && (gdbarch->call_dummy_length == -1)) | |
96baa820 | 469 | internal_error ("gdbarch: verify_gdbarch: call_dummy_length invalid"); |
0f71a2f6 JM |
470 | if ((GDB_MULTI_ARCH >= 2) |
471 | && (gdbarch->pc_in_call_dummy == 0)) | |
96baa820 | 472 | internal_error ("gdbarch: verify_gdbarch: pc_in_call_dummy invalid"); |
0f71a2f6 JM |
473 | if ((GDB_MULTI_ARCH >= 1) |
474 | && (gdbarch->call_dummy_p == -1)) | |
96baa820 | 475 | internal_error ("gdbarch: verify_gdbarch: call_dummy_p invalid"); |
0f71a2f6 JM |
476 | if ((GDB_MULTI_ARCH >= 1) |
477 | && (gdbarch->call_dummy_stack_adjust_p == -1)) | |
96baa820 | 478 | internal_error ("gdbarch: verify_gdbarch: call_dummy_stack_adjust_p invalid"); |
0f71a2f6 JM |
479 | if ((GDB_MULTI_ARCH >= 2) |
480 | && (gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0)) | |
96baa820 | 481 | internal_error ("gdbarch: verify_gdbarch: call_dummy_stack_adjust invalid"); |
0f71a2f6 JM |
482 | if ((GDB_MULTI_ARCH >= 2) |
483 | && (gdbarch->fix_call_dummy == 0)) | |
96baa820 | 484 | internal_error ("gdbarch: verify_gdbarch: fix_call_dummy invalid"); |
0f71a2f6 JM |
485 | if ((GDB_MULTI_ARCH >= 1) |
486 | && (gdbarch->get_saved_register == 0)) | |
96baa820 | 487 | internal_error ("gdbarch: verify_gdbarch: get_saved_register invalid"); |
0f71a2f6 JM |
488 | if ((GDB_MULTI_ARCH >= 1) |
489 | && (gdbarch->register_convertible == 0)) | |
96baa820 | 490 | internal_error ("gdbarch: verify_gdbarch: register_convertible invalid"); |
0f71a2f6 JM |
491 | if ((GDB_MULTI_ARCH >= 2) |
492 | && (gdbarch->register_convert_to_virtual == 0)) | |
96baa820 | 493 | internal_error ("gdbarch: verify_gdbarch: register_convert_to_virtual invalid"); |
0f71a2f6 JM |
494 | if ((GDB_MULTI_ARCH >= 2) |
495 | && (gdbarch->register_convert_to_raw == 0)) | |
96baa820 | 496 | internal_error ("gdbarch: verify_gdbarch: register_convert_to_raw invalid"); |
0f71a2f6 JM |
497 | if ((GDB_MULTI_ARCH >= 2) |
498 | && (gdbarch->extract_return_value == 0)) | |
96baa820 | 499 | internal_error ("gdbarch: verify_gdbarch: extract_return_value invalid"); |
0f71a2f6 JM |
500 | if ((GDB_MULTI_ARCH >= 1) |
501 | && (gdbarch->push_arguments == 0)) | |
96baa820 | 502 | internal_error ("gdbarch: verify_gdbarch: push_arguments invalid"); |
0f71a2f6 JM |
503 | if ((GDB_MULTI_ARCH >= 2) |
504 | && (gdbarch->push_dummy_frame == 0)) | |
96baa820 | 505 | internal_error ("gdbarch: verify_gdbarch: push_dummy_frame invalid"); |
0f71a2f6 JM |
506 | if ((GDB_MULTI_ARCH >= 1) |
507 | && (gdbarch->push_return_address == 0)) | |
96baa820 | 508 | internal_error ("gdbarch: verify_gdbarch: push_return_address invalid"); |
0f71a2f6 JM |
509 | if ((GDB_MULTI_ARCH >= 2) |
510 | && (gdbarch->pop_frame == 0)) | |
96baa820 | 511 | internal_error ("gdbarch: verify_gdbarch: pop_frame invalid"); |
0f71a2f6 JM |
512 | if ((GDB_MULTI_ARCH >= 2) |
513 | && (gdbarch->d10v_make_daddr == 0)) | |
96baa820 | 514 | internal_error ("gdbarch: verify_gdbarch: d10v_make_daddr invalid"); |
0f71a2f6 JM |
515 | if ((GDB_MULTI_ARCH >= 2) |
516 | && (gdbarch->d10v_make_iaddr == 0)) | |
96baa820 | 517 | internal_error ("gdbarch: verify_gdbarch: d10v_make_iaddr invalid"); |
0f71a2f6 JM |
518 | if ((GDB_MULTI_ARCH >= 2) |
519 | && (gdbarch->d10v_daddr_p == 0)) | |
96baa820 | 520 | internal_error ("gdbarch: verify_gdbarch: d10v_daddr_p invalid"); |
0f71a2f6 JM |
521 | if ((GDB_MULTI_ARCH >= 2) |
522 | && (gdbarch->d10v_iaddr_p == 0)) | |
96baa820 | 523 | internal_error ("gdbarch: verify_gdbarch: d10v_iaddr_p invalid"); |
0f71a2f6 JM |
524 | if ((GDB_MULTI_ARCH >= 2) |
525 | && (gdbarch->d10v_convert_daddr_to_raw == 0)) | |
96baa820 | 526 | internal_error ("gdbarch: verify_gdbarch: d10v_convert_daddr_to_raw invalid"); |
0f71a2f6 JM |
527 | if ((GDB_MULTI_ARCH >= 2) |
528 | && (gdbarch->d10v_convert_iaddr_to_raw == 0)) | |
96baa820 | 529 | internal_error ("gdbarch: verify_gdbarch: d10v_convert_iaddr_to_raw invalid"); |
0f71a2f6 JM |
530 | if ((GDB_MULTI_ARCH >= 2) |
531 | && (gdbarch->store_struct_return == 0)) | |
96baa820 | 532 | internal_error ("gdbarch: verify_gdbarch: store_struct_return invalid"); |
0f71a2f6 JM |
533 | if ((GDB_MULTI_ARCH >= 2) |
534 | && (gdbarch->store_return_value == 0)) | |
96baa820 | 535 | internal_error ("gdbarch: verify_gdbarch: store_return_value invalid"); |
0f71a2f6 JM |
536 | if ((GDB_MULTI_ARCH >= 2) |
537 | && (gdbarch->extract_struct_value_address == 0)) | |
96baa820 | 538 | internal_error ("gdbarch: verify_gdbarch: extract_struct_value_address invalid"); |
0f71a2f6 JM |
539 | if ((GDB_MULTI_ARCH >= 2) |
540 | && (gdbarch->use_struct_convention == 0)) | |
96baa820 | 541 | internal_error ("gdbarch: verify_gdbarch: use_struct_convention invalid"); |
0f71a2f6 JM |
542 | if ((GDB_MULTI_ARCH >= 2) |
543 | && (gdbarch->frame_init_saved_regs == 0)) | |
96baa820 | 544 | internal_error ("gdbarch: verify_gdbarch: frame_init_saved_regs invalid"); |
0f71a2f6 JM |
545 | if ((GDB_MULTI_ARCH >= 2) |
546 | && (gdbarch->init_extra_frame_info == 0)) | |
96baa820 | 547 | internal_error ("gdbarch: verify_gdbarch: init_extra_frame_info invalid"); |
0f71a2f6 JM |
548 | if ((GDB_MULTI_ARCH >= 2) |
549 | && (gdbarch->skip_prologue == 0)) | |
96baa820 | 550 | internal_error ("gdbarch: verify_gdbarch: skip_prologue invalid"); |
0f71a2f6 JM |
551 | if ((GDB_MULTI_ARCH >= 2) |
552 | && (gdbarch->inner_than == 0)) | |
96baa820 | 553 | internal_error ("gdbarch: verify_gdbarch: inner_than invalid"); |
0f71a2f6 JM |
554 | if ((GDB_MULTI_ARCH >= 2) |
555 | && (gdbarch->breakpoint_from_pc == 0)) | |
96baa820 | 556 | internal_error ("gdbarch: verify_gdbarch: breakpoint_from_pc invalid"); |
917317f4 JM |
557 | if ((GDB_MULTI_ARCH >= 2) |
558 | && (0)) | |
559 | internal_error ("gdbarch: verify_gdbarch: memory_insert_breakpoint invalid"); | |
560 | if ((GDB_MULTI_ARCH >= 2) | |
561 | && (0)) | |
562 | internal_error ("gdbarch: verify_gdbarch: memory_remove_breakpoint invalid"); | |
0f71a2f6 JM |
563 | if ((GDB_MULTI_ARCH >= 2) |
564 | && (gdbarch->decr_pc_after_break == -1)) | |
96baa820 | 565 | internal_error ("gdbarch: verify_gdbarch: decr_pc_after_break invalid"); |
0f71a2f6 JM |
566 | if ((GDB_MULTI_ARCH >= 2) |
567 | && (gdbarch->function_start_offset == -1)) | |
96baa820 | 568 | internal_error ("gdbarch: verify_gdbarch: function_start_offset invalid"); |
0f71a2f6 JM |
569 | if ((GDB_MULTI_ARCH >= 2) |
570 | && (gdbarch->remote_translate_xfer_address == 0)) | |
96baa820 | 571 | internal_error ("gdbarch: verify_gdbarch: remote_translate_xfer_address invalid"); |
0f71a2f6 JM |
572 | if ((GDB_MULTI_ARCH >= 2) |
573 | && (gdbarch->frame_args_skip == -1)) | |
96baa820 | 574 | internal_error ("gdbarch: verify_gdbarch: frame_args_skip invalid"); |
0f71a2f6 JM |
575 | if ((GDB_MULTI_ARCH >= 2) |
576 | && (gdbarch->frameless_function_invocation == 0)) | |
96baa820 | 577 | internal_error ("gdbarch: verify_gdbarch: frameless_function_invocation invalid"); |
0f71a2f6 JM |
578 | if ((GDB_MULTI_ARCH >= 2) |
579 | && (gdbarch->frame_chain == 0)) | |
96baa820 | 580 | internal_error ("gdbarch: verify_gdbarch: frame_chain invalid"); |
0f71a2f6 JM |
581 | if ((GDB_MULTI_ARCH >= 1) |
582 | && (gdbarch->frame_chain_valid == 0)) | |
96baa820 | 583 | internal_error ("gdbarch: verify_gdbarch: frame_chain_valid invalid"); |
0f71a2f6 JM |
584 | if ((GDB_MULTI_ARCH >= 2) |
585 | && (gdbarch->frame_saved_pc == 0)) | |
96baa820 | 586 | internal_error ("gdbarch: verify_gdbarch: frame_saved_pc invalid"); |
0f71a2f6 JM |
587 | if ((GDB_MULTI_ARCH >= 2) |
588 | && (gdbarch->frame_args_address == 0)) | |
96baa820 | 589 | internal_error ("gdbarch: verify_gdbarch: frame_args_address invalid"); |
0f71a2f6 JM |
590 | if ((GDB_MULTI_ARCH >= 2) |
591 | && (gdbarch->frame_locals_address == 0)) | |
96baa820 | 592 | internal_error ("gdbarch: verify_gdbarch: frame_locals_address invalid"); |
0f71a2f6 JM |
593 | if ((GDB_MULTI_ARCH >= 2) |
594 | && (gdbarch->saved_pc_after_call == 0)) | |
96baa820 | 595 | internal_error ("gdbarch: verify_gdbarch: saved_pc_after_call invalid"); |
0f71a2f6 JM |
596 | if ((GDB_MULTI_ARCH >= 2) |
597 | && (gdbarch->frame_num_args == 0)) | |
96baa820 | 598 | internal_error ("gdbarch: verify_gdbarch: frame_num_args invalid"); |
0f71a2f6 JM |
599 | } |
600 | ||
601 | ||
602 | /* Print out the details of the current architecture. */ | |
603 | ||
604 | void | |
104c1213 | 605 | gdbarch_dump (void) |
0f71a2f6 JM |
606 | { |
607 | if (TARGET_ARCHITECTURE != NULL) | |
608 | fprintf_unfiltered (gdb_stdlog, | |
adf40b2e JM |
609 | "gdbarch_update: TARGET_ARCHITECTURE = %s\n", |
610 | TARGET_ARCHITECTURE->printable_name); | |
0f71a2f6 | 611 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
612 | "gdbarch_update: TARGET_BYTE_ORDER = %ld\n", |
613 | (long) TARGET_BYTE_ORDER); | |
0f71a2f6 | 614 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
615 | "gdbarch_update: TARGET_PTR_BIT = %ld\n", |
616 | (long) TARGET_PTR_BIT); | |
0f71a2f6 | 617 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
618 | "gdbarch_update: TARGET_SHORT_BIT = %ld\n", |
619 | (long) TARGET_SHORT_BIT); | |
0f71a2f6 | 620 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
621 | "gdbarch_update: TARGET_INT_BIT = %ld\n", |
622 | (long) TARGET_INT_BIT); | |
0f71a2f6 | 623 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
624 | "gdbarch_update: TARGET_LONG_BIT = %ld\n", |
625 | (long) TARGET_LONG_BIT); | |
0f71a2f6 | 626 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
627 | "gdbarch_update: TARGET_LONG_LONG_BIT = %ld\n", |
628 | (long) TARGET_LONG_LONG_BIT); | |
0f71a2f6 | 629 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
630 | "gdbarch_update: TARGET_FLOAT_BIT = %ld\n", |
631 | (long) TARGET_FLOAT_BIT); | |
0f71a2f6 | 632 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
633 | "gdbarch_update: TARGET_DOUBLE_BIT = %ld\n", |
634 | (long) TARGET_DOUBLE_BIT); | |
0f71a2f6 | 635 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
636 | "gdbarch_update: TARGET_LONG_DOUBLE_BIT = %ld\n", |
637 | (long) TARGET_LONG_DOUBLE_BIT); | |
0f71a2f6 | 638 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
639 | "gdbarch_update: TARGET_READ_PC = 0x%08lx\n", |
640 | (long) current_gdbarch->read_pc | |
641 | /*TARGET_READ_PC ()*/); | |
0f71a2f6 | 642 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
643 | "gdbarch_update: TARGET_WRITE_PC = 0x%08lx\n", |
644 | (long) current_gdbarch->write_pc | |
645 | /*TARGET_WRITE_PC ()*/); | |
0f71a2f6 | 646 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
647 | "gdbarch_update: TARGET_READ_FP = 0x%08lx\n", |
648 | (long) current_gdbarch->read_fp | |
649 | /*TARGET_READ_FP ()*/); | |
0f71a2f6 | 650 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
651 | "gdbarch_update: TARGET_WRITE_FP = 0x%08lx\n", |
652 | (long) current_gdbarch->write_fp | |
653 | /*TARGET_WRITE_FP ()*/); | |
0f71a2f6 | 654 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
655 | "gdbarch_update: TARGET_READ_SP = 0x%08lx\n", |
656 | (long) current_gdbarch->read_sp | |
657 | /*TARGET_READ_SP ()*/); | |
0f71a2f6 | 658 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
659 | "gdbarch_update: TARGET_WRITE_SP = 0x%08lx\n", |
660 | (long) current_gdbarch->write_sp | |
661 | /*TARGET_WRITE_SP ()*/); | |
0f71a2f6 | 662 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
663 | "gdbarch_update: NUM_REGS = %ld\n", |
664 | (long) NUM_REGS); | |
0f71a2f6 | 665 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
666 | "gdbarch_update: SP_REGNUM = %ld\n", |
667 | (long) SP_REGNUM); | |
0f71a2f6 | 668 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
669 | "gdbarch_update: FP_REGNUM = %ld\n", |
670 | (long) FP_REGNUM); | |
0f71a2f6 | 671 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
672 | "gdbarch_update: PC_REGNUM = %ld\n", |
673 | (long) PC_REGNUM); | |
0f71a2f6 | 674 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
675 | "gdbarch_update: REGISTER_NAME = 0x%08lx\n", |
676 | (long) current_gdbarch->register_name | |
677 | /*REGISTER_NAME ()*/); | |
0f71a2f6 | 678 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
679 | "gdbarch_update: REGISTER_SIZE = %ld\n", |
680 | (long) REGISTER_SIZE); | |
0f71a2f6 | 681 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
682 | "gdbarch_update: REGISTER_BYTES = %ld\n", |
683 | (long) REGISTER_BYTES); | |
0f71a2f6 | 684 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
685 | "gdbarch_update: REGISTER_BYTE = 0x%08lx\n", |
686 | (long) current_gdbarch->register_byte | |
687 | /*REGISTER_BYTE ()*/); | |
0f71a2f6 | 688 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
689 | "gdbarch_update: REGISTER_RAW_SIZE = 0x%08lx\n", |
690 | (long) current_gdbarch->register_raw_size | |
691 | /*REGISTER_RAW_SIZE ()*/); | |
0f71a2f6 | 692 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
693 | "gdbarch_update: MAX_REGISTER_RAW_SIZE = %ld\n", |
694 | (long) MAX_REGISTER_RAW_SIZE); | |
0f71a2f6 | 695 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
696 | "gdbarch_update: REGISTER_VIRTUAL_SIZE = 0x%08lx\n", |
697 | (long) current_gdbarch->register_virtual_size | |
698 | /*REGISTER_VIRTUAL_SIZE ()*/); | |
0f71a2f6 | 699 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
700 | "gdbarch_update: MAX_REGISTER_VIRTUAL_SIZE = %ld\n", |
701 | (long) MAX_REGISTER_VIRTUAL_SIZE); | |
0f71a2f6 | 702 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
703 | "gdbarch_update: REGISTER_VIRTUAL_TYPE = 0x%08lx\n", |
704 | (long) current_gdbarch->register_virtual_type | |
705 | /*REGISTER_VIRTUAL_TYPE ()*/); | |
0f71a2f6 | 706 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
707 | "gdbarch_update: USE_GENERIC_DUMMY_FRAMES = %ld\n", |
708 | (long) USE_GENERIC_DUMMY_FRAMES); | |
0f71a2f6 | 709 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
710 | "gdbarch_update: CALL_DUMMY_LOCATION = %ld\n", |
711 | (long) CALL_DUMMY_LOCATION); | |
0f71a2f6 | 712 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
713 | "gdbarch_update: CALL_DUMMY_ADDRESS = 0x%08lx\n", |
714 | (long) current_gdbarch->call_dummy_address | |
715 | /*CALL_DUMMY_ADDRESS ()*/); | |
0f71a2f6 | 716 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
717 | "gdbarch_update: CALL_DUMMY_START_OFFSET = 0x%08lx\n", |
718 | (long) CALL_DUMMY_START_OFFSET); | |
0f71a2f6 | 719 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
720 | "gdbarch_update: CALL_DUMMY_BREAKPOINT_OFFSET = 0x%08lx\n", |
721 | (long) CALL_DUMMY_BREAKPOINT_OFFSET); | |
0f71a2f6 | 722 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
723 | "gdbarch_update: CALL_DUMMY_BREAKPOINT_OFFSET_P = %ld\n", |
724 | (long) CALL_DUMMY_BREAKPOINT_OFFSET_P); | |
0f71a2f6 JM |
725 | if (CALL_DUMMY_LOCATION == BEFORE_TEXT_END || CALL_DUMMY_LOCATION == AFTER_TEXT_END) |
726 | fprintf_unfiltered (gdb_stdlog, | |
adf40b2e JM |
727 | "gdbarch_update: CALL_DUMMY_LENGTH = %ld\n", |
728 | (long) CALL_DUMMY_LENGTH); | |
0f71a2f6 | 729 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
730 | "gdbarch_update: PC_IN_CALL_DUMMY = 0x%08lx\n", |
731 | (long) current_gdbarch->pc_in_call_dummy | |
732 | /*PC_IN_CALL_DUMMY ()*/); | |
0f71a2f6 | 733 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
734 | "gdbarch_update: CALL_DUMMY_P = %ld\n", |
735 | (long) CALL_DUMMY_P); | |
0f71a2f6 | 736 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
737 | "gdbarch_update: CALL_DUMMY_WORDS = 0x%08lx\n", |
738 | (long) CALL_DUMMY_WORDS); | |
0f71a2f6 | 739 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
740 | "gdbarch_update: SIZEOF_CALL_DUMMY_WORDS = 0x%08lx\n", |
741 | (long) SIZEOF_CALL_DUMMY_WORDS); | |
0f71a2f6 | 742 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
743 | "gdbarch_update: CALL_DUMMY_STACK_ADJUST_P = 0x%08lx\n", |
744 | (long) CALL_DUMMY_STACK_ADJUST_P); | |
0f71a2f6 JM |
745 | if (CALL_DUMMY_STACK_ADJUST_P) |
746 | fprintf_unfiltered (gdb_stdlog, | |
adf40b2e JM |
747 | "gdbarch_update: CALL_DUMMY_STACK_ADJUST = 0x%08lx\n", |
748 | (long) CALL_DUMMY_STACK_ADJUST); | |
0f71a2f6 | 749 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
750 | "gdbarch_update: FIX_CALL_DUMMY = 0x%08lx\n", |
751 | (long) current_gdbarch->fix_call_dummy | |
752 | /*FIX_CALL_DUMMY ()*/); | |
0f71a2f6 JM |
753 | #ifdef BELIEVE_PCC_PROMOTION |
754 | fprintf_unfiltered (gdb_stdlog, | |
adf40b2e JM |
755 | "gdbarch_update: BELIEVE_PCC_PROMOTION = %ld\n", |
756 | (long) BELIEVE_PCC_PROMOTION); | |
0f71a2f6 JM |
757 | #endif |
758 | #ifdef BELIEVE_PCC_PROMOTION_TYPE | |
759 | fprintf_unfiltered (gdb_stdlog, | |
adf40b2e JM |
760 | "gdbarch_update: BELIEVE_PCC_PROMOTION_TYPE = %ld\n", |
761 | (long) BELIEVE_PCC_PROMOTION_TYPE); | |
0f71a2f6 JM |
762 | #endif |
763 | fprintf_unfiltered (gdb_stdlog, | |
adf40b2e JM |
764 | "gdbarch_update: GET_SAVED_REGISTER = 0x%08lx\n", |
765 | (long) current_gdbarch->get_saved_register | |
766 | /*GET_SAVED_REGISTER ()*/); | |
0f71a2f6 | 767 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
768 | "gdbarch_update: REGISTER_CONVERTIBLE = 0x%08lx\n", |
769 | (long) current_gdbarch->register_convertible | |
770 | /*REGISTER_CONVERTIBLE ()*/); | |
0f71a2f6 | 771 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
772 | "gdbarch_update: REGISTER_CONVERT_TO_VIRTUAL = 0x%08lx\n", |
773 | (long) current_gdbarch->register_convert_to_virtual | |
774 | /*REGISTER_CONVERT_TO_VIRTUAL ()*/); | |
0f71a2f6 | 775 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
776 | "gdbarch_update: REGISTER_CONVERT_TO_RAW = 0x%08lx\n", |
777 | (long) current_gdbarch->register_convert_to_raw | |
778 | /*REGISTER_CONVERT_TO_RAW ()*/); | |
0f71a2f6 | 779 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
780 | "gdbarch_update: EXTRACT_RETURN_VALUE = 0x%08lx\n", |
781 | (long) current_gdbarch->extract_return_value | |
782 | /*EXTRACT_RETURN_VALUE ()*/); | |
0f71a2f6 | 783 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
784 | "gdbarch_update: PUSH_ARGUMENTS = 0x%08lx\n", |
785 | (long) current_gdbarch->push_arguments | |
786 | /*PUSH_ARGUMENTS ()*/); | |
0f71a2f6 | 787 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
788 | "gdbarch_update: PUSH_DUMMY_FRAME = 0x%08lx\n", |
789 | (long) current_gdbarch->push_dummy_frame | |
790 | /*PUSH_DUMMY_FRAME ()*/); | |
0f71a2f6 | 791 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
792 | "gdbarch_update: PUSH_RETURN_ADDRESS = 0x%08lx\n", |
793 | (long) current_gdbarch->push_return_address | |
794 | /*PUSH_RETURN_ADDRESS ()*/); | |
0f71a2f6 | 795 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
796 | "gdbarch_update: POP_FRAME = 0x%08lx\n", |
797 | (long) current_gdbarch->pop_frame | |
798 | /*POP_FRAME ()*/); | |
0f71a2f6 | 799 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
800 | "gdbarch_update: D10V_MAKE_DADDR = 0x%08lx\n", |
801 | (long) current_gdbarch->d10v_make_daddr | |
802 | /*D10V_MAKE_DADDR ()*/); | |
0f71a2f6 | 803 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
804 | "gdbarch_update: D10V_MAKE_IADDR = 0x%08lx\n", |
805 | (long) current_gdbarch->d10v_make_iaddr | |
806 | /*D10V_MAKE_IADDR ()*/); | |
0f71a2f6 | 807 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
808 | "gdbarch_update: D10V_DADDR_P = 0x%08lx\n", |
809 | (long) current_gdbarch->d10v_daddr_p | |
810 | /*D10V_DADDR_P ()*/); | |
0f71a2f6 | 811 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
812 | "gdbarch_update: D10V_IADDR_P = 0x%08lx\n", |
813 | (long) current_gdbarch->d10v_iaddr_p | |
814 | /*D10V_IADDR_P ()*/); | |
0f71a2f6 | 815 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
816 | "gdbarch_update: D10V_CONVERT_DADDR_TO_RAW = 0x%08lx\n", |
817 | (long) current_gdbarch->d10v_convert_daddr_to_raw | |
818 | /*D10V_CONVERT_DADDR_TO_RAW ()*/); | |
0f71a2f6 | 819 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
820 | "gdbarch_update: D10V_CONVERT_IADDR_TO_RAW = 0x%08lx\n", |
821 | (long) current_gdbarch->d10v_convert_iaddr_to_raw | |
822 | /*D10V_CONVERT_IADDR_TO_RAW ()*/); | |
0f71a2f6 | 823 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
824 | "gdbarch_update: STORE_STRUCT_RETURN = 0x%08lx\n", |
825 | (long) current_gdbarch->store_struct_return | |
826 | /*STORE_STRUCT_RETURN ()*/); | |
0f71a2f6 | 827 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
828 | "gdbarch_update: STORE_RETURN_VALUE = 0x%08lx\n", |
829 | (long) current_gdbarch->store_return_value | |
830 | /*STORE_RETURN_VALUE ()*/); | |
0f71a2f6 | 831 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
832 | "gdbarch_update: EXTRACT_STRUCT_VALUE_ADDRESS = 0x%08lx\n", |
833 | (long) current_gdbarch->extract_struct_value_address | |
834 | /*EXTRACT_STRUCT_VALUE_ADDRESS ()*/); | |
0f71a2f6 | 835 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
836 | "gdbarch_update: USE_STRUCT_CONVENTION = 0x%08lx\n", |
837 | (long) current_gdbarch->use_struct_convention | |
838 | /*USE_STRUCT_CONVENTION ()*/); | |
0f71a2f6 | 839 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
840 | "gdbarch_update: FRAME_INIT_SAVED_REGS = 0x%08lx\n", |
841 | (long) current_gdbarch->frame_init_saved_regs | |
842 | /*FRAME_INIT_SAVED_REGS ()*/); | |
0f71a2f6 | 843 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
844 | "gdbarch_update: INIT_EXTRA_FRAME_INFO = 0x%08lx\n", |
845 | (long) current_gdbarch->init_extra_frame_info | |
846 | /*INIT_EXTRA_FRAME_INFO ()*/); | |
0f71a2f6 | 847 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
848 | "gdbarch_update: SKIP_PROLOGUE = 0x%08lx\n", |
849 | (long) current_gdbarch->skip_prologue | |
850 | /*SKIP_PROLOGUE ()*/); | |
0f71a2f6 | 851 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
852 | "gdbarch_update: INNER_THAN = 0x%08lx\n", |
853 | (long) current_gdbarch->inner_than | |
854 | /*INNER_THAN ()*/); | |
0f71a2f6 | 855 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
856 | "gdbarch_update: BREAKPOINT_FROM_PC = 0x%08lx\n", |
857 | (long) current_gdbarch->breakpoint_from_pc | |
858 | /*BREAKPOINT_FROM_PC ()*/); | |
917317f4 JM |
859 | fprintf_unfiltered (gdb_stdlog, |
860 | "gdbarch_update: MEMORY_INSERT_BREAKPOINT = 0x%08lx\n", | |
861 | (long) current_gdbarch->memory_insert_breakpoint | |
862 | /*MEMORY_INSERT_BREAKPOINT ()*/); | |
863 | fprintf_unfiltered (gdb_stdlog, | |
864 | "gdbarch_update: MEMORY_REMOVE_BREAKPOINT = 0x%08lx\n", | |
865 | (long) current_gdbarch->memory_remove_breakpoint | |
866 | /*MEMORY_REMOVE_BREAKPOINT ()*/); | |
0f71a2f6 | 867 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
868 | "gdbarch_update: DECR_PC_AFTER_BREAK = %ld\n", |
869 | (long) DECR_PC_AFTER_BREAK); | |
0f71a2f6 | 870 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
871 | "gdbarch_update: FUNCTION_START_OFFSET = %ld\n", |
872 | (long) FUNCTION_START_OFFSET); | |
0f71a2f6 | 873 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
874 | "gdbarch_update: REMOTE_TRANSLATE_XFER_ADDRESS = 0x%08lx\n", |
875 | (long) current_gdbarch->remote_translate_xfer_address | |
876 | /*REMOTE_TRANSLATE_XFER_ADDRESS ()*/); | |
0f71a2f6 | 877 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
878 | "gdbarch_update: FRAME_ARGS_SKIP = %ld\n", |
879 | (long) FRAME_ARGS_SKIP); | |
0f71a2f6 | 880 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
881 | "gdbarch_update: FRAMELESS_FUNCTION_INVOCATION = 0x%08lx\n", |
882 | (long) current_gdbarch->frameless_function_invocation | |
883 | /*FRAMELESS_FUNCTION_INVOCATION ()*/); | |
0f71a2f6 | 884 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
885 | "gdbarch_update: FRAME_CHAIN = 0x%08lx\n", |
886 | (long) current_gdbarch->frame_chain | |
887 | /*FRAME_CHAIN ()*/); | |
0f71a2f6 | 888 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
889 | "gdbarch_update: FRAME_CHAIN_VALID = 0x%08lx\n", |
890 | (long) current_gdbarch->frame_chain_valid | |
891 | /*FRAME_CHAIN_VALID ()*/); | |
0f71a2f6 | 892 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
893 | "gdbarch_update: FRAME_SAVED_PC = 0x%08lx\n", |
894 | (long) current_gdbarch->frame_saved_pc | |
895 | /*FRAME_SAVED_PC ()*/); | |
0f71a2f6 | 896 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
897 | "gdbarch_update: FRAME_ARGS_ADDRESS = 0x%08lx\n", |
898 | (long) current_gdbarch->frame_args_address | |
899 | /*FRAME_ARGS_ADDRESS ()*/); | |
0f71a2f6 | 900 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
901 | "gdbarch_update: FRAME_LOCALS_ADDRESS = 0x%08lx\n", |
902 | (long) current_gdbarch->frame_locals_address | |
903 | /*FRAME_LOCALS_ADDRESS ()*/); | |
0f71a2f6 | 904 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
905 | "gdbarch_update: SAVED_PC_AFTER_CALL = 0x%08lx\n", |
906 | (long) current_gdbarch->saved_pc_after_call | |
907 | /*SAVED_PC_AFTER_CALL ()*/); | |
0f71a2f6 | 908 | fprintf_unfiltered (gdb_stdlog, |
adf40b2e JM |
909 | "gdbarch_update: FRAME_NUM_ARGS = 0x%08lx\n", |
910 | (long) current_gdbarch->frame_num_args | |
911 | /*FRAME_NUM_ARGS ()*/); | |
0f71a2f6 JM |
912 | } |
913 | ||
914 | struct gdbarch_tdep * | |
104c1213 | 915 | gdbarch_tdep (struct gdbarch *gdbarch) |
0f71a2f6 JM |
916 | { |
917 | if (gdbarch_debug >= 2) | |
918 | /* FIXME: gdb_std??? */ | |
919 | fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\n"); | |
920 | return gdbarch->tdep; | |
921 | } | |
922 | ||
923 | ||
924 | const struct bfd_arch_info * | |
104c1213 | 925 | gdbarch_bfd_arch_info (struct gdbarch *gdbarch) |
0f71a2f6 JM |
926 | { |
927 | if (gdbarch_debug >= 2) | |
928 | /* FIXME: gdb_std??? */ | |
929 | fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_arch_info called\n"); | |
930 | return gdbarch->bfd_arch_info; | |
931 | } | |
932 | ||
933 | int | |
104c1213 | 934 | gdbarch_byte_order (struct gdbarch *gdbarch) |
0f71a2f6 JM |
935 | { |
936 | if (gdbarch_debug >= 2) | |
937 | /* FIXME: gdb_std??? */ | |
938 | fprintf_unfiltered (gdb_stdlog, "gdbarch_byte_order called\n"); | |
939 | return gdbarch->byte_order; | |
940 | } | |
941 | ||
942 | int | |
104c1213 | 943 | gdbarch_ptr_bit (struct gdbarch *gdbarch) |
0f71a2f6 JM |
944 | { |
945 | if (gdbarch->ptr_bit == 0) | |
96baa820 | 946 | internal_error ("gdbarch: gdbarch_ptr_bit invalid"); |
0f71a2f6 JM |
947 | if (gdbarch_debug >= 2) |
948 | /* FIXME: gdb_std??? */ | |
949 | fprintf_unfiltered (gdb_stdlog, "gdbarch_ptr_bit called\n"); | |
950 | return gdbarch->ptr_bit; | |
951 | } | |
952 | ||
953 | void | |
104c1213 JM |
954 | set_gdbarch_ptr_bit (struct gdbarch *gdbarch, |
955 | int ptr_bit) | |
0f71a2f6 JM |
956 | { |
957 | gdbarch->ptr_bit = ptr_bit; | |
958 | } | |
959 | ||
960 | int | |
104c1213 | 961 | gdbarch_short_bit (struct gdbarch *gdbarch) |
0f71a2f6 JM |
962 | { |
963 | if (gdbarch->short_bit == 0) | |
96baa820 | 964 | internal_error ("gdbarch: gdbarch_short_bit invalid"); |
0f71a2f6 JM |
965 | if (gdbarch_debug >= 2) |
966 | /* FIXME: gdb_std??? */ | |
967 | fprintf_unfiltered (gdb_stdlog, "gdbarch_short_bit called\n"); | |
968 | return gdbarch->short_bit; | |
969 | } | |
970 | ||
971 | void | |
104c1213 JM |
972 | set_gdbarch_short_bit (struct gdbarch *gdbarch, |
973 | int short_bit) | |
0f71a2f6 JM |
974 | { |
975 | gdbarch->short_bit = short_bit; | |
976 | } | |
977 | ||
978 | int | |
104c1213 | 979 | gdbarch_int_bit (struct gdbarch *gdbarch) |
0f71a2f6 JM |
980 | { |
981 | if (gdbarch->int_bit == 0) | |
96baa820 | 982 | internal_error ("gdbarch: gdbarch_int_bit invalid"); |
0f71a2f6 JM |
983 | if (gdbarch_debug >= 2) |
984 | /* FIXME: gdb_std??? */ | |
985 | fprintf_unfiltered (gdb_stdlog, "gdbarch_int_bit called\n"); | |
986 | return gdbarch->int_bit; | |
987 | } | |
988 | ||
989 | void | |
104c1213 JM |
990 | set_gdbarch_int_bit (struct gdbarch *gdbarch, |
991 | int int_bit) | |
0f71a2f6 JM |
992 | { |
993 | gdbarch->int_bit = int_bit; | |
994 | } | |
995 | ||
996 | int | |
104c1213 | 997 | gdbarch_long_bit (struct gdbarch *gdbarch) |
0f71a2f6 JM |
998 | { |
999 | if (gdbarch->long_bit == 0) | |
96baa820 | 1000 | internal_error ("gdbarch: gdbarch_long_bit invalid"); |
0f71a2f6 JM |
1001 | if (gdbarch_debug >= 2) |
1002 | /* FIXME: gdb_std??? */ | |
1003 | fprintf_unfiltered (gdb_stdlog, "gdbarch_long_bit called\n"); | |
1004 | return gdbarch->long_bit; | |
1005 | } | |
1006 | ||
1007 | void | |
104c1213 JM |
1008 | set_gdbarch_long_bit (struct gdbarch *gdbarch, |
1009 | int long_bit) | |
0f71a2f6 JM |
1010 | { |
1011 | gdbarch->long_bit = long_bit; | |
1012 | } | |
1013 | ||
1014 | int | |
104c1213 | 1015 | gdbarch_long_long_bit (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1016 | { |
1017 | if (gdbarch->long_long_bit == 0) | |
96baa820 | 1018 | internal_error ("gdbarch: gdbarch_long_long_bit invalid"); |
0f71a2f6 JM |
1019 | if (gdbarch_debug >= 2) |
1020 | /* FIXME: gdb_std??? */ | |
1021 | fprintf_unfiltered (gdb_stdlog, "gdbarch_long_long_bit called\n"); | |
1022 | return gdbarch->long_long_bit; | |
1023 | } | |
1024 | ||
1025 | void | |
104c1213 JM |
1026 | set_gdbarch_long_long_bit (struct gdbarch *gdbarch, |
1027 | int long_long_bit) | |
0f71a2f6 JM |
1028 | { |
1029 | gdbarch->long_long_bit = long_long_bit; | |
1030 | } | |
1031 | ||
1032 | int | |
104c1213 | 1033 | gdbarch_float_bit (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1034 | { |
1035 | if (gdbarch->float_bit == 0) | |
96baa820 | 1036 | internal_error ("gdbarch: gdbarch_float_bit invalid"); |
0f71a2f6 JM |
1037 | if (gdbarch_debug >= 2) |
1038 | /* FIXME: gdb_std??? */ | |
1039 | fprintf_unfiltered (gdb_stdlog, "gdbarch_float_bit called\n"); | |
1040 | return gdbarch->float_bit; | |
1041 | } | |
1042 | ||
1043 | void | |
104c1213 JM |
1044 | set_gdbarch_float_bit (struct gdbarch *gdbarch, |
1045 | int float_bit) | |
0f71a2f6 JM |
1046 | { |
1047 | gdbarch->float_bit = float_bit; | |
1048 | } | |
1049 | ||
1050 | int | |
104c1213 | 1051 | gdbarch_double_bit (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1052 | { |
1053 | if (gdbarch->double_bit == 0) | |
96baa820 | 1054 | internal_error ("gdbarch: gdbarch_double_bit invalid"); |
0f71a2f6 JM |
1055 | if (gdbarch_debug >= 2) |
1056 | /* FIXME: gdb_std??? */ | |
1057 | fprintf_unfiltered (gdb_stdlog, "gdbarch_double_bit called\n"); | |
1058 | return gdbarch->double_bit; | |
1059 | } | |
1060 | ||
1061 | void | |
104c1213 JM |
1062 | set_gdbarch_double_bit (struct gdbarch *gdbarch, |
1063 | int double_bit) | |
0f71a2f6 JM |
1064 | { |
1065 | gdbarch->double_bit = double_bit; | |
1066 | } | |
1067 | ||
1068 | int | |
104c1213 | 1069 | gdbarch_long_double_bit (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1070 | { |
1071 | if (gdbarch->long_double_bit == 0) | |
96baa820 | 1072 | internal_error ("gdbarch: gdbarch_long_double_bit invalid"); |
0f71a2f6 JM |
1073 | if (gdbarch_debug >= 2) |
1074 | /* FIXME: gdb_std??? */ | |
1075 | fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_bit called\n"); | |
1076 | return gdbarch->long_double_bit; | |
1077 | } | |
1078 | ||
1079 | void | |
104c1213 JM |
1080 | set_gdbarch_long_double_bit (struct gdbarch *gdbarch, |
1081 | int long_double_bit) | |
0f71a2f6 JM |
1082 | { |
1083 | gdbarch->long_double_bit = long_double_bit; | |
1084 | } | |
1085 | ||
1086 | CORE_ADDR | |
1087 | gdbarch_read_pc (struct gdbarch *gdbarch, int pid) | |
1088 | { | |
1089 | if (gdbarch->read_pc == 0) | |
96baa820 | 1090 | internal_error ("gdbarch: gdbarch_read_pc invalid"); |
0f71a2f6 JM |
1091 | if (gdbarch_debug >= 2) |
1092 | /* FIXME: gdb_std??? */ | |
1093 | fprintf_unfiltered (gdb_stdlog, "gdbarch_read_pc called\n"); | |
1094 | return gdbarch->read_pc (pid); | |
1095 | } | |
1096 | ||
1097 | void | |
104c1213 JM |
1098 | set_gdbarch_read_pc (struct gdbarch *gdbarch, |
1099 | gdbarch_read_pc_ftype read_pc) | |
0f71a2f6 JM |
1100 | { |
1101 | gdbarch->read_pc = read_pc; | |
1102 | } | |
1103 | ||
1104 | void | |
1105 | gdbarch_write_pc (struct gdbarch *gdbarch, CORE_ADDR val, int pid) | |
1106 | { | |
1107 | if (gdbarch->write_pc == 0) | |
96baa820 | 1108 | internal_error ("gdbarch: gdbarch_write_pc invalid"); |
0f71a2f6 JM |
1109 | if (gdbarch_debug >= 2) |
1110 | /* FIXME: gdb_std??? */ | |
1111 | fprintf_unfiltered (gdb_stdlog, "gdbarch_write_pc called\n"); | |
1112 | gdbarch->write_pc (val, pid); | |
1113 | } | |
1114 | ||
1115 | void | |
104c1213 JM |
1116 | set_gdbarch_write_pc (struct gdbarch *gdbarch, |
1117 | gdbarch_write_pc_ftype write_pc) | |
0f71a2f6 JM |
1118 | { |
1119 | gdbarch->write_pc = write_pc; | |
1120 | } | |
1121 | ||
1122 | CORE_ADDR | |
1123 | gdbarch_read_fp (struct gdbarch *gdbarch) | |
1124 | { | |
1125 | if (gdbarch->read_fp == 0) | |
96baa820 | 1126 | internal_error ("gdbarch: gdbarch_read_fp invalid"); |
0f71a2f6 JM |
1127 | if (gdbarch_debug >= 2) |
1128 | /* FIXME: gdb_std??? */ | |
1129 | fprintf_unfiltered (gdb_stdlog, "gdbarch_read_fp called\n"); | |
1130 | return gdbarch->read_fp (); | |
1131 | } | |
1132 | ||
1133 | void | |
104c1213 JM |
1134 | set_gdbarch_read_fp (struct gdbarch *gdbarch, |
1135 | gdbarch_read_fp_ftype read_fp) | |
0f71a2f6 JM |
1136 | { |
1137 | gdbarch->read_fp = read_fp; | |
1138 | } | |
1139 | ||
1140 | void | |
1141 | gdbarch_write_fp (struct gdbarch *gdbarch, CORE_ADDR val) | |
1142 | { | |
1143 | if (gdbarch->write_fp == 0) | |
96baa820 | 1144 | internal_error ("gdbarch: gdbarch_write_fp invalid"); |
0f71a2f6 JM |
1145 | if (gdbarch_debug >= 2) |
1146 | /* FIXME: gdb_std??? */ | |
1147 | fprintf_unfiltered (gdb_stdlog, "gdbarch_write_fp called\n"); | |
1148 | gdbarch->write_fp (val); | |
1149 | } | |
1150 | ||
1151 | void | |
104c1213 JM |
1152 | set_gdbarch_write_fp (struct gdbarch *gdbarch, |
1153 | gdbarch_write_fp_ftype write_fp) | |
0f71a2f6 JM |
1154 | { |
1155 | gdbarch->write_fp = write_fp; | |
1156 | } | |
1157 | ||
1158 | CORE_ADDR | |
1159 | gdbarch_read_sp (struct gdbarch *gdbarch) | |
1160 | { | |
1161 | if (gdbarch->read_sp == 0) | |
96baa820 | 1162 | internal_error ("gdbarch: gdbarch_read_sp invalid"); |
0f71a2f6 JM |
1163 | if (gdbarch_debug >= 2) |
1164 | /* FIXME: gdb_std??? */ | |
1165 | fprintf_unfiltered (gdb_stdlog, "gdbarch_read_sp called\n"); | |
1166 | return gdbarch->read_sp (); | |
1167 | } | |
1168 | ||
1169 | void | |
104c1213 JM |
1170 | set_gdbarch_read_sp (struct gdbarch *gdbarch, |
1171 | gdbarch_read_sp_ftype read_sp) | |
0f71a2f6 JM |
1172 | { |
1173 | gdbarch->read_sp = read_sp; | |
1174 | } | |
1175 | ||
1176 | void | |
1177 | gdbarch_write_sp (struct gdbarch *gdbarch, CORE_ADDR val) | |
1178 | { | |
1179 | if (gdbarch->write_sp == 0) | |
96baa820 | 1180 | internal_error ("gdbarch: gdbarch_write_sp invalid"); |
0f71a2f6 JM |
1181 | if (gdbarch_debug >= 2) |
1182 | /* FIXME: gdb_std??? */ | |
1183 | fprintf_unfiltered (gdb_stdlog, "gdbarch_write_sp called\n"); | |
1184 | gdbarch->write_sp (val); | |
1185 | } | |
1186 | ||
1187 | void | |
104c1213 JM |
1188 | set_gdbarch_write_sp (struct gdbarch *gdbarch, |
1189 | gdbarch_write_sp_ftype write_sp) | |
0f71a2f6 JM |
1190 | { |
1191 | gdbarch->write_sp = write_sp; | |
1192 | } | |
1193 | ||
1194 | int | |
104c1213 | 1195 | gdbarch_num_regs (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1196 | { |
1197 | if (gdbarch->num_regs == -1) | |
96baa820 | 1198 | internal_error ("gdbarch: gdbarch_num_regs invalid"); |
0f71a2f6 JM |
1199 | if (gdbarch_debug >= 2) |
1200 | /* FIXME: gdb_std??? */ | |
1201 | fprintf_unfiltered (gdb_stdlog, "gdbarch_num_regs called\n"); | |
1202 | return gdbarch->num_regs; | |
1203 | } | |
1204 | ||
1205 | void | |
104c1213 JM |
1206 | set_gdbarch_num_regs (struct gdbarch *gdbarch, |
1207 | int num_regs) | |
0f71a2f6 JM |
1208 | { |
1209 | gdbarch->num_regs = num_regs; | |
1210 | } | |
1211 | ||
1212 | int | |
104c1213 | 1213 | gdbarch_sp_regnum (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1214 | { |
1215 | if (gdbarch->sp_regnum == -1) | |
96baa820 | 1216 | internal_error ("gdbarch: gdbarch_sp_regnum invalid"); |
0f71a2f6 JM |
1217 | if (gdbarch_debug >= 2) |
1218 | /* FIXME: gdb_std??? */ | |
1219 | fprintf_unfiltered (gdb_stdlog, "gdbarch_sp_regnum called\n"); | |
1220 | return gdbarch->sp_regnum; | |
1221 | } | |
1222 | ||
1223 | void | |
104c1213 JM |
1224 | set_gdbarch_sp_regnum (struct gdbarch *gdbarch, |
1225 | int sp_regnum) | |
0f71a2f6 JM |
1226 | { |
1227 | gdbarch->sp_regnum = sp_regnum; | |
1228 | } | |
1229 | ||
1230 | int | |
104c1213 | 1231 | gdbarch_fp_regnum (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1232 | { |
1233 | if (gdbarch->fp_regnum == -1) | |
96baa820 | 1234 | internal_error ("gdbarch: gdbarch_fp_regnum invalid"); |
0f71a2f6 JM |
1235 | if (gdbarch_debug >= 2) |
1236 | /* FIXME: gdb_std??? */ | |
1237 | fprintf_unfiltered (gdb_stdlog, "gdbarch_fp_regnum called\n"); | |
1238 | return gdbarch->fp_regnum; | |
1239 | } | |
1240 | ||
1241 | void | |
104c1213 JM |
1242 | set_gdbarch_fp_regnum (struct gdbarch *gdbarch, |
1243 | int fp_regnum) | |
0f71a2f6 JM |
1244 | { |
1245 | gdbarch->fp_regnum = fp_regnum; | |
1246 | } | |
1247 | ||
1248 | int | |
104c1213 | 1249 | gdbarch_pc_regnum (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1250 | { |
1251 | if (gdbarch->pc_regnum == -1) | |
96baa820 | 1252 | internal_error ("gdbarch: gdbarch_pc_regnum invalid"); |
0f71a2f6 JM |
1253 | if (gdbarch_debug >= 2) |
1254 | /* FIXME: gdb_std??? */ | |
1255 | fprintf_unfiltered (gdb_stdlog, "gdbarch_pc_regnum called\n"); | |
1256 | return gdbarch->pc_regnum; | |
1257 | } | |
1258 | ||
1259 | void | |
104c1213 JM |
1260 | set_gdbarch_pc_regnum (struct gdbarch *gdbarch, |
1261 | int pc_regnum) | |
0f71a2f6 JM |
1262 | { |
1263 | gdbarch->pc_regnum = pc_regnum; | |
1264 | } | |
1265 | ||
1266 | char * | |
1267 | gdbarch_register_name (struct gdbarch *gdbarch, int regnr) | |
1268 | { | |
7be570e7 | 1269 | if (gdbarch->register_name == 0) |
96baa820 | 1270 | internal_error ("gdbarch: gdbarch_register_name invalid"); |
0f71a2f6 JM |
1271 | if (gdbarch_debug >= 2) |
1272 | /* FIXME: gdb_std??? */ | |
1273 | fprintf_unfiltered (gdb_stdlog, "gdbarch_register_name called\n"); | |
1274 | return gdbarch->register_name (regnr); | |
1275 | } | |
1276 | ||
1277 | void | |
104c1213 JM |
1278 | set_gdbarch_register_name (struct gdbarch *gdbarch, |
1279 | gdbarch_register_name_ftype register_name) | |
0f71a2f6 JM |
1280 | { |
1281 | gdbarch->register_name = register_name; | |
1282 | } | |
1283 | ||
1284 | int | |
104c1213 | 1285 | gdbarch_register_size (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1286 | { |
1287 | if (gdbarch->register_size == -1) | |
96baa820 | 1288 | internal_error ("gdbarch: gdbarch_register_size invalid"); |
0f71a2f6 JM |
1289 | if (gdbarch_debug >= 2) |
1290 | /* FIXME: gdb_std??? */ | |
1291 | fprintf_unfiltered (gdb_stdlog, "gdbarch_register_size called\n"); | |
1292 | return gdbarch->register_size; | |
1293 | } | |
1294 | ||
1295 | void | |
104c1213 JM |
1296 | set_gdbarch_register_size (struct gdbarch *gdbarch, |
1297 | int register_size) | |
0f71a2f6 JM |
1298 | { |
1299 | gdbarch->register_size = register_size; | |
1300 | } | |
1301 | ||
1302 | int | |
104c1213 | 1303 | gdbarch_register_bytes (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1304 | { |
1305 | if (gdbarch->register_bytes == -1) | |
96baa820 | 1306 | internal_error ("gdbarch: gdbarch_register_bytes invalid"); |
0f71a2f6 JM |
1307 | if (gdbarch_debug >= 2) |
1308 | /* FIXME: gdb_std??? */ | |
1309 | fprintf_unfiltered (gdb_stdlog, "gdbarch_register_bytes called\n"); | |
1310 | return gdbarch->register_bytes; | |
1311 | } | |
1312 | ||
1313 | void | |
104c1213 JM |
1314 | set_gdbarch_register_bytes (struct gdbarch *gdbarch, |
1315 | int register_bytes) | |
0f71a2f6 JM |
1316 | { |
1317 | gdbarch->register_bytes = register_bytes; | |
1318 | } | |
1319 | ||
1320 | int | |
1321 | gdbarch_register_byte (struct gdbarch *gdbarch, int reg_nr) | |
1322 | { | |
1323 | if (gdbarch->register_byte == 0) | |
96baa820 | 1324 | internal_error ("gdbarch: gdbarch_register_byte invalid"); |
0f71a2f6 JM |
1325 | if (gdbarch_debug >= 2) |
1326 | /* FIXME: gdb_std??? */ | |
1327 | fprintf_unfiltered (gdb_stdlog, "gdbarch_register_byte called\n"); | |
1328 | return gdbarch->register_byte (reg_nr); | |
1329 | } | |
1330 | ||
1331 | void | |
104c1213 JM |
1332 | set_gdbarch_register_byte (struct gdbarch *gdbarch, |
1333 | gdbarch_register_byte_ftype register_byte) | |
0f71a2f6 JM |
1334 | { |
1335 | gdbarch->register_byte = register_byte; | |
1336 | } | |
1337 | ||
1338 | int | |
1339 | gdbarch_register_raw_size (struct gdbarch *gdbarch, int reg_nr) | |
1340 | { | |
1341 | if (gdbarch->register_raw_size == 0) | |
96baa820 | 1342 | internal_error ("gdbarch: gdbarch_register_raw_size invalid"); |
0f71a2f6 JM |
1343 | if (gdbarch_debug >= 2) |
1344 | /* FIXME: gdb_std??? */ | |
1345 | fprintf_unfiltered (gdb_stdlog, "gdbarch_register_raw_size called\n"); | |
1346 | return gdbarch->register_raw_size (reg_nr); | |
1347 | } | |
1348 | ||
1349 | void | |
104c1213 JM |
1350 | set_gdbarch_register_raw_size (struct gdbarch *gdbarch, |
1351 | gdbarch_register_raw_size_ftype register_raw_size) | |
0f71a2f6 JM |
1352 | { |
1353 | gdbarch->register_raw_size = register_raw_size; | |
1354 | } | |
1355 | ||
1356 | int | |
104c1213 | 1357 | gdbarch_max_register_raw_size (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1358 | { |
1359 | if (gdbarch->max_register_raw_size == -1) | |
96baa820 | 1360 | internal_error ("gdbarch: gdbarch_max_register_raw_size invalid"); |
0f71a2f6 JM |
1361 | if (gdbarch_debug >= 2) |
1362 | /* FIXME: gdb_std??? */ | |
1363 | fprintf_unfiltered (gdb_stdlog, "gdbarch_max_register_raw_size called\n"); | |
1364 | return gdbarch->max_register_raw_size; | |
1365 | } | |
1366 | ||
1367 | void | |
104c1213 JM |
1368 | set_gdbarch_max_register_raw_size (struct gdbarch *gdbarch, |
1369 | int max_register_raw_size) | |
0f71a2f6 JM |
1370 | { |
1371 | gdbarch->max_register_raw_size = max_register_raw_size; | |
1372 | } | |
1373 | ||
1374 | int | |
1375 | gdbarch_register_virtual_size (struct gdbarch *gdbarch, int reg_nr) | |
1376 | { | |
1377 | if (gdbarch->register_virtual_size == 0) | |
96baa820 | 1378 | internal_error ("gdbarch: gdbarch_register_virtual_size invalid"); |
0f71a2f6 JM |
1379 | if (gdbarch_debug >= 2) |
1380 | /* FIXME: gdb_std??? */ | |
1381 | fprintf_unfiltered (gdb_stdlog, "gdbarch_register_virtual_size called\n"); | |
1382 | return gdbarch->register_virtual_size (reg_nr); | |
1383 | } | |
1384 | ||
1385 | void | |
104c1213 JM |
1386 | set_gdbarch_register_virtual_size (struct gdbarch *gdbarch, |
1387 | gdbarch_register_virtual_size_ftype register_virtual_size) | |
0f71a2f6 JM |
1388 | { |
1389 | gdbarch->register_virtual_size = register_virtual_size; | |
1390 | } | |
1391 | ||
1392 | int | |
104c1213 | 1393 | gdbarch_max_register_virtual_size (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1394 | { |
1395 | if (gdbarch->max_register_virtual_size == -1) | |
96baa820 | 1396 | internal_error ("gdbarch: gdbarch_max_register_virtual_size invalid"); |
0f71a2f6 JM |
1397 | if (gdbarch_debug >= 2) |
1398 | /* FIXME: gdb_std??? */ | |
1399 | fprintf_unfiltered (gdb_stdlog, "gdbarch_max_register_virtual_size called\n"); | |
1400 | return gdbarch->max_register_virtual_size; | |
1401 | } | |
1402 | ||
1403 | void | |
104c1213 JM |
1404 | set_gdbarch_max_register_virtual_size (struct gdbarch *gdbarch, |
1405 | int max_register_virtual_size) | |
0f71a2f6 JM |
1406 | { |
1407 | gdbarch->max_register_virtual_size = max_register_virtual_size; | |
1408 | } | |
1409 | ||
1410 | struct type * | |
1411 | gdbarch_register_virtual_type (struct gdbarch *gdbarch, int reg_nr) | |
1412 | { | |
1413 | if (gdbarch->register_virtual_type == 0) | |
96baa820 | 1414 | internal_error ("gdbarch: gdbarch_register_virtual_type invalid"); |
0f71a2f6 JM |
1415 | if (gdbarch_debug >= 2) |
1416 | /* FIXME: gdb_std??? */ | |
1417 | fprintf_unfiltered (gdb_stdlog, "gdbarch_register_virtual_type called\n"); | |
1418 | return gdbarch->register_virtual_type (reg_nr); | |
1419 | } | |
1420 | ||
1421 | void | |
104c1213 JM |
1422 | set_gdbarch_register_virtual_type (struct gdbarch *gdbarch, |
1423 | gdbarch_register_virtual_type_ftype register_virtual_type) | |
0f71a2f6 JM |
1424 | { |
1425 | gdbarch->register_virtual_type = register_virtual_type; | |
1426 | } | |
1427 | ||
1428 | int | |
104c1213 | 1429 | gdbarch_use_generic_dummy_frames (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1430 | { |
1431 | if (gdbarch->use_generic_dummy_frames == -1) | |
96baa820 | 1432 | internal_error ("gdbarch: gdbarch_use_generic_dummy_frames invalid"); |
0f71a2f6 JM |
1433 | if (gdbarch_debug >= 2) |
1434 | /* FIXME: gdb_std??? */ | |
1435 | fprintf_unfiltered (gdb_stdlog, "gdbarch_use_generic_dummy_frames called\n"); | |
1436 | return gdbarch->use_generic_dummy_frames; | |
1437 | } | |
1438 | ||
1439 | void | |
104c1213 JM |
1440 | set_gdbarch_use_generic_dummy_frames (struct gdbarch *gdbarch, |
1441 | int use_generic_dummy_frames) | |
0f71a2f6 JM |
1442 | { |
1443 | gdbarch->use_generic_dummy_frames = use_generic_dummy_frames; | |
1444 | } | |
1445 | ||
1446 | int | |
104c1213 | 1447 | gdbarch_call_dummy_location (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1448 | { |
1449 | if (gdbarch->call_dummy_location == 0) | |
96baa820 | 1450 | internal_error ("gdbarch: gdbarch_call_dummy_location invalid"); |
0f71a2f6 JM |
1451 | if (gdbarch_debug >= 2) |
1452 | /* FIXME: gdb_std??? */ | |
1453 | fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_location called\n"); | |
1454 | return gdbarch->call_dummy_location; | |
1455 | } | |
1456 | ||
1457 | void | |
104c1213 JM |
1458 | set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, |
1459 | int call_dummy_location) | |
0f71a2f6 JM |
1460 | { |
1461 | gdbarch->call_dummy_location = call_dummy_location; | |
1462 | } | |
1463 | ||
1464 | CORE_ADDR | |
1465 | gdbarch_call_dummy_address (struct gdbarch *gdbarch) | |
1466 | { | |
1467 | if (gdbarch->call_dummy_address == 0) | |
96baa820 | 1468 | internal_error ("gdbarch: gdbarch_call_dummy_address invalid"); |
0f71a2f6 JM |
1469 | if (gdbarch_debug >= 2) |
1470 | /* FIXME: gdb_std??? */ | |
1471 | fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_address called\n"); | |
1472 | return gdbarch->call_dummy_address (); | |
1473 | } | |
1474 | ||
1475 | void | |
104c1213 JM |
1476 | set_gdbarch_call_dummy_address (struct gdbarch *gdbarch, |
1477 | gdbarch_call_dummy_address_ftype call_dummy_address) | |
0f71a2f6 JM |
1478 | { |
1479 | gdbarch->call_dummy_address = call_dummy_address; | |
1480 | } | |
1481 | ||
1482 | CORE_ADDR | |
104c1213 | 1483 | gdbarch_call_dummy_start_offset (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1484 | { |
1485 | if (gdbarch->call_dummy_start_offset == -1) | |
96baa820 | 1486 | internal_error ("gdbarch: gdbarch_call_dummy_start_offset invalid"); |
0f71a2f6 JM |
1487 | if (gdbarch_debug >= 2) |
1488 | /* FIXME: gdb_std??? */ | |
1489 | fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_start_offset called\n"); | |
1490 | return gdbarch->call_dummy_start_offset; | |
1491 | } | |
1492 | ||
1493 | void | |
104c1213 JM |
1494 | set_gdbarch_call_dummy_start_offset (struct gdbarch *gdbarch, |
1495 | CORE_ADDR call_dummy_start_offset) | |
0f71a2f6 JM |
1496 | { |
1497 | gdbarch->call_dummy_start_offset = call_dummy_start_offset; | |
1498 | } | |
1499 | ||
1500 | CORE_ADDR | |
104c1213 | 1501 | gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1502 | { |
1503 | if (gdbarch->call_dummy_breakpoint_offset == -1) | |
96baa820 | 1504 | internal_error ("gdbarch: gdbarch_call_dummy_breakpoint_offset invalid"); |
0f71a2f6 JM |
1505 | if (gdbarch_debug >= 2) |
1506 | /* FIXME: gdb_std??? */ | |
1507 | fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_breakpoint_offset called\n"); | |
1508 | return gdbarch->call_dummy_breakpoint_offset; | |
1509 | } | |
1510 | ||
1511 | void | |
104c1213 JM |
1512 | set_gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch, |
1513 | CORE_ADDR call_dummy_breakpoint_offset) | |
0f71a2f6 JM |
1514 | { |
1515 | gdbarch->call_dummy_breakpoint_offset = call_dummy_breakpoint_offset; | |
1516 | } | |
1517 | ||
1518 | int | |
104c1213 | 1519 | gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1520 | { |
1521 | if (gdbarch->call_dummy_breakpoint_offset_p == -1) | |
96baa820 | 1522 | internal_error ("gdbarch: gdbarch_call_dummy_breakpoint_offset_p invalid"); |
0f71a2f6 JM |
1523 | if (gdbarch_debug >= 2) |
1524 | /* FIXME: gdb_std??? */ | |
1525 | fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_breakpoint_offset_p called\n"); | |
1526 | return gdbarch->call_dummy_breakpoint_offset_p; | |
1527 | } | |
1528 | ||
1529 | void | |
104c1213 JM |
1530 | set_gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch, |
1531 | int call_dummy_breakpoint_offset_p) | |
0f71a2f6 JM |
1532 | { |
1533 | gdbarch->call_dummy_breakpoint_offset_p = call_dummy_breakpoint_offset_p; | |
1534 | } | |
1535 | ||
1536 | int | |
104c1213 | 1537 | gdbarch_call_dummy_length (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1538 | { |
1539 | if (gdbarch->call_dummy_length == -1) | |
96baa820 | 1540 | internal_error ("gdbarch: gdbarch_call_dummy_length invalid"); |
0f71a2f6 JM |
1541 | if (gdbarch_debug >= 2) |
1542 | /* FIXME: gdb_std??? */ | |
1543 | fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_length called\n"); | |
1544 | return gdbarch->call_dummy_length; | |
1545 | } | |
1546 | ||
1547 | void | |
104c1213 JM |
1548 | set_gdbarch_call_dummy_length (struct gdbarch *gdbarch, |
1549 | int call_dummy_length) | |
0f71a2f6 JM |
1550 | { |
1551 | gdbarch->call_dummy_length = call_dummy_length; | |
1552 | } | |
1553 | ||
1554 | int | |
1555 | gdbarch_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address) | |
1556 | { | |
1557 | if (gdbarch->pc_in_call_dummy == 0) | |
96baa820 | 1558 | internal_error ("gdbarch: gdbarch_pc_in_call_dummy invalid"); |
0f71a2f6 JM |
1559 | if (gdbarch_debug >= 2) |
1560 | /* FIXME: gdb_std??? */ | |
1561 | fprintf_unfiltered (gdb_stdlog, "gdbarch_pc_in_call_dummy called\n"); | |
1562 | return gdbarch->pc_in_call_dummy (pc, sp, frame_address); | |
1563 | } | |
1564 | ||
1565 | void | |
104c1213 JM |
1566 | set_gdbarch_pc_in_call_dummy (struct gdbarch *gdbarch, |
1567 | gdbarch_pc_in_call_dummy_ftype pc_in_call_dummy) | |
0f71a2f6 JM |
1568 | { |
1569 | gdbarch->pc_in_call_dummy = pc_in_call_dummy; | |
1570 | } | |
1571 | ||
1572 | int | |
104c1213 | 1573 | gdbarch_call_dummy_p (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1574 | { |
1575 | if (gdbarch->call_dummy_p == -1) | |
96baa820 | 1576 | internal_error ("gdbarch: gdbarch_call_dummy_p invalid"); |
0f71a2f6 JM |
1577 | if (gdbarch_debug >= 2) |
1578 | /* FIXME: gdb_std??? */ | |
1579 | fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_p called\n"); | |
1580 | return gdbarch->call_dummy_p; | |
1581 | } | |
1582 | ||
1583 | void | |
104c1213 JM |
1584 | set_gdbarch_call_dummy_p (struct gdbarch *gdbarch, |
1585 | int call_dummy_p) | |
0f71a2f6 JM |
1586 | { |
1587 | gdbarch->call_dummy_p = call_dummy_p; | |
1588 | } | |
1589 | ||
1590 | LONGEST * | |
104c1213 | 1591 | gdbarch_call_dummy_words (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1592 | { |
1593 | if (gdbarch_debug >= 2) | |
1594 | /* FIXME: gdb_std??? */ | |
1595 | fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_words called\n"); | |
1596 | return gdbarch->call_dummy_words; | |
1597 | } | |
1598 | ||
1599 | void | |
104c1213 JM |
1600 | set_gdbarch_call_dummy_words (struct gdbarch *gdbarch, |
1601 | LONGEST * call_dummy_words) | |
0f71a2f6 JM |
1602 | { |
1603 | gdbarch->call_dummy_words = call_dummy_words; | |
1604 | } | |
1605 | ||
1606 | int | |
104c1213 | 1607 | gdbarch_sizeof_call_dummy_words (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1608 | { |
1609 | if (gdbarch_debug >= 2) | |
1610 | /* FIXME: gdb_std??? */ | |
1611 | fprintf_unfiltered (gdb_stdlog, "gdbarch_sizeof_call_dummy_words called\n"); | |
1612 | return gdbarch->sizeof_call_dummy_words; | |
1613 | } | |
1614 | ||
1615 | void | |
104c1213 JM |
1616 | set_gdbarch_sizeof_call_dummy_words (struct gdbarch *gdbarch, |
1617 | int sizeof_call_dummy_words) | |
0f71a2f6 JM |
1618 | { |
1619 | gdbarch->sizeof_call_dummy_words = sizeof_call_dummy_words; | |
1620 | } | |
1621 | ||
1622 | int | |
104c1213 | 1623 | gdbarch_call_dummy_stack_adjust_p (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1624 | { |
1625 | if (gdbarch->call_dummy_stack_adjust_p == -1) | |
96baa820 | 1626 | internal_error ("gdbarch: gdbarch_call_dummy_stack_adjust_p invalid"); |
0f71a2f6 JM |
1627 | if (gdbarch_debug >= 2) |
1628 | /* FIXME: gdb_std??? */ | |
1629 | fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_stack_adjust_p called\n"); | |
1630 | return gdbarch->call_dummy_stack_adjust_p; | |
1631 | } | |
1632 | ||
1633 | void | |
104c1213 JM |
1634 | set_gdbarch_call_dummy_stack_adjust_p (struct gdbarch *gdbarch, |
1635 | int call_dummy_stack_adjust_p) | |
0f71a2f6 JM |
1636 | { |
1637 | gdbarch->call_dummy_stack_adjust_p = call_dummy_stack_adjust_p; | |
1638 | } | |
1639 | ||
1640 | int | |
104c1213 | 1641 | gdbarch_call_dummy_stack_adjust (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1642 | { |
1643 | if (gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0) | |
96baa820 | 1644 | internal_error ("gdbarch: gdbarch_call_dummy_stack_adjust invalid"); |
0f71a2f6 JM |
1645 | if (gdbarch_debug >= 2) |
1646 | /* FIXME: gdb_std??? */ | |
1647 | fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_stack_adjust called\n"); | |
1648 | return gdbarch->call_dummy_stack_adjust; | |
1649 | } | |
1650 | ||
1651 | void | |
104c1213 JM |
1652 | set_gdbarch_call_dummy_stack_adjust (struct gdbarch *gdbarch, |
1653 | int call_dummy_stack_adjust) | |
0f71a2f6 JM |
1654 | { |
1655 | gdbarch->call_dummy_stack_adjust = call_dummy_stack_adjust; | |
1656 | } | |
1657 | ||
1658 | void | |
1659 | gdbarch_fix_call_dummy (struct gdbarch *gdbarch, char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p) | |
1660 | { | |
1661 | if (gdbarch->fix_call_dummy == 0) | |
96baa820 | 1662 | internal_error ("gdbarch: gdbarch_fix_call_dummy invalid"); |
0f71a2f6 JM |
1663 | if (gdbarch_debug >= 2) |
1664 | /* FIXME: gdb_std??? */ | |
1665 | fprintf_unfiltered (gdb_stdlog, "gdbarch_fix_call_dummy called\n"); | |
1666 | gdbarch->fix_call_dummy (dummy, pc, fun, nargs, args, type, gcc_p); | |
1667 | } | |
1668 | ||
1669 | void | |
104c1213 JM |
1670 | set_gdbarch_fix_call_dummy (struct gdbarch *gdbarch, |
1671 | gdbarch_fix_call_dummy_ftype fix_call_dummy) | |
0f71a2f6 JM |
1672 | { |
1673 | gdbarch->fix_call_dummy = fix_call_dummy; | |
1674 | } | |
1675 | ||
1676 | int | |
104c1213 | 1677 | gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1678 | { |
1679 | if (gdbarch_debug >= 2) | |
1680 | /* FIXME: gdb_std??? */ | |
1681 | fprintf_unfiltered (gdb_stdlog, "gdbarch_believe_pcc_promotion called\n"); | |
1682 | return gdbarch->believe_pcc_promotion; | |
1683 | } | |
1684 | ||
1685 | void | |
104c1213 JM |
1686 | set_gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch, |
1687 | int believe_pcc_promotion) | |
0f71a2f6 JM |
1688 | { |
1689 | gdbarch->believe_pcc_promotion = believe_pcc_promotion; | |
1690 | } | |
1691 | ||
1692 | int | |
104c1213 | 1693 | gdbarch_believe_pcc_promotion_type (struct gdbarch *gdbarch) |
0f71a2f6 JM |
1694 | { |
1695 | if (gdbarch_debug >= 2) | |
1696 | /* FIXME: gdb_std??? */ | |
1697 | fprintf_unfiltered (gdb_stdlog, "gdbarch_believe_pcc_promotion_type called\n"); | |
1698 | return gdbarch->believe_pcc_promotion_type; | |
1699 | } | |
1700 | ||
1701 | void | |
104c1213 JM |
1702 | set_gdbarch_believe_pcc_promotion_type (struct gdbarch *gdbarch, |
1703 | int believe_pcc_promotion_type) | |
0f71a2f6 JM |
1704 | { |
1705 | gdbarch->believe_pcc_promotion_type = believe_pcc_promotion_type; | |
1706 | } | |
1707 | ||
1708 | void | |
adf40b2e | 1709 | gdbarch_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval) |
0f71a2f6 JM |
1710 | { |
1711 | if (gdbarch->get_saved_register == 0) | |
96baa820 | 1712 | internal_error ("gdbarch: gdbarch_get_saved_register invalid"); |
0f71a2f6 JM |
1713 | if (gdbarch_debug >= 2) |
1714 | /* FIXME: gdb_std??? */ | |
1715 | fprintf_unfiltered (gdb_stdlog, "gdbarch_get_saved_register called\n"); | |
1716 | gdbarch->get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval); | |
1717 | } | |
1718 | ||
1719 | void | |
104c1213 JM |
1720 | set_gdbarch_get_saved_register (struct gdbarch *gdbarch, |
1721 | gdbarch_get_saved_register_ftype get_saved_register) | |
0f71a2f6 JM |
1722 | { |
1723 | gdbarch->get_saved_register = get_saved_register; | |
1724 | } | |
1725 | ||
1726 | int | |
1727 | gdbarch_register_convertible (struct gdbarch *gdbarch, int nr) | |
1728 | { | |
1729 | if (gdbarch->register_convertible == 0) | |
96baa820 | 1730 | internal_error ("gdbarch: gdbarch_register_convertible invalid"); |
0f71a2f6 JM |
1731 | if (gdbarch_debug >= 2) |
1732 | /* FIXME: gdb_std??? */ | |
1733 | fprintf_unfiltered (gdb_stdlog, "gdbarch_register_convertible called\n"); | |
1734 | return gdbarch->register_convertible (nr); | |
1735 | } | |
1736 | ||
1737 | void | |
104c1213 JM |
1738 | set_gdbarch_register_convertible (struct gdbarch *gdbarch, |
1739 | gdbarch_register_convertible_ftype register_convertible) | |
0f71a2f6 JM |
1740 | { |
1741 | gdbarch->register_convertible = register_convertible; | |
1742 | } | |
1743 | ||
1744 | void | |
1745 | gdbarch_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum, struct type *type, char *from, char *to) | |
1746 | { | |
1747 | if (gdbarch->register_convert_to_virtual == 0) | |
96baa820 | 1748 | internal_error ("gdbarch: gdbarch_register_convert_to_virtual invalid"); |
0f71a2f6 JM |
1749 | if (gdbarch_debug >= 2) |
1750 | /* FIXME: gdb_std??? */ | |
1751 | fprintf_unfiltered (gdb_stdlog, "gdbarch_register_convert_to_virtual called\n"); | |
1752 | gdbarch->register_convert_to_virtual (regnum, type, from, to); | |
1753 | } | |
1754 | ||
1755 | void | |
104c1213 JM |
1756 | set_gdbarch_register_convert_to_virtual (struct gdbarch *gdbarch, |
1757 | gdbarch_register_convert_to_virtual_ftype register_convert_to_virtual) | |
0f71a2f6 JM |
1758 | { |
1759 | gdbarch->register_convert_to_virtual = register_convert_to_virtual; | |
1760 | } | |
1761 | ||
1762 | void | |
1763 | gdbarch_register_convert_to_raw (struct gdbarch *gdbarch, struct type *type, int regnum, char *from, char *to) | |
1764 | { | |
1765 | if (gdbarch->register_convert_to_raw == 0) | |
96baa820 | 1766 | internal_error ("gdbarch: gdbarch_register_convert_to_raw invalid"); |
0f71a2f6 JM |
1767 | if (gdbarch_debug >= 2) |
1768 | /* FIXME: gdb_std??? */ | |
1769 | fprintf_unfiltered (gdb_stdlog, "gdbarch_register_convert_to_raw called\n"); | |
1770 | gdbarch->register_convert_to_raw (type, regnum, from, to); | |
1771 | } | |
1772 | ||
1773 | void | |
104c1213 JM |
1774 | set_gdbarch_register_convert_to_raw (struct gdbarch *gdbarch, |
1775 | gdbarch_register_convert_to_raw_ftype register_convert_to_raw) | |
0f71a2f6 JM |
1776 | { |
1777 | gdbarch->register_convert_to_raw = register_convert_to_raw; | |
1778 | } | |
1779 | ||
1780 | void | |
1781 | gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, char *regbuf, char *valbuf) | |
1782 | { | |
1783 | if (gdbarch->extract_return_value == 0) | |
96baa820 | 1784 | internal_error ("gdbarch: gdbarch_extract_return_value invalid"); |
0f71a2f6 JM |
1785 | if (gdbarch_debug >= 2) |
1786 | /* FIXME: gdb_std??? */ | |
1787 | fprintf_unfiltered (gdb_stdlog, "gdbarch_extract_return_value called\n"); | |
1788 | gdbarch->extract_return_value (type, regbuf, valbuf); | |
1789 | } | |
1790 | ||
1791 | void | |
104c1213 JM |
1792 | set_gdbarch_extract_return_value (struct gdbarch *gdbarch, |
1793 | gdbarch_extract_return_value_ftype extract_return_value) | |
0f71a2f6 JM |
1794 | { |
1795 | gdbarch->extract_return_value = extract_return_value; | |
1796 | } | |
1797 | ||
1798 | CORE_ADDR | |
1799 | gdbarch_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) | |
1800 | { | |
1801 | if (gdbarch->push_arguments == 0) | |
96baa820 | 1802 | internal_error ("gdbarch: gdbarch_push_arguments invalid"); |
0f71a2f6 JM |
1803 | if (gdbarch_debug >= 2) |
1804 | /* FIXME: gdb_std??? */ | |
1805 | fprintf_unfiltered (gdb_stdlog, "gdbarch_push_arguments called\n"); | |
1806 | return gdbarch->push_arguments (nargs, args, sp, struct_return, struct_addr); | |
1807 | } | |
1808 | ||
1809 | void | |
104c1213 JM |
1810 | set_gdbarch_push_arguments (struct gdbarch *gdbarch, |
1811 | gdbarch_push_arguments_ftype push_arguments) | |
0f71a2f6 JM |
1812 | { |
1813 | gdbarch->push_arguments = push_arguments; | |
1814 | } | |
1815 | ||
1816 | void | |
1817 | gdbarch_push_dummy_frame (struct gdbarch *gdbarch) | |
1818 | { | |
1819 | if (gdbarch->push_dummy_frame == 0) | |
96baa820 | 1820 | internal_error ("gdbarch: gdbarch_push_dummy_frame invalid"); |
0f71a2f6 JM |
1821 | if (gdbarch_debug >= 2) |
1822 | /* FIXME: gdb_std??? */ | |
1823 | fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_frame called\n"); | |
1824 | gdbarch->push_dummy_frame (); | |
1825 | } | |
1826 | ||
1827 | void | |
104c1213 JM |
1828 | set_gdbarch_push_dummy_frame (struct gdbarch *gdbarch, |
1829 | gdbarch_push_dummy_frame_ftype push_dummy_frame) | |
0f71a2f6 JM |
1830 | { |
1831 | gdbarch->push_dummy_frame = push_dummy_frame; | |
1832 | } | |
1833 | ||
1834 | CORE_ADDR | |
1835 | gdbarch_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp) | |
1836 | { | |
1837 | if (gdbarch->push_return_address == 0) | |
96baa820 | 1838 | internal_error ("gdbarch: gdbarch_push_return_address invalid"); |
0f71a2f6 JM |
1839 | if (gdbarch_debug >= 2) |
1840 | /* FIXME: gdb_std??? */ | |
1841 | fprintf_unfiltered (gdb_stdlog, "gdbarch_push_return_address called\n"); | |
1842 | return gdbarch->push_return_address (pc, sp); | |
1843 | } | |
1844 | ||
1845 | void | |
104c1213 JM |
1846 | set_gdbarch_push_return_address (struct gdbarch *gdbarch, |
1847 | gdbarch_push_return_address_ftype push_return_address) | |
0f71a2f6 JM |
1848 | { |
1849 | gdbarch->push_return_address = push_return_address; | |
1850 | } | |
1851 | ||
1852 | void | |
1853 | gdbarch_pop_frame (struct gdbarch *gdbarch) | |
1854 | { | |
1855 | if (gdbarch->pop_frame == 0) | |
96baa820 | 1856 | internal_error ("gdbarch: gdbarch_pop_frame invalid"); |
0f71a2f6 JM |
1857 | if (gdbarch_debug >= 2) |
1858 | /* FIXME: gdb_std??? */ | |
1859 | fprintf_unfiltered (gdb_stdlog, "gdbarch_pop_frame called\n"); | |
1860 | gdbarch->pop_frame (); | |
1861 | } | |
1862 | ||
1863 | void | |
104c1213 JM |
1864 | set_gdbarch_pop_frame (struct gdbarch *gdbarch, |
1865 | gdbarch_pop_frame_ftype pop_frame) | |
0f71a2f6 JM |
1866 | { |
1867 | gdbarch->pop_frame = pop_frame; | |
1868 | } | |
1869 | ||
1870 | CORE_ADDR | |
1871 | gdbarch_d10v_make_daddr (struct gdbarch *gdbarch, CORE_ADDR x) | |
1872 | { | |
1873 | if (gdbarch->d10v_make_daddr == 0) | |
96baa820 | 1874 | internal_error ("gdbarch: gdbarch_d10v_make_daddr invalid"); |
0f71a2f6 JM |
1875 | if (gdbarch_debug >= 2) |
1876 | /* FIXME: gdb_std??? */ | |
1877 | fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_make_daddr called\n"); | |
1878 | return gdbarch->d10v_make_daddr (x); | |
1879 | } | |
1880 | ||
1881 | void | |
104c1213 JM |
1882 | set_gdbarch_d10v_make_daddr (struct gdbarch *gdbarch, |
1883 | gdbarch_d10v_make_daddr_ftype d10v_make_daddr) | |
0f71a2f6 JM |
1884 | { |
1885 | gdbarch->d10v_make_daddr = d10v_make_daddr; | |
1886 | } | |
1887 | ||
1888 | CORE_ADDR | |
1889 | gdbarch_d10v_make_iaddr (struct gdbarch *gdbarch, CORE_ADDR x) | |
1890 | { | |
1891 | if (gdbarch->d10v_make_iaddr == 0) | |
96baa820 | 1892 | internal_error ("gdbarch: gdbarch_d10v_make_iaddr invalid"); |
0f71a2f6 JM |
1893 | if (gdbarch_debug >= 2) |
1894 | /* FIXME: gdb_std??? */ | |
1895 | fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_make_iaddr called\n"); | |
1896 | return gdbarch->d10v_make_iaddr (x); | |
1897 | } | |
1898 | ||
1899 | void | |
104c1213 JM |
1900 | set_gdbarch_d10v_make_iaddr (struct gdbarch *gdbarch, |
1901 | gdbarch_d10v_make_iaddr_ftype d10v_make_iaddr) | |
0f71a2f6 JM |
1902 | { |
1903 | gdbarch->d10v_make_iaddr = d10v_make_iaddr; | |
1904 | } | |
1905 | ||
1906 | int | |
1907 | gdbarch_d10v_daddr_p (struct gdbarch *gdbarch, CORE_ADDR x) | |
1908 | { | |
1909 | if (gdbarch->d10v_daddr_p == 0) | |
96baa820 | 1910 | internal_error ("gdbarch: gdbarch_d10v_daddr_p invalid"); |
0f71a2f6 JM |
1911 | if (gdbarch_debug >= 2) |
1912 | /* FIXME: gdb_std??? */ | |
1913 | fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_daddr_p called\n"); | |
1914 | return gdbarch->d10v_daddr_p (x); | |
1915 | } | |
1916 | ||
1917 | void | |
104c1213 JM |
1918 | set_gdbarch_d10v_daddr_p (struct gdbarch *gdbarch, |
1919 | gdbarch_d10v_daddr_p_ftype d10v_daddr_p) | |
0f71a2f6 JM |
1920 | { |
1921 | gdbarch->d10v_daddr_p = d10v_daddr_p; | |
1922 | } | |
1923 | ||
1924 | int | |
1925 | gdbarch_d10v_iaddr_p (struct gdbarch *gdbarch, CORE_ADDR x) | |
1926 | { | |
1927 | if (gdbarch->d10v_iaddr_p == 0) | |
96baa820 | 1928 | internal_error ("gdbarch: gdbarch_d10v_iaddr_p invalid"); |
0f71a2f6 JM |
1929 | if (gdbarch_debug >= 2) |
1930 | /* FIXME: gdb_std??? */ | |
1931 | fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_iaddr_p called\n"); | |
1932 | return gdbarch->d10v_iaddr_p (x); | |
1933 | } | |
1934 | ||
1935 | void | |
104c1213 JM |
1936 | set_gdbarch_d10v_iaddr_p (struct gdbarch *gdbarch, |
1937 | gdbarch_d10v_iaddr_p_ftype d10v_iaddr_p) | |
0f71a2f6 JM |
1938 | { |
1939 | gdbarch->d10v_iaddr_p = d10v_iaddr_p; | |
1940 | } | |
1941 | ||
1942 | CORE_ADDR | |
1943 | gdbarch_d10v_convert_daddr_to_raw (struct gdbarch *gdbarch, CORE_ADDR x) | |
1944 | { | |
1945 | if (gdbarch->d10v_convert_daddr_to_raw == 0) | |
96baa820 | 1946 | internal_error ("gdbarch: gdbarch_d10v_convert_daddr_to_raw invalid"); |
0f71a2f6 JM |
1947 | if (gdbarch_debug >= 2) |
1948 | /* FIXME: gdb_std??? */ | |
1949 | fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_convert_daddr_to_raw called\n"); | |
1950 | return gdbarch->d10v_convert_daddr_to_raw (x); | |
1951 | } | |
1952 | ||
1953 | void | |
104c1213 JM |
1954 | set_gdbarch_d10v_convert_daddr_to_raw (struct gdbarch *gdbarch, |
1955 | gdbarch_d10v_convert_daddr_to_raw_ftype d10v_convert_daddr_to_raw) | |
0f71a2f6 JM |
1956 | { |
1957 | gdbarch->d10v_convert_daddr_to_raw = d10v_convert_daddr_to_raw; | |
1958 | } | |
1959 | ||
1960 | CORE_ADDR | |
1961 | gdbarch_d10v_convert_iaddr_to_raw (struct gdbarch *gdbarch, CORE_ADDR x) | |
1962 | { | |
1963 | if (gdbarch->d10v_convert_iaddr_to_raw == 0) | |
96baa820 | 1964 | internal_error ("gdbarch: gdbarch_d10v_convert_iaddr_to_raw invalid"); |
0f71a2f6 JM |
1965 | if (gdbarch_debug >= 2) |
1966 | /* FIXME: gdb_std??? */ | |
1967 | fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_convert_iaddr_to_raw called\n"); | |
1968 | return gdbarch->d10v_convert_iaddr_to_raw (x); | |
1969 | } | |
1970 | ||
1971 | void | |
104c1213 JM |
1972 | set_gdbarch_d10v_convert_iaddr_to_raw (struct gdbarch *gdbarch, |
1973 | gdbarch_d10v_convert_iaddr_to_raw_ftype d10v_convert_iaddr_to_raw) | |
0f71a2f6 JM |
1974 | { |
1975 | gdbarch->d10v_convert_iaddr_to_raw = d10v_convert_iaddr_to_raw; | |
1976 | } | |
1977 | ||
1978 | void | |
1979 | gdbarch_store_struct_return (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp) | |
1980 | { | |
1981 | if (gdbarch->store_struct_return == 0) | |
96baa820 | 1982 | internal_error ("gdbarch: gdbarch_store_struct_return invalid"); |
0f71a2f6 JM |
1983 | if (gdbarch_debug >= 2) |
1984 | /* FIXME: gdb_std??? */ | |
1985 | fprintf_unfiltered (gdb_stdlog, "gdbarch_store_struct_return called\n"); | |
1986 | gdbarch->store_struct_return (addr, sp); | |
1987 | } | |
1988 | ||
1989 | void | |
104c1213 JM |
1990 | set_gdbarch_store_struct_return (struct gdbarch *gdbarch, |
1991 | gdbarch_store_struct_return_ftype store_struct_return) | |
0f71a2f6 JM |
1992 | { |
1993 | gdbarch->store_struct_return = store_struct_return; | |
1994 | } | |
1995 | ||
1996 | void | |
1997 | gdbarch_store_return_value (struct gdbarch *gdbarch, struct type *type, char *valbuf) | |
1998 | { | |
1999 | if (gdbarch->store_return_value == 0) | |
96baa820 | 2000 | internal_error ("gdbarch: gdbarch_store_return_value invalid"); |
0f71a2f6 JM |
2001 | if (gdbarch_debug >= 2) |
2002 | /* FIXME: gdb_std??? */ | |
2003 | fprintf_unfiltered (gdb_stdlog, "gdbarch_store_return_value called\n"); | |
2004 | gdbarch->store_return_value (type, valbuf); | |
2005 | } | |
2006 | ||
2007 | void | |
104c1213 JM |
2008 | set_gdbarch_store_return_value (struct gdbarch *gdbarch, |
2009 | gdbarch_store_return_value_ftype store_return_value) | |
0f71a2f6 JM |
2010 | { |
2011 | gdbarch->store_return_value = store_return_value; | |
2012 | } | |
2013 | ||
2014 | CORE_ADDR | |
2015 | gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, char *regbuf) | |
2016 | { | |
2017 | if (gdbarch->extract_struct_value_address == 0) | |
96baa820 | 2018 | internal_error ("gdbarch: gdbarch_extract_struct_value_address invalid"); |
0f71a2f6 JM |
2019 | if (gdbarch_debug >= 2) |
2020 | /* FIXME: gdb_std??? */ | |
2021 | fprintf_unfiltered (gdb_stdlog, "gdbarch_extract_struct_value_address called\n"); | |
2022 | return gdbarch->extract_struct_value_address (regbuf); | |
2023 | } | |
2024 | ||
2025 | void | |
104c1213 JM |
2026 | set_gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, |
2027 | gdbarch_extract_struct_value_address_ftype extract_struct_value_address) | |
0f71a2f6 JM |
2028 | { |
2029 | gdbarch->extract_struct_value_address = extract_struct_value_address; | |
2030 | } | |
2031 | ||
2032 | int | |
2033 | gdbarch_use_struct_convention (struct gdbarch *gdbarch, int gcc_p, struct type *value_type) | |
2034 | { | |
2035 | if (gdbarch->use_struct_convention == 0) | |
96baa820 | 2036 | internal_error ("gdbarch: gdbarch_use_struct_convention invalid"); |
0f71a2f6 JM |
2037 | if (gdbarch_debug >= 2) |
2038 | /* FIXME: gdb_std??? */ | |
2039 | fprintf_unfiltered (gdb_stdlog, "gdbarch_use_struct_convention called\n"); | |
2040 | return gdbarch->use_struct_convention (gcc_p, value_type); | |
2041 | } | |
2042 | ||
2043 | void | |
104c1213 JM |
2044 | set_gdbarch_use_struct_convention (struct gdbarch *gdbarch, |
2045 | gdbarch_use_struct_convention_ftype use_struct_convention) | |
0f71a2f6 JM |
2046 | { |
2047 | gdbarch->use_struct_convention = use_struct_convention; | |
2048 | } | |
2049 | ||
2050 | void | |
2051 | gdbarch_frame_init_saved_regs (struct gdbarch *gdbarch, struct frame_info *frame) | |
2052 | { | |
2053 | if (gdbarch->frame_init_saved_regs == 0) | |
96baa820 | 2054 | internal_error ("gdbarch: gdbarch_frame_init_saved_regs invalid"); |
0f71a2f6 JM |
2055 | if (gdbarch_debug >= 2) |
2056 | /* FIXME: gdb_std??? */ | |
2057 | fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_init_saved_regs called\n"); | |
2058 | gdbarch->frame_init_saved_regs (frame); | |
2059 | } | |
2060 | ||
2061 | void | |
104c1213 JM |
2062 | set_gdbarch_frame_init_saved_regs (struct gdbarch *gdbarch, |
2063 | gdbarch_frame_init_saved_regs_ftype frame_init_saved_regs) | |
0f71a2f6 JM |
2064 | { |
2065 | gdbarch->frame_init_saved_regs = frame_init_saved_regs; | |
2066 | } | |
2067 | ||
2068 | void | |
2069 | gdbarch_init_extra_frame_info (struct gdbarch *gdbarch, int fromleaf, struct frame_info *frame) | |
2070 | { | |
2071 | if (gdbarch->init_extra_frame_info == 0) | |
96baa820 | 2072 | internal_error ("gdbarch: gdbarch_init_extra_frame_info invalid"); |
0f71a2f6 JM |
2073 | if (gdbarch_debug >= 2) |
2074 | /* FIXME: gdb_std??? */ | |
2075 | fprintf_unfiltered (gdb_stdlog, "gdbarch_init_extra_frame_info called\n"); | |
2076 | gdbarch->init_extra_frame_info (fromleaf, frame); | |
2077 | } | |
2078 | ||
2079 | void | |
104c1213 JM |
2080 | set_gdbarch_init_extra_frame_info (struct gdbarch *gdbarch, |
2081 | gdbarch_init_extra_frame_info_ftype init_extra_frame_info) | |
0f71a2f6 JM |
2082 | { |
2083 | gdbarch->init_extra_frame_info = init_extra_frame_info; | |
2084 | } | |
2085 | ||
2086 | CORE_ADDR | |
2087 | gdbarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip) | |
2088 | { | |
2089 | if (gdbarch->skip_prologue == 0) | |
96baa820 | 2090 | internal_error ("gdbarch: gdbarch_skip_prologue invalid"); |
0f71a2f6 JM |
2091 | if (gdbarch_debug >= 2) |
2092 | /* FIXME: gdb_std??? */ | |
2093 | fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_prologue called\n"); | |
2094 | return gdbarch->skip_prologue (ip); | |
2095 | } | |
2096 | ||
2097 | void | |
104c1213 JM |
2098 | set_gdbarch_skip_prologue (struct gdbarch *gdbarch, |
2099 | gdbarch_skip_prologue_ftype skip_prologue) | |
0f71a2f6 JM |
2100 | { |
2101 | gdbarch->skip_prologue = skip_prologue; | |
2102 | } | |
2103 | ||
2104 | int | |
2105 | gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs) | |
2106 | { | |
2107 | if (gdbarch->inner_than == 0) | |
96baa820 | 2108 | internal_error ("gdbarch: gdbarch_inner_than invalid"); |
0f71a2f6 JM |
2109 | if (gdbarch_debug >= 2) |
2110 | /* FIXME: gdb_std??? */ | |
2111 | fprintf_unfiltered (gdb_stdlog, "gdbarch_inner_than called\n"); | |
2112 | return gdbarch->inner_than (lhs, rhs); | |
2113 | } | |
2114 | ||
2115 | void | |
104c1213 JM |
2116 | set_gdbarch_inner_than (struct gdbarch *gdbarch, |
2117 | gdbarch_inner_than_ftype inner_than) | |
0f71a2f6 JM |
2118 | { |
2119 | gdbarch->inner_than = inner_than; | |
2120 | } | |
2121 | ||
2122 | unsigned char * | |
adf40b2e | 2123 | gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr) |
0f71a2f6 JM |
2124 | { |
2125 | if (gdbarch->breakpoint_from_pc == 0) | |
96baa820 | 2126 | internal_error ("gdbarch: gdbarch_breakpoint_from_pc invalid"); |
0f71a2f6 JM |
2127 | if (gdbarch_debug >= 2) |
2128 | /* FIXME: gdb_std??? */ | |
2129 | fprintf_unfiltered (gdb_stdlog, "gdbarch_breakpoint_from_pc called\n"); | |
2130 | return gdbarch->breakpoint_from_pc (pcptr, lenptr); | |
2131 | } | |
2132 | ||
2133 | void | |
104c1213 JM |
2134 | set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, |
2135 | gdbarch_breakpoint_from_pc_ftype breakpoint_from_pc) | |
0f71a2f6 JM |
2136 | { |
2137 | gdbarch->breakpoint_from_pc = breakpoint_from_pc; | |
2138 | } | |
2139 | ||
917317f4 JM |
2140 | int |
2141 | gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, char *contents_cache) | |
2142 | { | |
2143 | if (gdbarch->memory_insert_breakpoint == 0) | |
2144 | internal_error ("gdbarch: gdbarch_memory_insert_breakpoint invalid"); | |
2145 | if (gdbarch_debug >= 2) | |
2146 | /* FIXME: gdb_std??? */ | |
2147 | fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_insert_breakpoint called\n"); | |
2148 | return gdbarch->memory_insert_breakpoint (addr, contents_cache); | |
2149 | } | |
2150 | ||
2151 | void | |
2152 | set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, | |
2153 | gdbarch_memory_insert_breakpoint_ftype memory_insert_breakpoint) | |
2154 | { | |
2155 | gdbarch->memory_insert_breakpoint = memory_insert_breakpoint; | |
2156 | } | |
2157 | ||
2158 | int | |
2159 | gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, char *contents_cache) | |
2160 | { | |
2161 | if (gdbarch->memory_remove_breakpoint == 0) | |
2162 | internal_error ("gdbarch: gdbarch_memory_remove_breakpoint invalid"); | |
2163 | if (gdbarch_debug >= 2) | |
2164 | /* FIXME: gdb_std??? */ | |
2165 | fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_remove_breakpoint called\n"); | |
2166 | return gdbarch->memory_remove_breakpoint (addr, contents_cache); | |
2167 | } | |
2168 | ||
2169 | void | |
2170 | set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, | |
2171 | gdbarch_memory_remove_breakpoint_ftype memory_remove_breakpoint) | |
2172 | { | |
2173 | gdbarch->memory_remove_breakpoint = memory_remove_breakpoint; | |
2174 | } | |
2175 | ||
0f71a2f6 | 2176 | CORE_ADDR |
104c1213 | 2177 | gdbarch_decr_pc_after_break (struct gdbarch *gdbarch) |
0f71a2f6 JM |
2178 | { |
2179 | if (gdbarch->decr_pc_after_break == -1) | |
96baa820 | 2180 | internal_error ("gdbarch: gdbarch_decr_pc_after_break invalid"); |
0f71a2f6 JM |
2181 | if (gdbarch_debug >= 2) |
2182 | /* FIXME: gdb_std??? */ | |
2183 | fprintf_unfiltered (gdb_stdlog, "gdbarch_decr_pc_after_break called\n"); | |
2184 | return gdbarch->decr_pc_after_break; | |
2185 | } | |
2186 | ||
2187 | void | |
104c1213 JM |
2188 | set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch, |
2189 | CORE_ADDR decr_pc_after_break) | |
0f71a2f6 JM |
2190 | { |
2191 | gdbarch->decr_pc_after_break = decr_pc_after_break; | |
2192 | } | |
2193 | ||
2194 | CORE_ADDR | |
104c1213 | 2195 | gdbarch_function_start_offset (struct gdbarch *gdbarch) |
0f71a2f6 JM |
2196 | { |
2197 | if (gdbarch->function_start_offset == -1) | |
96baa820 | 2198 | internal_error ("gdbarch: gdbarch_function_start_offset invalid"); |
0f71a2f6 JM |
2199 | if (gdbarch_debug >= 2) |
2200 | /* FIXME: gdb_std??? */ | |
2201 | fprintf_unfiltered (gdb_stdlog, "gdbarch_function_start_offset called\n"); | |
2202 | return gdbarch->function_start_offset; | |
2203 | } | |
2204 | ||
2205 | void | |
104c1213 JM |
2206 | set_gdbarch_function_start_offset (struct gdbarch *gdbarch, |
2207 | CORE_ADDR function_start_offset) | |
0f71a2f6 JM |
2208 | { |
2209 | gdbarch->function_start_offset = function_start_offset; | |
2210 | } | |
2211 | ||
2212 | void | |
adf40b2e | 2213 | gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len) |
0f71a2f6 JM |
2214 | { |
2215 | if (gdbarch->remote_translate_xfer_address == 0) | |
96baa820 | 2216 | internal_error ("gdbarch: gdbarch_remote_translate_xfer_address invalid"); |
0f71a2f6 JM |
2217 | if (gdbarch_debug >= 2) |
2218 | /* FIXME: gdb_std??? */ | |
2219 | fprintf_unfiltered (gdb_stdlog, "gdbarch_remote_translate_xfer_address called\n"); | |
2220 | gdbarch->remote_translate_xfer_address (gdb_addr, gdb_len, rem_addr, rem_len); | |
2221 | } | |
2222 | ||
2223 | void | |
104c1213 JM |
2224 | set_gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, |
2225 | gdbarch_remote_translate_xfer_address_ftype remote_translate_xfer_address) | |
0f71a2f6 JM |
2226 | { |
2227 | gdbarch->remote_translate_xfer_address = remote_translate_xfer_address; | |
2228 | } | |
2229 | ||
2230 | CORE_ADDR | |
104c1213 | 2231 | gdbarch_frame_args_skip (struct gdbarch *gdbarch) |
0f71a2f6 JM |
2232 | { |
2233 | if (gdbarch->frame_args_skip == -1) | |
96baa820 | 2234 | internal_error ("gdbarch: gdbarch_frame_args_skip invalid"); |
0f71a2f6 JM |
2235 | if (gdbarch_debug >= 2) |
2236 | /* FIXME: gdb_std??? */ | |
2237 | fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_args_skip called\n"); | |
2238 | return gdbarch->frame_args_skip; | |
2239 | } | |
2240 | ||
2241 | void | |
104c1213 JM |
2242 | set_gdbarch_frame_args_skip (struct gdbarch *gdbarch, |
2243 | CORE_ADDR frame_args_skip) | |
0f71a2f6 JM |
2244 | { |
2245 | gdbarch->frame_args_skip = frame_args_skip; | |
2246 | } | |
2247 | ||
2248 | int | |
2249 | gdbarch_frameless_function_invocation (struct gdbarch *gdbarch, struct frame_info *fi) | |
2250 | { | |
2251 | if (gdbarch->frameless_function_invocation == 0) | |
96baa820 | 2252 | internal_error ("gdbarch: gdbarch_frameless_function_invocation invalid"); |
0f71a2f6 JM |
2253 | if (gdbarch_debug >= 2) |
2254 | /* FIXME: gdb_std??? */ | |
2255 | fprintf_unfiltered (gdb_stdlog, "gdbarch_frameless_function_invocation called\n"); | |
2256 | return gdbarch->frameless_function_invocation (fi); | |
2257 | } | |
2258 | ||
2259 | void | |
104c1213 JM |
2260 | set_gdbarch_frameless_function_invocation (struct gdbarch *gdbarch, |
2261 | gdbarch_frameless_function_invocation_ftype frameless_function_invocation) | |
0f71a2f6 JM |
2262 | { |
2263 | gdbarch->frameless_function_invocation = frameless_function_invocation; | |
2264 | } | |
2265 | ||
2266 | CORE_ADDR | |
2267 | gdbarch_frame_chain (struct gdbarch *gdbarch, struct frame_info *frame) | |
2268 | { | |
2269 | if (gdbarch->frame_chain == 0) | |
96baa820 | 2270 | internal_error ("gdbarch: gdbarch_frame_chain invalid"); |
0f71a2f6 JM |
2271 | if (gdbarch_debug >= 2) |
2272 | /* FIXME: gdb_std??? */ | |
2273 | fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_chain called\n"); | |
2274 | return gdbarch->frame_chain (frame); | |
2275 | } | |
2276 | ||
2277 | void | |
104c1213 JM |
2278 | set_gdbarch_frame_chain (struct gdbarch *gdbarch, |
2279 | gdbarch_frame_chain_ftype frame_chain) | |
0f71a2f6 JM |
2280 | { |
2281 | gdbarch->frame_chain = frame_chain; | |
2282 | } | |
2283 | ||
2284 | int | |
2285 | gdbarch_frame_chain_valid (struct gdbarch *gdbarch, CORE_ADDR chain, struct frame_info *thisframe) | |
2286 | { | |
2287 | if (gdbarch->frame_chain_valid == 0) | |
96baa820 | 2288 | internal_error ("gdbarch: gdbarch_frame_chain_valid invalid"); |
0f71a2f6 JM |
2289 | if (gdbarch_debug >= 2) |
2290 | /* FIXME: gdb_std??? */ | |
2291 | fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_chain_valid called\n"); | |
2292 | return gdbarch->frame_chain_valid (chain, thisframe); | |
2293 | } | |
2294 | ||
2295 | void | |
104c1213 JM |
2296 | set_gdbarch_frame_chain_valid (struct gdbarch *gdbarch, |
2297 | gdbarch_frame_chain_valid_ftype frame_chain_valid) | |
0f71a2f6 JM |
2298 | { |
2299 | gdbarch->frame_chain_valid = frame_chain_valid; | |
2300 | } | |
2301 | ||
2302 | CORE_ADDR | |
2303 | gdbarch_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi) | |
2304 | { | |
2305 | if (gdbarch->frame_saved_pc == 0) | |
96baa820 | 2306 | internal_error ("gdbarch: gdbarch_frame_saved_pc invalid"); |
0f71a2f6 JM |
2307 | if (gdbarch_debug >= 2) |
2308 | /* FIXME: gdb_std??? */ | |
2309 | fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_saved_pc called\n"); | |
2310 | return gdbarch->frame_saved_pc (fi); | |
2311 | } | |
2312 | ||
2313 | void | |
104c1213 JM |
2314 | set_gdbarch_frame_saved_pc (struct gdbarch *gdbarch, |
2315 | gdbarch_frame_saved_pc_ftype frame_saved_pc) | |
0f71a2f6 JM |
2316 | { |
2317 | gdbarch->frame_saved_pc = frame_saved_pc; | |
2318 | } | |
2319 | ||
2320 | CORE_ADDR | |
2321 | gdbarch_frame_args_address (struct gdbarch *gdbarch, struct frame_info *fi) | |
2322 | { | |
2323 | if (gdbarch->frame_args_address == 0) | |
96baa820 | 2324 | internal_error ("gdbarch: gdbarch_frame_args_address invalid"); |
0f71a2f6 JM |
2325 | if (gdbarch_debug >= 2) |
2326 | /* FIXME: gdb_std??? */ | |
2327 | fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_args_address called\n"); | |
2328 | return gdbarch->frame_args_address (fi); | |
2329 | } | |
2330 | ||
2331 | void | |
104c1213 JM |
2332 | set_gdbarch_frame_args_address (struct gdbarch *gdbarch, |
2333 | gdbarch_frame_args_address_ftype frame_args_address) | |
0f71a2f6 JM |
2334 | { |
2335 | gdbarch->frame_args_address = frame_args_address; | |
2336 | } | |
2337 | ||
2338 | CORE_ADDR | |
2339 | gdbarch_frame_locals_address (struct gdbarch *gdbarch, struct frame_info *fi) | |
2340 | { | |
2341 | if (gdbarch->frame_locals_address == 0) | |
96baa820 | 2342 | internal_error ("gdbarch: gdbarch_frame_locals_address invalid"); |
0f71a2f6 JM |
2343 | if (gdbarch_debug >= 2) |
2344 | /* FIXME: gdb_std??? */ | |
2345 | fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_locals_address called\n"); | |
2346 | return gdbarch->frame_locals_address (fi); | |
2347 | } | |
2348 | ||
2349 | void | |
104c1213 JM |
2350 | set_gdbarch_frame_locals_address (struct gdbarch *gdbarch, |
2351 | gdbarch_frame_locals_address_ftype frame_locals_address) | |
0f71a2f6 JM |
2352 | { |
2353 | gdbarch->frame_locals_address = frame_locals_address; | |
2354 | } | |
2355 | ||
2356 | CORE_ADDR | |
2357 | gdbarch_saved_pc_after_call (struct gdbarch *gdbarch, struct frame_info *frame) | |
2358 | { | |
2359 | if (gdbarch->saved_pc_after_call == 0) | |
96baa820 | 2360 | internal_error ("gdbarch: gdbarch_saved_pc_after_call invalid"); |
0f71a2f6 JM |
2361 | if (gdbarch_debug >= 2) |
2362 | /* FIXME: gdb_std??? */ | |
2363 | fprintf_unfiltered (gdb_stdlog, "gdbarch_saved_pc_after_call called\n"); | |
2364 | return gdbarch->saved_pc_after_call (frame); | |
2365 | } | |
2366 | ||
2367 | void | |
104c1213 JM |
2368 | set_gdbarch_saved_pc_after_call (struct gdbarch *gdbarch, |
2369 | gdbarch_saved_pc_after_call_ftype saved_pc_after_call) | |
0f71a2f6 JM |
2370 | { |
2371 | gdbarch->saved_pc_after_call = saved_pc_after_call; | |
2372 | } | |
2373 | ||
2374 | int | |
2375 | gdbarch_frame_num_args (struct gdbarch *gdbarch, struct frame_info *frame) | |
2376 | { | |
2377 | if (gdbarch->frame_num_args == 0) | |
96baa820 | 2378 | internal_error ("gdbarch: gdbarch_frame_num_args invalid"); |
0f71a2f6 JM |
2379 | if (gdbarch_debug >= 2) |
2380 | /* FIXME: gdb_std??? */ | |
2381 | fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_num_args called\n"); | |
2382 | return gdbarch->frame_num_args (frame); | |
2383 | } | |
2384 | ||
2385 | void | |
104c1213 JM |
2386 | set_gdbarch_frame_num_args (struct gdbarch *gdbarch, |
2387 | gdbarch_frame_num_args_ftype frame_num_args) | |
0f71a2f6 JM |
2388 | { |
2389 | gdbarch->frame_num_args = frame_num_args; | |
2390 | } | |
2391 | ||
2392 | ||
2393 | /* Keep a registrary of per-architecture data-pointers required by GDB | |
2394 | modules. */ | |
2395 | ||
2396 | struct gdbarch_data | |
2397 | { | |
2398 | int index; | |
2399 | }; | |
2400 | ||
2401 | struct gdbarch_data_registration | |
adf40b2e JM |
2402 | { |
2403 | gdbarch_data_ftype *init; | |
2404 | struct gdbarch_data *data; | |
2405 | struct gdbarch_data_registration *next; | |
2406 | }; | |
0f71a2f6 JM |
2407 | |
2408 | struct gdbarch_data_registrary | |
adf40b2e JM |
2409 | { |
2410 | int nr; | |
2411 | struct gdbarch_data_registration *registrations; | |
2412 | }; | |
0f71a2f6 JM |
2413 | |
2414 | struct gdbarch_data_registrary gdbarch_data_registrary = | |
2415 | { | |
2416 | 0, NULL, | |
2417 | }; | |
2418 | ||
2419 | struct gdbarch_data * | |
104c1213 | 2420 | register_gdbarch_data (gdbarch_data_ftype *init) |
0f71a2f6 JM |
2421 | { |
2422 | struct gdbarch_data_registration **curr; | |
2423 | for (curr = &gdbarch_data_registrary.registrations; | |
2424 | (*curr) != NULL; | |
2425 | curr = &(*curr)->next); | |
2426 | (*curr) = XMALLOC (struct gdbarch_data_registration); | |
2427 | (*curr)->next = NULL; | |
2428 | (*curr)->init = init; | |
2429 | (*curr)->data = XMALLOC (struct gdbarch_data); | |
2430 | (*curr)->data->index = gdbarch_data_registrary.nr++; | |
2431 | return (*curr)->data; | |
2432 | } | |
2433 | ||
2434 | ||
2435 | /* Walk through all the registered users initializing each in turn. */ | |
2436 | ||
0f71a2f6 | 2437 | static void |
104c1213 | 2438 | init_gdbarch_data (struct gdbarch *gdbarch) |
0f71a2f6 JM |
2439 | { |
2440 | struct gdbarch_data_registration *rego; | |
2441 | gdbarch->nr_data = gdbarch_data_registrary.nr + 1; | |
adf40b2e | 2442 | gdbarch->data = xmalloc (sizeof (void*) * gdbarch->nr_data); |
0f71a2f6 JM |
2443 | for (rego = gdbarch_data_registrary.registrations; |
2444 | rego != NULL; | |
2445 | rego = rego->next) | |
2446 | { | |
2447 | if (rego->data->index < gdbarch->nr_data) | |
2448 | gdbarch->data[rego->data->index] = rego->init (); | |
2449 | } | |
2450 | } | |
2451 | ||
2452 | ||
2453 | /* Return the current value of the specified per-architecture | |
2454 | data-pointer. */ | |
2455 | ||
2456 | void * | |
2457 | gdbarch_data (data) | |
2458 | struct gdbarch_data *data; | |
2459 | { | |
2460 | if (data->index >= current_gdbarch->nr_data) | |
96baa820 | 2461 | internal_error ("gdbarch_data: request for non-existant data."); |
0f71a2f6 JM |
2462 | return current_gdbarch->data[data->index]; |
2463 | } | |
2464 | ||
2465 | ||
2466 | ||
2467 | /* Keep a registrary of swaped data required by GDB modules. */ | |
2468 | ||
2469 | struct gdbarch_swap | |
2470 | { | |
2471 | void *swap; | |
2472 | struct gdbarch_swap_registration *source; | |
2473 | struct gdbarch_swap *next; | |
2474 | }; | |
2475 | ||
2476 | struct gdbarch_swap_registration | |
adf40b2e JM |
2477 | { |
2478 | void *data; | |
2479 | unsigned long sizeof_data; | |
2480 | gdbarch_swap_ftype *init; | |
2481 | struct gdbarch_swap_registration *next; | |
2482 | }; | |
0f71a2f6 JM |
2483 | |
2484 | struct gdbarch_swap_registrary | |
adf40b2e JM |
2485 | { |
2486 | int nr; | |
2487 | struct gdbarch_swap_registration *registrations; | |
2488 | }; | |
0f71a2f6 | 2489 | |
adf40b2e | 2490 | struct gdbarch_swap_registrary gdbarch_swap_registrary = |
0f71a2f6 JM |
2491 | { |
2492 | 0, NULL, | |
2493 | }; | |
2494 | ||
2495 | void | |
104c1213 JM |
2496 | register_gdbarch_swap (void *data, |
2497 | unsigned long sizeof_data, | |
2498 | gdbarch_swap_ftype *init) | |
0f71a2f6 JM |
2499 | { |
2500 | struct gdbarch_swap_registration **rego; | |
2501 | for (rego = &gdbarch_swap_registrary.registrations; | |
2502 | (*rego) != NULL; | |
2503 | rego = &(*rego)->next); | |
2504 | (*rego) = XMALLOC (struct gdbarch_swap_registration); | |
2505 | (*rego)->next = NULL; | |
2506 | (*rego)->init = init; | |
2507 | (*rego)->data = data; | |
2508 | (*rego)->sizeof_data = sizeof_data; | |
2509 | } | |
2510 | ||
2511 | ||
0f71a2f6 | 2512 | static void |
104c1213 | 2513 | init_gdbarch_swap (struct gdbarch *gdbarch) |
0f71a2f6 JM |
2514 | { |
2515 | struct gdbarch_swap_registration *rego; | |
2516 | struct gdbarch_swap **curr = &gdbarch->swap; | |
2517 | for (rego = gdbarch_swap_registrary.registrations; | |
2518 | rego != NULL; | |
2519 | rego = rego->next) | |
2520 | { | |
2521 | if (rego->data != NULL) | |
2522 | { | |
2523 | (*curr) = XMALLOC (struct gdbarch_swap); | |
2524 | (*curr)->source = rego; | |
2525 | (*curr)->swap = xmalloc (rego->sizeof_data); | |
2526 | (*curr)->next = NULL; | |
2527 | memset (rego->data, 0, rego->sizeof_data); | |
2528 | curr = &(*curr)->next; | |
2529 | } | |
2530 | if (rego->init != NULL) | |
2531 | rego->init (); | |
2532 | } | |
2533 | } | |
2534 | ||
0f71a2f6 | 2535 | static void |
104c1213 | 2536 | swapout_gdbarch_swap (struct gdbarch *gdbarch) |
0f71a2f6 JM |
2537 | { |
2538 | struct gdbarch_swap *curr; | |
2539 | for (curr = gdbarch->swap; | |
2540 | curr != NULL; | |
2541 | curr = curr->next) | |
2542 | memcpy (curr->swap, curr->source->data, curr->source->sizeof_data); | |
2543 | } | |
2544 | ||
0f71a2f6 | 2545 | static void |
104c1213 | 2546 | swapin_gdbarch_swap (struct gdbarch *gdbarch) |
0f71a2f6 JM |
2547 | { |
2548 | struct gdbarch_swap *curr; | |
2549 | for (curr = gdbarch->swap; | |
2550 | curr != NULL; | |
2551 | curr = curr->next) | |
2552 | memcpy (curr->source->data, curr->swap, curr->source->sizeof_data); | |
2553 | } | |
2554 | ||
2555 | ||
2556 | /* Keep a registrary of the architectures known by GDB. */ | |
2557 | ||
2558 | struct gdbarch_init_registration | |
2559 | { | |
2560 | enum bfd_architecture bfd_architecture; | |
2561 | gdbarch_init_ftype *init; | |
2562 | struct gdbarch_list *arches; | |
2563 | struct gdbarch_init_registration *next; | |
2564 | }; | |
2565 | ||
2566 | static struct gdbarch_init_registration *gdbarch_init_registrary = NULL; | |
2567 | ||
2568 | void | |
104c1213 JM |
2569 | register_gdbarch_init (enum bfd_architecture bfd_architecture, |
2570 | gdbarch_init_ftype *init) | |
0f71a2f6 JM |
2571 | { |
2572 | struct gdbarch_init_registration **curr; | |
2573 | const struct bfd_arch_info *bfd_arch_info; | |
2574 | /* Check that BFD reconizes this architecture */ | |
2575 | bfd_arch_info = bfd_lookup_arch (bfd_architecture, 0); | |
2576 | if (bfd_arch_info == NULL) | |
2577 | { | |
96baa820 | 2578 | internal_error ("gdbarch: Attempt to register unknown architecture (%d)", bfd_architecture); |
0f71a2f6 JM |
2579 | } |
2580 | /* Check that we haven't seen this architecture before */ | |
2581 | for (curr = &gdbarch_init_registrary; | |
2582 | (*curr) != NULL; | |
2583 | curr = &(*curr)->next) | |
2584 | { | |
2585 | if (bfd_architecture == (*curr)->bfd_architecture) | |
96baa820 | 2586 | internal_error ("gdbarch: Duplicate registraration of architecture (%s)", |
0f71a2f6 JM |
2587 | bfd_arch_info->printable_name); |
2588 | } | |
2589 | /* log it */ | |
2590 | if (gdbarch_debug) | |
2591 | fprintf_unfiltered (gdb_stdlog, "register_gdbarch_init (%s, 0x%08lx)\n", | |
2592 | bfd_arch_info->printable_name, | |
2593 | (long) init); | |
2594 | /* Append it */ | |
2595 | (*curr) = XMALLOC (struct gdbarch_init_registration); | |
2596 | (*curr)->bfd_architecture = bfd_architecture; | |
2597 | (*curr)->init = init; | |
2598 | (*curr)->arches = NULL; | |
2599 | (*curr)->next = NULL; | |
2600 | } | |
adf40b2e | 2601 | |
0f71a2f6 JM |
2602 | |
2603 | ||
2604 | /* Look for an architecture using gdbarch_info. Base search on only | |
2605 | BFD_ARCH_INFO and BYTE_ORDER. */ | |
2606 | ||
2607 | struct gdbarch_list * | |
104c1213 JM |
2608 | gdbarch_list_lookup_by_info (struct gdbarch_list *arches, |
2609 | const struct gdbarch_info *info) | |
0f71a2f6 JM |
2610 | { |
2611 | for (; arches != NULL; arches = arches->next) | |
2612 | { | |
2613 | if (info->bfd_arch_info != arches->gdbarch->bfd_arch_info) | |
2614 | continue; | |
2615 | if (info->byte_order != arches->gdbarch->byte_order) | |
2616 | continue; | |
2617 | return arches; | |
2618 | } | |
2619 | return NULL; | |
2620 | } | |
2621 | ||
2622 | ||
2623 | /* Update the current architecture. Return ZERO if the update request | |
2624 | failed. */ | |
2625 | ||
2626 | int | |
104c1213 | 2627 | gdbarch_update (struct gdbarch_info info) |
0f71a2f6 JM |
2628 | { |
2629 | struct gdbarch *new_gdbarch; | |
2630 | struct gdbarch_list **list; | |
2631 | struct gdbarch_init_registration *rego; | |
2632 | ||
2633 | /* Fill in any missing bits. Most important is the bfd_architecture | |
2634 | which is used to select the target architecture. */ | |
2635 | if (info.bfd_architecture == bfd_arch_unknown) | |
2636 | { | |
2637 | if (info.bfd_arch_info != NULL) | |
2638 | info.bfd_architecture = info.bfd_arch_info->arch; | |
2639 | else if (info.abfd != NULL) | |
2640 | info.bfd_architecture = bfd_get_arch (info.abfd); | |
2641 | /* FIXME - should query BFD for its default architecture. */ | |
2642 | else | |
2643 | info.bfd_architecture = current_gdbarch->bfd_arch_info->arch; | |
2644 | } | |
2645 | if (info.bfd_arch_info == NULL) | |
2646 | { | |
2647 | if (target_architecture_auto && info.abfd != NULL) | |
2648 | info.bfd_arch_info = bfd_get_arch_info (info.abfd); | |
2649 | else | |
2650 | info.bfd_arch_info = current_gdbarch->bfd_arch_info; | |
2651 | } | |
2652 | if (info.byte_order == 0) | |
2653 | { | |
2654 | if (target_byte_order_auto && info.abfd != NULL) | |
2655 | info.byte_order = (bfd_big_endian (info.abfd) ? BIG_ENDIAN | |
2656 | : bfd_little_endian (info.abfd) ? LITTLE_ENDIAN | |
2657 | : 0); | |
2658 | else | |
2659 | info.byte_order = current_gdbarch->byte_order; | |
2660 | /* FIXME - should query BFD for its default byte-order. */ | |
2661 | } | |
2662 | /* A default for abfd? */ | |
2663 | ||
2664 | /* Find the target that knows about this architecture. */ | |
2665 | for (rego = gdbarch_init_registrary; | |
2666 | rego != NULL && rego->bfd_architecture != info.bfd_architecture; | |
2667 | rego = rego->next); | |
2668 | if (rego == NULL) | |
2669 | { | |
2670 | if (gdbarch_debug) | |
2671 | fprintf_unfiltered (gdb_stdlog, "gdbarch_update: No matching architecture\n"); | |
2672 | return 0; | |
2673 | } | |
2674 | ||
2675 | if (gdbarch_debug) | |
2676 | { | |
2677 | fprintf_unfiltered (gdb_stdlog, | |
2678 | "gdbarch_update: info.bfd_architecture %d (%s)\n", | |
2679 | info.bfd_architecture, | |
adf40b2e | 2680 | bfd_lookup_arch (info.bfd_architecture, 0)->printable_name); |
0f71a2f6 JM |
2681 | fprintf_unfiltered (gdb_stdlog, |
2682 | "gdbarch_update: info.bfd_arch_info %s\n", | |
2683 | (info.bfd_arch_info != NULL | |
2684 | ? info.bfd_arch_info->printable_name | |
2685 | : "(null)")); | |
2686 | fprintf_unfiltered (gdb_stdlog, | |
2687 | "gdbarch_update: info.byte_order %d (%s)\n", | |
2688 | info.byte_order, | |
2689 | (info.byte_order == BIG_ENDIAN ? "big" | |
2690 | : info.byte_order == LITTLE_ENDIAN ? "little" | |
2691 | : "default")); | |
2692 | fprintf_unfiltered (gdb_stdlog, | |
2693 | "gdbarch_update: info.abfd 0x%lx\n", | |
2694 | (long) info.abfd); | |
2695 | fprintf_unfiltered (gdb_stdlog, | |
2696 | "gdbarch_update: info.tdep_info 0x%lx\n", | |
2697 | (long) info.tdep_info); | |
2698 | } | |
2699 | ||
2700 | /* Ask the target for a replacement architecture. */ | |
2701 | new_gdbarch = rego->init (info, rego->arches); | |
2702 | ||
2703 | /* Did the target like it? No. Reject the change. */ | |
2704 | if (new_gdbarch == NULL) | |
2705 | { | |
2706 | if (gdbarch_debug) | |
2707 | fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Target rejected architecture\n"); | |
2708 | return 0; | |
2709 | } | |
2710 | ||
2711 | /* Did the architecture change? No. Do nothing. */ | |
2712 | if (current_gdbarch == new_gdbarch) | |
2713 | { | |
2714 | if (gdbarch_debug) | |
2715 | fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Architecture 0x%08lx (%s) unchanged\n", | |
2716 | (long) new_gdbarch, | |
2717 | new_gdbarch->bfd_arch_info->printable_name); | |
2718 | return 1; | |
2719 | } | |
2720 | ||
2721 | /* Swap all data belonging to the old target out */ | |
2722 | swapout_gdbarch_swap (current_gdbarch); | |
2723 | ||
2724 | /* Is this a pre-existing architecture? Yes. Swap it in. */ | |
2725 | for (list = ®o->arches; | |
2726 | (*list) != NULL; | |
2727 | list = &(*list)->next) | |
2728 | { | |
2729 | if ((*list)->gdbarch == new_gdbarch) | |
2730 | { | |
2731 | if (gdbarch_debug) | |
2732 | fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Previous architecture 0x%08lx (%s) selected\n", | |
2733 | (long) new_gdbarch, | |
2734 | new_gdbarch->bfd_arch_info->printable_name); | |
2735 | current_gdbarch = new_gdbarch; | |
2736 | swapin_gdbarch_swap (new_gdbarch); | |
2737 | return 1; | |
2738 | } | |
2739 | } | |
adf40b2e | 2740 | |
0f71a2f6 JM |
2741 | /* Append this new architecture to this targets list. */ |
2742 | (*list) = XMALLOC (struct gdbarch_list); | |
2743 | (*list)->next = NULL; | |
2744 | (*list)->gdbarch = new_gdbarch; | |
2745 | ||
2746 | /* Switch to this new architecture. Dump it out. */ | |
2747 | current_gdbarch = new_gdbarch; | |
2748 | if (gdbarch_debug) | |
2749 | { | |
2750 | fprintf_unfiltered (gdb_stdlog, | |
adf40b2e | 2751 | "gdbarch_update: New architecture 0x%08lx (%s) selected\n", |
0f71a2f6 JM |
2752 | (long) new_gdbarch, |
2753 | new_gdbarch->bfd_arch_info->printable_name); | |
2754 | gdbarch_dump (); | |
2755 | } | |
adf40b2e | 2756 | |
0f71a2f6 JM |
2757 | /* Check that the newly installed architecture is valid. */ |
2758 | verify_gdbarch (new_gdbarch); | |
2759 | ||
2760 | /* Initialize the per-architecture memory (swap) areas. | |
2761 | CURRENT_GDBARCH must be update before these modules are | |
2762 | called. */ | |
2763 | init_gdbarch_swap (new_gdbarch); | |
adf40b2e | 2764 | |
0f71a2f6 JM |
2765 | /* Initialize the per-architecture data-pointer of all parties that |
2766 | registered an interest in this architecture. CURRENT_GDBARCH | |
2767 | must be updated before these modules are called. */ | |
2768 | init_gdbarch_data (new_gdbarch); | |
adf40b2e | 2769 | |
0f71a2f6 JM |
2770 | return 1; |
2771 | } | |
c906108c | 2772 | |
c906108c SS |
2773 | |
2774 | ||
2775 | /* Functions to manipulate the endianness of the target. */ | |
2776 | ||
2777 | #ifdef TARGET_BYTE_ORDER_SELECTABLE | |
2778 | /* compat - Catch old targets that expect a selectable byte-order to | |
2779 | default to BIG_ENDIAN */ | |
2780 | #ifndef TARGET_BYTE_ORDER_DEFAULT | |
2781 | #define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN | |
2782 | #endif | |
2783 | #endif | |
7a292a7a | 2784 | #if !TARGET_BYTE_ORDER_SELECTABLE_P |
c906108c SS |
2785 | #ifndef TARGET_BYTE_ORDER_DEFAULT |
2786 | /* compat - Catch old non byte-order selectable targets that do not | |
2787 | define TARGET_BYTE_ORDER_DEFAULT and instead expect | |
2788 | TARGET_BYTE_ORDER to be used as the default. For targets that | |
2789 | defined neither TARGET_BYTE_ORDER nor TARGET_BYTE_ORDER_DEFAULT the | |
2790 | below will get a strange compiler warning. */ | |
2791 | #define TARGET_BYTE_ORDER_DEFAULT TARGET_BYTE_ORDER | |
2792 | #endif | |
7a292a7a SS |
2793 | #endif |
2794 | #ifndef TARGET_BYTE_ORDER_DEFAULT | |
adf40b2e | 2795 | #define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN /* arbitrary */ |
7a292a7a | 2796 | #endif |
c906108c SS |
2797 | int target_byte_order = TARGET_BYTE_ORDER_DEFAULT; |
2798 | int target_byte_order_auto = 1; | |
2799 | ||
2800 | /* Chain containing the \"set endian\" commands. */ | |
2801 | static struct cmd_list_element *endianlist = NULL; | |
2802 | ||
2803 | /* Called by ``show endian''. */ | |
c906108c | 2804 | static void |
104c1213 | 2805 | show_endian (char *args, int from_tty) |
c906108c SS |
2806 | { |
2807 | char *msg = | |
adf40b2e JM |
2808 | (TARGET_BYTE_ORDER_AUTO |
2809 | ? "The target endianness is set automatically (currently %s endian)\n" | |
2810 | : "The target is assumed to be %s endian\n"); | |
c906108c SS |
2811 | printf_unfiltered (msg, (TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little")); |
2812 | } | |
2813 | ||
2814 | /* Called if the user enters ``set endian'' without an argument. */ | |
c906108c | 2815 | static void |
104c1213 | 2816 | set_endian (char *args, int from_tty) |
c906108c SS |
2817 | { |
2818 | printf_unfiltered ("\"set endian\" must be followed by \"auto\", \"big\" or \"little\".\n"); | |
2819 | show_endian (args, from_tty); | |
2820 | } | |
2821 | ||
2822 | /* Called by ``set endian big''. */ | |
c906108c | 2823 | static void |
104c1213 | 2824 | set_endian_big (char *args, int from_tty) |
c906108c SS |
2825 | { |
2826 | if (TARGET_BYTE_ORDER_SELECTABLE_P) | |
2827 | { | |
2828 | target_byte_order = BIG_ENDIAN; | |
2829 | target_byte_order_auto = 0; | |
0f71a2f6 JM |
2830 | if (GDB_MULTI_ARCH) |
2831 | { | |
2832 | struct gdbarch_info info; | |
2833 | memset (&info, 0, sizeof info); | |
2834 | info.byte_order = BIG_ENDIAN; | |
2835 | gdbarch_update (info); | |
2836 | } | |
c906108c SS |
2837 | } |
2838 | else | |
2839 | { | |
2840 | printf_unfiltered ("Byte order is not selectable."); | |
2841 | show_endian (args, from_tty); | |
2842 | } | |
2843 | } | |
2844 | ||
2845 | /* Called by ``set endian little''. */ | |
c906108c | 2846 | static void |
104c1213 | 2847 | set_endian_little (char *args, int from_tty) |
c906108c SS |
2848 | { |
2849 | if (TARGET_BYTE_ORDER_SELECTABLE_P) | |
2850 | { | |
2851 | target_byte_order = LITTLE_ENDIAN; | |
2852 | target_byte_order_auto = 0; | |
0f71a2f6 JM |
2853 | if (GDB_MULTI_ARCH) |
2854 | { | |
2855 | struct gdbarch_info info; | |
2856 | memset (&info, 0, sizeof info); | |
2857 | info.byte_order = LITTLE_ENDIAN; | |
2858 | gdbarch_update (info); | |
2859 | } | |
c906108c SS |
2860 | } |
2861 | else | |
2862 | { | |
2863 | printf_unfiltered ("Byte order is not selectable."); | |
2864 | show_endian (args, from_tty); | |
2865 | } | |
2866 | } | |
2867 | ||
2868 | /* Called by ``set endian auto''. */ | |
c906108c | 2869 | static void |
104c1213 | 2870 | set_endian_auto (char *args, int from_tty) |
c906108c SS |
2871 | { |
2872 | if (TARGET_BYTE_ORDER_SELECTABLE_P) | |
2873 | { | |
2874 | target_byte_order_auto = 1; | |
2875 | } | |
2876 | else | |
2877 | { | |
2878 | printf_unfiltered ("Byte order is not selectable."); | |
2879 | show_endian (args, from_tty); | |
2880 | } | |
2881 | } | |
2882 | ||
2883 | /* Set the endianness from a BFD. */ | |
c906108c | 2884 | static void |
104c1213 | 2885 | set_endian_from_file (bfd *abfd) |
c906108c SS |
2886 | { |
2887 | if (TARGET_BYTE_ORDER_SELECTABLE_P) | |
2888 | { | |
2889 | int want; | |
adf40b2e | 2890 | |
c906108c SS |
2891 | if (bfd_big_endian (abfd)) |
2892 | want = BIG_ENDIAN; | |
2893 | else | |
2894 | want = LITTLE_ENDIAN; | |
2895 | if (TARGET_BYTE_ORDER_AUTO) | |
2896 | target_byte_order = want; | |
2897 | else if (TARGET_BYTE_ORDER != want) | |
2898 | warning ("%s endian file does not match %s endian target.", | |
2899 | want == BIG_ENDIAN ? "big" : "little", | |
2900 | TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little"); | |
2901 | } | |
2902 | else | |
2903 | { | |
2904 | if (bfd_big_endian (abfd) | |
2905 | ? TARGET_BYTE_ORDER != BIG_ENDIAN | |
2906 | : TARGET_BYTE_ORDER == BIG_ENDIAN) | |
2907 | warning ("%s endian file does not match %s endian target.", | |
2908 | bfd_big_endian (abfd) ? "big" : "little", | |
2909 | TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little"); | |
2910 | } | |
2911 | } | |
2912 | ||
2913 | ||
2914 | ||
2915 | /* Functions to manipulate the architecture of the target */ | |
2916 | ||
104c1213 JM |
2917 | enum set_arch { set_arch_auto, set_arch_manual }; |
2918 | ||
c906108c SS |
2919 | int target_architecture_auto = 1; |
2920 | extern const struct bfd_arch_info bfd_default_arch_struct; | |
2921 | const struct bfd_arch_info *target_architecture = &bfd_default_arch_struct; | |
104c1213 JM |
2922 | int (*target_architecture_hook) (const struct bfd_arch_info *ap); |
2923 | ||
2924 | static void show_endian (char *, int); | |
2925 | static void set_endian (char *, int); | |
2926 | static void set_endian_big (char *, int); | |
2927 | static void set_endian_little (char *, int); | |
2928 | static void set_endian_auto (char *, int); | |
2929 | static void set_endian_from_file (bfd *); | |
2930 | static int arch_ok (const struct bfd_arch_info *arch); | |
2931 | static void set_arch (const struct bfd_arch_info *arch, enum set_arch type); | |
2932 | static void show_architecture (char *, int); | |
2933 | static void set_architecture (char *, int); | |
2934 | static void info_architecture (char *, int); | |
2935 | static void set_architecture_from_file (bfd *); | |
c906108c SS |
2936 | |
2937 | /* Do the real work of changing the current architecture */ | |
b83266a0 | 2938 | |
b83266a0 | 2939 | static int |
104c1213 | 2940 | arch_ok (const struct bfd_arch_info *arch) |
b83266a0 SS |
2941 | { |
2942 | /* Should be performing the more basic check that the binary is | |
2943 | compatible with GDB. */ | |
2944 | /* Check with the target that the architecture is valid. */ | |
2945 | return (target_architecture_hook == NULL | |
2946 | || target_architecture_hook (arch)); | |
2947 | } | |
2948 | ||
c906108c | 2949 | static void |
104c1213 JM |
2950 | set_arch (const struct bfd_arch_info *arch, |
2951 | enum set_arch type) | |
c906108c | 2952 | { |
7a292a7a | 2953 | switch (type) |
c906108c | 2954 | { |
7a292a7a | 2955 | case set_arch_auto: |
b83266a0 | 2956 | if (!arch_ok (arch)) |
7a292a7a SS |
2957 | warning ("Target may not support %s architecture", |
2958 | arch->printable_name); | |
c906108c | 2959 | target_architecture = arch; |
7a292a7a SS |
2960 | break; |
2961 | case set_arch_manual: | |
b83266a0 | 2962 | if (!arch_ok (arch)) |
7a292a7a SS |
2963 | { |
2964 | printf_unfiltered ("Target does not support `%s' architecture.\n", | |
2965 | arch->printable_name); | |
2966 | } | |
2967 | else | |
2968 | { | |
2969 | target_architecture_auto = 0; | |
2970 | target_architecture = arch; | |
2971 | } | |
2972 | break; | |
c906108c | 2973 | } |
0f71a2f6 JM |
2974 | if (gdbarch_debug) |
2975 | gdbarch_dump (); | |
c906108c SS |
2976 | } |
2977 | ||
2978 | /* Called if the user enters ``show architecture'' without an argument. */ | |
c906108c | 2979 | static void |
104c1213 | 2980 | show_architecture (char *args, int from_tty) |
c906108c SS |
2981 | { |
2982 | const char *arch; | |
2983 | arch = TARGET_ARCHITECTURE->printable_name; | |
2984 | if (target_architecture_auto) | |
2985 | printf_filtered ("The target architecture is set automatically (currently %s)\n", arch); | |
2986 | else | |
2987 | printf_filtered ("The target architecture is assumed to be %s\n", arch); | |
2988 | } | |
2989 | ||
2990 | /* Called if the user enters ``set architecture'' with or without an | |
2991 | argument. */ | |
c906108c | 2992 | static void |
104c1213 | 2993 | set_architecture (char *args, int from_tty) |
c906108c SS |
2994 | { |
2995 | if (args == NULL) | |
2996 | { | |
2997 | printf_unfiltered ("\"set architecture\" must be followed by \"auto\" or an architecture name.\n"); | |
2998 | } | |
2999 | else if (strcmp (args, "auto") == 0) | |
3000 | { | |
3001 | target_architecture_auto = 1; | |
3002 | } | |
0f71a2f6 JM |
3003 | else if (GDB_MULTI_ARCH) |
3004 | { | |
3005 | const struct bfd_arch_info *arch = bfd_scan_arch (args); | |
3006 | if (arch == NULL) | |
3007 | printf_unfiltered ("Architecture `%s' not reconized.\n", args); | |
3008 | else | |
3009 | { | |
3010 | struct gdbarch_info info; | |
3011 | memset (&info, 0, sizeof info); | |
3012 | info.bfd_arch_info = arch; | |
3013 | if (gdbarch_update (info)) | |
3014 | target_architecture_auto = 0; | |
3015 | else | |
3016 | printf_unfiltered ("Architecture `%s' not reconized.\n", args); | |
3017 | } | |
3018 | } | |
c906108c SS |
3019 | else |
3020 | { | |
3021 | const struct bfd_arch_info *arch = bfd_scan_arch (args); | |
3022 | if (arch != NULL) | |
7a292a7a | 3023 | set_arch (arch, set_arch_manual); |
c906108c SS |
3024 | else |
3025 | printf_unfiltered ("Architecture `%s' not reconized.\n", args); | |
3026 | } | |
3027 | } | |
3028 | ||
3029 | /* Called if the user enters ``info architecture'' without an argument. */ | |
c906108c | 3030 | static void |
104c1213 | 3031 | info_architecture (char *args, int from_tty) |
c906108c SS |
3032 | { |
3033 | enum bfd_architecture a; | |
0f71a2f6 JM |
3034 | if (GDB_MULTI_ARCH) |
3035 | { | |
3036 | if (gdbarch_init_registrary != NULL) | |
3037 | { | |
3038 | struct gdbarch_init_registration *rego; | |
3039 | printf_filtered ("Available architectures are:\n"); | |
3040 | for (rego = gdbarch_init_registrary; | |
3041 | rego != NULL; | |
3042 | rego = rego->next) | |
3043 | { | |
3044 | const struct bfd_arch_info *ap; | |
3045 | ap = bfd_lookup_arch (rego->bfd_architecture, 0); | |
3046 | if (ap != NULL) | |
3047 | { | |
3048 | do | |
3049 | { | |
3050 | printf_filtered (" %s", ap->printable_name); | |
3051 | ap = ap->next; | |
3052 | } | |
3053 | while (ap != NULL); | |
3054 | printf_filtered ("\n"); | |
3055 | } | |
3056 | } | |
3057 | } | |
3058 | else | |
3059 | { | |
3060 | printf_filtered ("There are no available architectures.\n"); | |
3061 | } | |
3062 | return; | |
3063 | } | |
c906108c SS |
3064 | printf_filtered ("Available architectures are:\n"); |
3065 | for (a = bfd_arch_obscure + 1; a < bfd_arch_last; a++) | |
3066 | { | |
3067 | const struct bfd_arch_info *ap = bfd_lookup_arch (a, 0); | |
3068 | if (ap != NULL) | |
3069 | { | |
3070 | do | |
3071 | { | |
3072 | printf_filtered (" %s", ap->printable_name); | |
3073 | ap = ap->next; | |
3074 | } | |
3075 | while (ap != NULL); | |
3076 | printf_filtered ("\n"); | |
3077 | } | |
3078 | } | |
3079 | } | |
3080 | ||
3081 | /* Set the architecture from arch/machine */ | |
3082 | void | |
3083 | set_architecture_from_arch_mach (arch, mach) | |
3084 | enum bfd_architecture arch; | |
3085 | unsigned long mach; | |
3086 | { | |
3087 | const struct bfd_arch_info *wanted = bfd_lookup_arch (arch, mach); | |
3088 | if (wanted != NULL) | |
7a292a7a | 3089 | set_arch (wanted, set_arch_manual); |
c906108c | 3090 | else |
96baa820 | 3091 | internal_error ("gdbarch: hardwired architecture/machine not reconized"); |
c906108c SS |
3092 | } |
3093 | ||
3094 | /* Set the architecture from a BFD */ | |
c906108c | 3095 | static void |
104c1213 | 3096 | set_architecture_from_file (bfd *abfd) |
c906108c SS |
3097 | { |
3098 | const struct bfd_arch_info *wanted = bfd_get_arch_info (abfd); | |
3099 | if (target_architecture_auto) | |
3100 | { | |
7a292a7a | 3101 | set_arch (wanted, set_arch_auto); |
c906108c SS |
3102 | } |
3103 | else if (wanted != target_architecture) | |
3104 | { | |
3105 | warning ("%s architecture file may be incompatible with %s target.", | |
3106 | wanted->printable_name, | |
3107 | target_architecture->printable_name); | |
3108 | } | |
3109 | } | |
3110 | ||
3111 | ||
cce74817 JM |
3112 | /* Misc helper functions for targets. */ |
3113 | ||
3114 | int | |
3115 | frame_num_args_unknown (fi) | |
3116 | struct frame_info *fi; | |
3117 | { | |
3118 | return -1; | |
3119 | } | |
3120 | ||
c906108c | 3121 | |
0f71a2f6 JM |
3122 | int |
3123 | generic_register_convertible_not (num) | |
3124 | int num; | |
3125 | { | |
3126 | return 0; | |
3127 | } | |
adf40b2e | 3128 | |
c906108c SS |
3129 | /* Disassembler */ |
3130 | ||
3131 | /* Pointer to the target-dependent disassembly function. */ | |
104c1213 | 3132 | int (*tm_print_insn) (bfd_vma, disassemble_info *); |
c906108c SS |
3133 | disassemble_info tm_print_insn_info; |
3134 | ||
3135 | ||
3136 | ||
3137 | /* Set the dynamic target-system-dependant parameters (architecture, | |
3138 | byte-order) using information found in the BFD */ | |
3139 | ||
3140 | void | |
3141 | set_gdbarch_from_file (abfd) | |
3142 | bfd *abfd; | |
3143 | { | |
0f71a2f6 JM |
3144 | if (GDB_MULTI_ARCH) |
3145 | { | |
3146 | struct gdbarch_info info; | |
3147 | memset (&info, 0, sizeof info); | |
3148 | info.abfd = abfd; | |
3149 | gdbarch_update (info); | |
3150 | return; | |
3151 | } | |
c906108c SS |
3152 | set_architecture_from_file (abfd); |
3153 | set_endian_from_file (abfd); | |
3154 | } | |
3155 | ||
3156 | ||
7a292a7a SS |
3157 | #if defined (CALL_DUMMY) |
3158 | /* FIXME - this should go away */ | |
3159 | LONGEST call_dummy_words[] = CALL_DUMMY; | |
3160 | int sizeof_call_dummy_words = sizeof (call_dummy_words); | |
3161 | #endif | |
3162 | ||
3163 | ||
104c1213 | 3164 | extern void _initialize_gdbarch (void); |
c906108c SS |
3165 | void |
3166 | _initialize_gdbarch () | |
3167 | { | |
3168 | add_prefix_cmd ("endian", class_support, set_endian, | |
3169 | "Set endianness of target.", | |
3170 | &endianlist, "set endian ", 0, &setlist); | |
3171 | add_cmd ("big", class_support, set_endian_big, | |
3172 | "Set target as being big endian.", &endianlist); | |
3173 | add_cmd ("little", class_support, set_endian_little, | |
3174 | "Set target as being little endian.", &endianlist); | |
3175 | add_cmd ("auto", class_support, set_endian_auto, | |
3176 | "Select target endianness automatically.", &endianlist); | |
3177 | add_cmd ("endian", class_support, show_endian, | |
3178 | "Show endianness of target.", &showlist); | |
3179 | ||
3180 | add_cmd ("architecture", class_support, set_architecture, | |
3181 | "Set architecture of target.", &setlist); | |
3182 | add_alias_cmd ("processor", "architecture", class_support, 1, &setlist); | |
3183 | add_cmd ("architecture", class_support, show_architecture, | |
3184 | "Show architecture of target.", &showlist); | |
3185 | add_cmd ("architecture", class_support, info_architecture, | |
3186 | "List supported target architectures", &infolist); | |
3187 | ||
adf40b2e | 3188 | INIT_DISASSEMBLE_INFO_NO_ARCH (tm_print_insn_info, gdb_stdout, (fprintf_ftype)fprintf_filtered); |
c906108c SS |
3189 | tm_print_insn_info.flavour = bfd_target_unknown_flavour; |
3190 | tm_print_insn_info.read_memory_func = dis_asm_read_memory; | |
3191 | tm_print_insn_info.memory_error_func = dis_asm_memory_error; | |
3192 | tm_print_insn_info.print_address_func = dis_asm_print_address; | |
3193 | ||
c906108c SS |
3194 | add_show_from_set (add_set_cmd ("archdebug", |
3195 | class_maintenance, | |
3196 | var_zinteger, | |
adf40b2e | 3197 | (char *)&gdbarch_debug, |
c906108c SS |
3198 | "Set architecture debugging.\n\ |
3199 | When non-zero, architecture debugging is enabled.", &setlist), | |
3200 | &showlist); | |
c906108c | 3201 | } |