198944Sobrien/* Dynamic architecture support for GDB, the GNU debugger. 298944Sobrien 3130803Smarcel Copyright 1998, 1999, 2000, 2002, 2003 Free Software Foundation, 4130803Smarcel Inc. 5130803Smarcel 698944Sobrien This file is part of GDB. 798944Sobrien 898944Sobrien This program is free software; you can redistribute it and/or modify 998944Sobrien it under the terms of the GNU General Public License as published by 1098944Sobrien the Free Software Foundation; either version 2 of the License, or 1198944Sobrien (at your option) any later version. 1298944Sobrien 1398944Sobrien This program is distributed in the hope that it will be useful, 1498944Sobrien but WITHOUT ANY WARRANTY; without even the implied warranty of 1598944Sobrien MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1698944Sobrien GNU General Public License for more details. 1798944Sobrien 1898944Sobrien You should have received a copy of the GNU General Public License 1998944Sobrien along with this program; if not, write to the Free Software 2098944Sobrien Foundation, Inc., 59 Temple Place - Suite 330, 2198944Sobrien Boston, MA 02111-1307, USA. */ 2298944Sobrien 2398944Sobrien#ifndef GDBARCH_UTILS_H 2498944Sobrien#define GDBARCH_UTILS_H 2598944Sobrien 26130803Smarcelstruct gdbarch; 27130803Smarcelstruct frame_info; 28130803Smarcelstruct minimal_symbol; 29130803Smarcelstruct type; 30130803Smarcelstruct gdbarch_info; 31130803Smarcel 3298944Sobrien/* gdbarch trace variable */ 3398944Sobrienextern int gdbarch_debug; 3498944Sobrien 35130803Smarcel/* Implementation of extract return value that grubs around in the 36130803Smarcel register cache. */ 37130803Smarcelextern gdbarch_extract_return_value_ftype legacy_extract_return_value; 3898944Sobrien 39130803Smarcel/* Implementation of store return value that grubs the register cache. */ 40130803Smarcelextern gdbarch_store_return_value_ftype legacy_store_return_value; 4198944Sobrien 42130803Smarcel/* To return any structure or union type by value, store it at the 43130803Smarcel address passed as an invisible first argument to the function. */ 44130803Smarcelextern gdbarch_use_struct_convention_ftype always_use_struct_convention; 4598944Sobrien 4698944Sobrien/* Only structures, unions, and arrays are returned using the struct 4798944Sobrien convention. Note that arrays are never passed by value in the C 4898944Sobrien language family, so that case is irrelevant for C. */ 4998944Sobrienextern gdbarch_return_value_on_stack_ftype generic_return_value_on_stack_not; 5098944Sobrien 5198944Sobrien/* Backward compatible call_dummy_words. */ 5298944Sobrienextern LONGEST legacy_call_dummy_words[]; 5398944Sobrienextern int legacy_sizeof_call_dummy_words; 5498944Sobrien 5598944Sobrien/* Typical remote_translate_xfer_address */ 5698944Sobrienextern gdbarch_remote_translate_xfer_address_ftype generic_remote_translate_xfer_address; 5798944Sobrien 5898944Sobrien/* The only possible cases for inner_than. */ 5998944Sobrienextern int core_addr_lessthan (CORE_ADDR lhs, CORE_ADDR rhs); 6098944Sobrienextern int core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs); 6198944Sobrien 6298944Sobrien/* Floating point values. */ 6398944Sobrienextern const struct floatformat *default_float_format (struct gdbarch *gdbarch); 6498944Sobrienextern const struct floatformat *default_double_format (struct gdbarch *gdbarch); 6598944Sobrien 66130803Smarcel/* Identity functions on a CORE_ADDR. Just return the "addr". */ 6798944Sobrien 6898944Sobrienextern CORE_ADDR core_addr_identity (CORE_ADDR addr); 69130803Smarcelextern gdbarch_convert_from_func_ptr_addr_ftype convert_from_func_ptr_addr_identity; 7098944Sobrien 7198944Sobrien/* No-op conversion of reg to regnum. */ 7298944Sobrien 7398944Sobrienextern int no_op_reg_to_regnum (int reg); 7498944Sobrien 7598944Sobrien/* Versions of init_frame_pc(). Do nothing; do the default. */ 7698944Sobrien 77130803Smarcelextern CORE_ADDR deprecated_init_frame_pc_default (int fromleaf, struct frame_info *prev); 7898944Sobrien 7998944Sobrien/* Do nothing version of elf_make_msymbol_special. */ 8098944Sobrien 8198944Sobrienvoid default_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym); 8298944Sobrien 8398944Sobrien/* Do nothing version of coff_make_msymbol_special. */ 8498944Sobrien 8598944Sobrienvoid default_coff_make_msymbol_special (int val, struct minimal_symbol *msym); 8698944Sobrien 8798944Sobrien/* Version of cannot_fetch_register() / cannot_store_register() that 8898944Sobrien always fails. */ 8998944Sobrien 9098944Sobrienint cannot_register_not (int regnum); 9198944Sobrien 9298944Sobrien/* Legacy version of target_virtual_frame_pointer(). Assumes that 93130803Smarcel there is an DEPRECATED_FP_REGNUM and that it is the same, cooked or 94130803Smarcel raw. */ 9598944Sobrien 9698944Sobrienextern gdbarch_virtual_frame_pointer_ftype legacy_virtual_frame_pointer; 9798944Sobrien 9898944Sobrienextern CORE_ADDR generic_skip_trampoline_code (CORE_ADDR pc); 9998944Sobrien 100130803Smarcelextern CORE_ADDR generic_skip_solib_resolver (struct gdbarch *gdbarch, 101130803Smarcel CORE_ADDR pc); 102130803Smarcel 10398944Sobrienextern int generic_in_solib_call_trampoline (CORE_ADDR pc, char *name); 10498944Sobrien 105130803Smarcelextern int generic_in_solib_return_trampoline (CORE_ADDR pc, char *name); 106130803Smarcel 10798944Sobrienextern int generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc); 10898944Sobrien 109130803Smarcel/* Assume that the world is sane, a registers raw and virtual size 110130803Smarcel both match its type. */ 11198944Sobrien 112130803Smarcelextern int generic_register_size (int regnum); 11398944Sobrien 114130803Smarcel/* Assume that the world is sane, the registers are all adjacent. */ 115130803Smarcelextern int generic_register_byte (int regnum); 11698944Sobrien 117130803Smarcel/* Prop up old targets that use various IN_SIGTRAMP() macros. */ 118130803Smarcelextern int legacy_pc_in_sigtramp (CORE_ADDR pc, char *name); 11998944Sobrien 120130803Smarcel/* The orginal register_convert*() functions were overloaded. They 121130803Smarcel were used to both: convert between virtual and raw register formats 122130803Smarcel (something that is discouraged); and to convert a register to the 123130803Smarcel type of a corresponding variable. These legacy functions preserve 124130803Smarcel that overloaded behavour in existing targets. */ 125130803Smarcelextern int legacy_convert_register_p (int regnum, struct type *type); 126130803Smarcelextern void legacy_register_to_value (struct frame_info *frame, int regnum, 127130803Smarcel struct type *type, void *to); 128130803Smarcelextern void legacy_value_to_register (struct frame_info *frame, int regnum, 129130803Smarcel struct type *type, const void *from); 130130803Smarcel 131130803Smarcelextern int default_stabs_argument_has_addr (struct gdbarch *gdbarch, 132130803Smarcel struct type *type); 133130803Smarcel 134130803Smarcel/* For compatibility with older architectures, returns 135130803Smarcel (LEGACY_SIM_REGNO_IGNORE) when the register doesn't have a valid 136130803Smarcel name. */ 137130803Smarcel 138130803Smarcelextern int legacy_register_sim_regno (int regnum); 139130803Smarcel 140130803Smarcel/* Return the selected byte order, or BFD_ENDIAN_UNKNOWN if no byte 141130803Smarcel order was explicitly selected. */ 142130803Smarcelextern enum bfd_endian selected_byte_order (void); 143130803Smarcel 144130803Smarcel/* Return the selected architecture's name, or NULL if no architecture 145130803Smarcel was explicitly selected. */ 146130803Smarcelextern const char *selected_architecture_name (void); 147130803Smarcel 14898944Sobrien/* Initialize a ``struct info''. Can't use memset(0) since some 149130803Smarcel default values are not zero. "fill" takes all available 150130803Smarcel information and fills in any unspecified fields. */ 151130803Smarcel 15298944Sobrienextern void gdbarch_info_init (struct gdbarch_info *info); 153130803Smarcelextern void gdbarch_info_fill (struct gdbarch *gdbarch, 154130803Smarcel struct gdbarch_info *info); 15598944Sobrien 156130803Smarcel/* Similar to init, but this time fill in the blanks. Information is 157130803Smarcel obtained from the specified architecture, global "set ..." options, 158130803Smarcel and explicitly initialized INFO fields. */ 159130803Smarcelextern void gdbarch_info_fill (struct gdbarch *gdbarch, 160130803Smarcel struct gdbarch_info *info); 161130803Smarcel 162130803Smarcel/* Return the architecture for ABFD. If no suitable architecture 163130803Smarcel could be find, return NULL. */ 164130803Smarcel 165130803Smarcelextern struct gdbarch *gdbarch_from_bfd (bfd *abfd); 166130803Smarcel 16798944Sobrien#endif 168