xref: /dflybsd-src/contrib/gdb-7/gdb/gdbarch.h (revision de8e141f24382815c10a4012d209bbbf7abf1112)
1*ef5ccd6cSJohn Marino /* *INDENT-OFF* */ /* THIS FILE IS GENERATED -*- buffer-read-only: t -*- */
2*ef5ccd6cSJohn Marino /* vi:set ro: */
35796c8dcSSimon Schubert 
45796c8dcSSimon Schubert /* Dynamic architecture support for GDB, the GNU debugger.
55796c8dcSSimon Schubert 
6*ef5ccd6cSJohn Marino    Copyright (C) 1998-2013 Free Software Foundation, Inc.
75796c8dcSSimon Schubert 
85796c8dcSSimon Schubert    This file is part of GDB.
95796c8dcSSimon Schubert 
105796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
115796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
125796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
135796c8dcSSimon Schubert    (at your option) any later version.
145796c8dcSSimon Schubert 
155796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
165796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
175796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
185796c8dcSSimon Schubert    GNU General Public License for more details.
195796c8dcSSimon Schubert 
205796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
215796c8dcSSimon Schubert    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
225796c8dcSSimon Schubert 
235796c8dcSSimon Schubert /* This file was created with the aid of ``gdbarch.sh''.
245796c8dcSSimon Schubert 
255796c8dcSSimon Schubert    The Bourne shell script ``gdbarch.sh'' creates the files
265796c8dcSSimon Schubert    ``new-gdbarch.c'' and ``new-gdbarch.h and then compares them
275796c8dcSSimon Schubert    against the existing ``gdbarch.[hc]''.  Any differences found
285796c8dcSSimon Schubert    being reported.
295796c8dcSSimon Schubert 
305796c8dcSSimon Schubert    If editing this file, please also run gdbarch.sh and merge any
315796c8dcSSimon Schubert    changes into that script. Conversely, when making sweeping changes
325796c8dcSSimon Schubert    to this file, modifying gdbarch.sh and using its output may prove
335796c8dcSSimon Schubert    easier.  */
345796c8dcSSimon Schubert 
355796c8dcSSimon Schubert #ifndef GDBARCH_H
365796c8dcSSimon Schubert #define GDBARCH_H
375796c8dcSSimon Schubert 
385796c8dcSSimon Schubert struct floatformat;
395796c8dcSSimon Schubert struct ui_file;
405796c8dcSSimon Schubert struct frame_info;
415796c8dcSSimon Schubert struct value;
425796c8dcSSimon Schubert struct objfile;
435796c8dcSSimon Schubert struct obj_section;
445796c8dcSSimon Schubert struct minimal_symbol;
455796c8dcSSimon Schubert struct regcache;
465796c8dcSSimon Schubert struct reggroup;
475796c8dcSSimon Schubert struct regset;
485796c8dcSSimon Schubert struct disassemble_info;
495796c8dcSSimon Schubert struct target_ops;
505796c8dcSSimon Schubert struct obstack;
515796c8dcSSimon Schubert struct bp_target_info;
525796c8dcSSimon Schubert struct target_desc;
535796c8dcSSimon Schubert struct displaced_step_closure;
545796c8dcSSimon Schubert struct core_regset_section;
555796c8dcSSimon Schubert struct syscall;
56c50c785cSJohn Marino struct agent_expr;
57a45ae5f8SJohn Marino struct axs_value;
58*ef5ccd6cSJohn Marino struct stap_parse_info;
59*ef5ccd6cSJohn Marino struct ravenscar_arch_ops;
60*ef5ccd6cSJohn Marino struct elf_internal_linux_prpsinfo;
615796c8dcSSimon Schubert 
62*ef5ccd6cSJohn Marino /* The architecture associated with the inferior through the
63*ef5ccd6cSJohn Marino    connection to the target.
645796c8dcSSimon Schubert 
65*ef5ccd6cSJohn Marino    The architecture vector provides some information that is really a
66*ef5ccd6cSJohn Marino    property of the inferior, accessed through a particular target:
67*ef5ccd6cSJohn Marino    ptrace operations; the layout of certain RSP packets; the solib_ops
68*ef5ccd6cSJohn Marino    vector; etc.  To differentiate architecture accesses to
69*ef5ccd6cSJohn Marino    per-inferior/target properties from
70*ef5ccd6cSJohn Marino    per-thread/per-frame/per-objfile properties, accesses to
71*ef5ccd6cSJohn Marino    per-inferior/target properties should be made through this
72*ef5ccd6cSJohn Marino    gdbarch.  */
735796c8dcSSimon Schubert 
74*ef5ccd6cSJohn Marino /* This is a convenience wrapper for 'current_inferior ()->gdbarch'.  */
75*ef5ccd6cSJohn Marino extern struct gdbarch *target_gdbarch (void);
76*ef5ccd6cSJohn Marino 
77*ef5ccd6cSJohn Marino /* The initial, default architecture.  It uses host values (for want of a better
78*ef5ccd6cSJohn Marino    choice).  */
79*ef5ccd6cSJohn Marino extern struct gdbarch startup_gdbarch;
80*ef5ccd6cSJohn Marino 
81*ef5ccd6cSJohn Marino 
82*ef5ccd6cSJohn Marino /* Callback type for the 'iterate_over_objfiles_in_search_order'
83*ef5ccd6cSJohn Marino    gdbarch  method.  */
84*ef5ccd6cSJohn Marino 
85*ef5ccd6cSJohn Marino typedef int (iterate_over_objfiles_in_search_order_cb_ftype)
86*ef5ccd6cSJohn Marino   (struct objfile *objfile, void *cb_data);
875796c8dcSSimon Schubert 
885796c8dcSSimon Schubert 
895796c8dcSSimon Schubert /* The following are pre-initialized by GDBARCH.  */
905796c8dcSSimon Schubert 
915796c8dcSSimon Schubert extern const struct bfd_arch_info * gdbarch_bfd_arch_info (struct gdbarch *gdbarch);
925796c8dcSSimon Schubert /* set_gdbarch_bfd_arch_info() - not applicable - pre-initialized.  */
935796c8dcSSimon Schubert 
945796c8dcSSimon Schubert extern int gdbarch_byte_order (struct gdbarch *gdbarch);
955796c8dcSSimon Schubert /* set_gdbarch_byte_order() - not applicable - pre-initialized.  */
965796c8dcSSimon Schubert 
975796c8dcSSimon Schubert extern int gdbarch_byte_order_for_code (struct gdbarch *gdbarch);
985796c8dcSSimon Schubert /* set_gdbarch_byte_order_for_code() - not applicable - pre-initialized.  */
995796c8dcSSimon Schubert 
1005796c8dcSSimon Schubert extern enum gdb_osabi gdbarch_osabi (struct gdbarch *gdbarch);
1015796c8dcSSimon Schubert /* set_gdbarch_osabi() - not applicable - pre-initialized.  */
1025796c8dcSSimon Schubert 
1035796c8dcSSimon Schubert extern const struct target_desc * gdbarch_target_desc (struct gdbarch *gdbarch);
1045796c8dcSSimon Schubert /* set_gdbarch_target_desc() - not applicable - pre-initialized.  */
1055796c8dcSSimon Schubert 
1065796c8dcSSimon Schubert 
1075796c8dcSSimon Schubert /* The following are initialized by the target dependent code.  */
1085796c8dcSSimon Schubert 
1095796c8dcSSimon Schubert /* The bit byte-order has to do just with numbering of bits in debugging symbols
1105796c8dcSSimon Schubert    and such.  Conceptually, it's quite separate from byte/word byte order. */
1115796c8dcSSimon Schubert 
1125796c8dcSSimon Schubert extern int gdbarch_bits_big_endian (struct gdbarch *gdbarch);
1135796c8dcSSimon Schubert extern void set_gdbarch_bits_big_endian (struct gdbarch *gdbarch, int bits_big_endian);
1145796c8dcSSimon Schubert 
1155796c8dcSSimon Schubert /* Number of bits in a char or unsigned char for the target machine.
1165796c8dcSSimon Schubert    Just like CHAR_BIT in <limits.h> but describes the target machine.
1175796c8dcSSimon Schubert    v:TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):8::0:
1185796c8dcSSimon Schubert 
1195796c8dcSSimon Schubert    Number of bits in a short or unsigned short for the target machine. */
1205796c8dcSSimon Schubert 
1215796c8dcSSimon Schubert extern int gdbarch_short_bit (struct gdbarch *gdbarch);
1225796c8dcSSimon Schubert extern void set_gdbarch_short_bit (struct gdbarch *gdbarch, int short_bit);
1235796c8dcSSimon Schubert 
1245796c8dcSSimon Schubert /* Number of bits in an int or unsigned int for the target machine. */
1255796c8dcSSimon Schubert 
1265796c8dcSSimon Schubert extern int gdbarch_int_bit (struct gdbarch *gdbarch);
1275796c8dcSSimon Schubert extern void set_gdbarch_int_bit (struct gdbarch *gdbarch, int int_bit);
1285796c8dcSSimon Schubert 
1295796c8dcSSimon Schubert /* Number of bits in a long or unsigned long for the target machine. */
1305796c8dcSSimon Schubert 
1315796c8dcSSimon Schubert extern int gdbarch_long_bit (struct gdbarch *gdbarch);
1325796c8dcSSimon Schubert extern void set_gdbarch_long_bit (struct gdbarch *gdbarch, int long_bit);
1335796c8dcSSimon Schubert 
1345796c8dcSSimon Schubert /* Number of bits in a long long or unsigned long long for the target
1355796c8dcSSimon Schubert    machine. */
1365796c8dcSSimon Schubert 
1375796c8dcSSimon Schubert extern int gdbarch_long_long_bit (struct gdbarch *gdbarch);
1385796c8dcSSimon Schubert extern void set_gdbarch_long_long_bit (struct gdbarch *gdbarch, int long_long_bit);
1395796c8dcSSimon Schubert 
140a45ae5f8SJohn Marino /* Alignment of a long long or unsigned long long for the target
141a45ae5f8SJohn Marino    machine. */
142a45ae5f8SJohn Marino 
143a45ae5f8SJohn Marino extern int gdbarch_long_long_align_bit (struct gdbarch *gdbarch);
144a45ae5f8SJohn Marino extern void set_gdbarch_long_long_align_bit (struct gdbarch *gdbarch, int long_long_align_bit);
145a45ae5f8SJohn Marino 
146cf7f2e2dSJohn Marino /* The ABI default bit-size and format for "half", "float", "double", and
147cf7f2e2dSJohn Marino    "long double".  These bit/format pairs should eventually be combined
148cf7f2e2dSJohn Marino    into a single object.  For the moment, just initialize them as a pair.
1495796c8dcSSimon Schubert    Each format describes both the big and little endian layouts (if
1505796c8dcSSimon Schubert    useful). */
1515796c8dcSSimon Schubert 
152cf7f2e2dSJohn Marino extern int gdbarch_half_bit (struct gdbarch *gdbarch);
153cf7f2e2dSJohn Marino extern void set_gdbarch_half_bit (struct gdbarch *gdbarch, int half_bit);
154cf7f2e2dSJohn Marino 
155cf7f2e2dSJohn Marino extern const struct floatformat ** gdbarch_half_format (struct gdbarch *gdbarch);
156cf7f2e2dSJohn Marino extern void set_gdbarch_half_format (struct gdbarch *gdbarch, const struct floatformat ** half_format);
157cf7f2e2dSJohn Marino 
1585796c8dcSSimon Schubert extern int gdbarch_float_bit (struct gdbarch *gdbarch);
1595796c8dcSSimon Schubert extern void set_gdbarch_float_bit (struct gdbarch *gdbarch, int float_bit);
1605796c8dcSSimon Schubert 
1615796c8dcSSimon Schubert extern const struct floatformat ** gdbarch_float_format (struct gdbarch *gdbarch);
1625796c8dcSSimon Schubert extern void set_gdbarch_float_format (struct gdbarch *gdbarch, const struct floatformat ** float_format);
1635796c8dcSSimon Schubert 
1645796c8dcSSimon Schubert extern int gdbarch_double_bit (struct gdbarch *gdbarch);
1655796c8dcSSimon Schubert extern void set_gdbarch_double_bit (struct gdbarch *gdbarch, int double_bit);
1665796c8dcSSimon Schubert 
1675796c8dcSSimon Schubert extern const struct floatformat ** gdbarch_double_format (struct gdbarch *gdbarch);
1685796c8dcSSimon Schubert extern void set_gdbarch_double_format (struct gdbarch *gdbarch, const struct floatformat ** double_format);
1695796c8dcSSimon Schubert 
1705796c8dcSSimon Schubert extern int gdbarch_long_double_bit (struct gdbarch *gdbarch);
1715796c8dcSSimon Schubert extern void set_gdbarch_long_double_bit (struct gdbarch *gdbarch, int long_double_bit);
1725796c8dcSSimon Schubert 
1735796c8dcSSimon Schubert extern const struct floatformat ** gdbarch_long_double_format (struct gdbarch *gdbarch);
1745796c8dcSSimon Schubert extern void set_gdbarch_long_double_format (struct gdbarch *gdbarch, const struct floatformat ** long_double_format);
1755796c8dcSSimon Schubert 
1765796c8dcSSimon Schubert /* For most targets, a pointer on the target and its representation as an
1775796c8dcSSimon Schubert    address in GDB have the same size and "look the same".  For such a
1785796c8dcSSimon Schubert    target, you need only set gdbarch_ptr_bit and gdbarch_addr_bit
1795796c8dcSSimon Schubert    / addr_bit will be set from it.
1805796c8dcSSimon Schubert 
1815796c8dcSSimon Schubert    If gdbarch_ptr_bit and gdbarch_addr_bit are different, you'll probably
182c50c785cSJohn Marino    also need to set gdbarch_dwarf2_addr_size, gdbarch_pointer_to_address and
183c50c785cSJohn Marino    gdbarch_address_to_pointer as well.
1845796c8dcSSimon Schubert 
1855796c8dcSSimon Schubert    ptr_bit is the size of a pointer on the target */
1865796c8dcSSimon Schubert 
1875796c8dcSSimon Schubert extern int gdbarch_ptr_bit (struct gdbarch *gdbarch);
1885796c8dcSSimon Schubert extern void set_gdbarch_ptr_bit (struct gdbarch *gdbarch, int ptr_bit);
1895796c8dcSSimon Schubert 
1905796c8dcSSimon Schubert /* addr_bit is the size of a target address as represented in gdb */
1915796c8dcSSimon Schubert 
1925796c8dcSSimon Schubert extern int gdbarch_addr_bit (struct gdbarch *gdbarch);
1935796c8dcSSimon Schubert extern void set_gdbarch_addr_bit (struct gdbarch *gdbarch, int addr_bit);
1945796c8dcSSimon Schubert 
195c50c785cSJohn Marino /* dwarf2_addr_size is the target address size as used in the Dwarf debug
196c50c785cSJohn Marino    info.  For .debug_frame FDEs, this is supposed to be the target address
197c50c785cSJohn Marino    size from the associated CU header, and which is equivalent to the
198c50c785cSJohn Marino    DWARF2_ADDR_SIZE as defined by the target specific GCC back-end.
199c50c785cSJohn Marino    Unfortunately there is no good way to determine this value.  Therefore
200c50c785cSJohn Marino    dwarf2_addr_size simply defaults to the target pointer size.
201c50c785cSJohn Marino 
202c50c785cSJohn Marino    dwarf2_addr_size is not used for .eh_frame FDEs, which are generally
203c50c785cSJohn Marino    defined using the target's pointer size so far.
204c50c785cSJohn Marino 
205c50c785cSJohn Marino    Note that dwarf2_addr_size only needs to be redefined by a target if the
206c50c785cSJohn Marino    GCC back-end defines a DWARF2_ADDR_SIZE other than the target pointer size,
207c50c785cSJohn Marino    and if Dwarf versions < 4 need to be supported. */
208c50c785cSJohn Marino 
209c50c785cSJohn Marino extern int gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch);
210c50c785cSJohn Marino extern void set_gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch, int dwarf2_addr_size);
211c50c785cSJohn Marino 
2125796c8dcSSimon Schubert /* One if `char' acts like `signed char', zero if `unsigned char'. */
2135796c8dcSSimon Schubert 
2145796c8dcSSimon Schubert extern int gdbarch_char_signed (struct gdbarch *gdbarch);
2155796c8dcSSimon Schubert extern void set_gdbarch_char_signed (struct gdbarch *gdbarch, int char_signed);
2165796c8dcSSimon Schubert 
2175796c8dcSSimon Schubert extern int gdbarch_read_pc_p (struct gdbarch *gdbarch);
2185796c8dcSSimon Schubert 
2195796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_read_pc_ftype) (struct regcache *regcache);
2205796c8dcSSimon Schubert extern CORE_ADDR gdbarch_read_pc (struct gdbarch *gdbarch, struct regcache *regcache);
2215796c8dcSSimon Schubert extern void set_gdbarch_read_pc (struct gdbarch *gdbarch, gdbarch_read_pc_ftype *read_pc);
2225796c8dcSSimon Schubert 
2235796c8dcSSimon Schubert extern int gdbarch_write_pc_p (struct gdbarch *gdbarch);
2245796c8dcSSimon Schubert 
2255796c8dcSSimon Schubert typedef void (gdbarch_write_pc_ftype) (struct regcache *regcache, CORE_ADDR val);
2265796c8dcSSimon Schubert extern void gdbarch_write_pc (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR val);
2275796c8dcSSimon Schubert extern void set_gdbarch_write_pc (struct gdbarch *gdbarch, gdbarch_write_pc_ftype *write_pc);
2285796c8dcSSimon Schubert 
2295796c8dcSSimon Schubert /* Function for getting target's idea of a frame pointer.  FIXME: GDB's
2305796c8dcSSimon Schubert    whole scheme for dealing with "frames" and "frame pointers" needs a
2315796c8dcSSimon Schubert    serious shakedown. */
2325796c8dcSSimon Schubert 
2335796c8dcSSimon Schubert typedef void (gdbarch_virtual_frame_pointer_ftype) (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset);
2345796c8dcSSimon Schubert extern void gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset);
2355796c8dcSSimon Schubert extern void set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer);
2365796c8dcSSimon Schubert 
2375796c8dcSSimon Schubert extern int gdbarch_pseudo_register_read_p (struct gdbarch *gdbarch);
2385796c8dcSSimon Schubert 
239c50c785cSJohn Marino typedef enum register_status (gdbarch_pseudo_register_read_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, gdb_byte *buf);
240c50c785cSJohn Marino extern enum register_status gdbarch_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, gdb_byte *buf);
2415796c8dcSSimon Schubert extern void set_gdbarch_pseudo_register_read (struct gdbarch *gdbarch, gdbarch_pseudo_register_read_ftype *pseudo_register_read);
2425796c8dcSSimon Schubert 
243a45ae5f8SJohn Marino /* Read a register into a new struct value.  If the register is wholly
244a45ae5f8SJohn Marino    or partly unavailable, this should call mark_value_bytes_unavailable
245a45ae5f8SJohn Marino    as appropriate.  If this is defined, then pseudo_register_read will
246a45ae5f8SJohn Marino    never be called. */
247a45ae5f8SJohn Marino 
248a45ae5f8SJohn Marino extern int gdbarch_pseudo_register_read_value_p (struct gdbarch *gdbarch);
249a45ae5f8SJohn Marino 
250a45ae5f8SJohn Marino typedef struct value * (gdbarch_pseudo_register_read_value_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum);
251a45ae5f8SJohn Marino extern struct value * gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum);
252a45ae5f8SJohn Marino extern void set_gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, gdbarch_pseudo_register_read_value_ftype *pseudo_register_read_value);
253a45ae5f8SJohn Marino 
2545796c8dcSSimon Schubert extern int gdbarch_pseudo_register_write_p (struct gdbarch *gdbarch);
2555796c8dcSSimon Schubert 
2565796c8dcSSimon Schubert typedef void (gdbarch_pseudo_register_write_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const gdb_byte *buf);
2575796c8dcSSimon Schubert extern void gdbarch_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const gdb_byte *buf);
2585796c8dcSSimon Schubert extern void set_gdbarch_pseudo_register_write (struct gdbarch *gdbarch, gdbarch_pseudo_register_write_ftype *pseudo_register_write);
2595796c8dcSSimon Schubert 
2605796c8dcSSimon Schubert extern int gdbarch_num_regs (struct gdbarch *gdbarch);
2615796c8dcSSimon Schubert extern void set_gdbarch_num_regs (struct gdbarch *gdbarch, int num_regs);
2625796c8dcSSimon Schubert 
2635796c8dcSSimon Schubert /* This macro gives the number of pseudo-registers that live in the
2645796c8dcSSimon Schubert    register namespace but do not get fetched or stored on the target.
2655796c8dcSSimon Schubert    These pseudo-registers may be aliases for other registers,
2665796c8dcSSimon Schubert    combinations of other registers, or they may be computed by GDB. */
2675796c8dcSSimon Schubert 
2685796c8dcSSimon Schubert extern int gdbarch_num_pseudo_regs (struct gdbarch *gdbarch);
2695796c8dcSSimon Schubert extern void set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch, int num_pseudo_regs);
2705796c8dcSSimon Schubert 
271c50c785cSJohn Marino /* Assemble agent expression bytecode to collect pseudo-register REG.
272c50c785cSJohn Marino    Return -1 if something goes wrong, 0 otherwise. */
273c50c785cSJohn Marino 
274c50c785cSJohn Marino extern int gdbarch_ax_pseudo_register_collect_p (struct gdbarch *gdbarch);
275c50c785cSJohn Marino 
276c50c785cSJohn Marino typedef int (gdbarch_ax_pseudo_register_collect_ftype) (struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
277c50c785cSJohn Marino extern int gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
278c50c785cSJohn Marino extern void set_gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch, gdbarch_ax_pseudo_register_collect_ftype *ax_pseudo_register_collect);
279c50c785cSJohn Marino 
280c50c785cSJohn Marino /* Assemble agent expression bytecode to push the value of pseudo-register
281c50c785cSJohn Marino    REG on the interpreter stack.
282c50c785cSJohn Marino    Return -1 if something goes wrong, 0 otherwise. */
283c50c785cSJohn Marino 
284c50c785cSJohn Marino extern int gdbarch_ax_pseudo_register_push_stack_p (struct gdbarch *gdbarch);
285c50c785cSJohn Marino 
286c50c785cSJohn Marino typedef int (gdbarch_ax_pseudo_register_push_stack_ftype) (struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
287c50c785cSJohn Marino extern int gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
288c50c785cSJohn Marino extern void set_gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, gdbarch_ax_pseudo_register_push_stack_ftype *ax_pseudo_register_push_stack);
289c50c785cSJohn Marino 
2905796c8dcSSimon Schubert /* GDB's standard (or well known) register numbers.  These can map onto
2915796c8dcSSimon Schubert    a real register or a pseudo (computed) register or not be defined at
2925796c8dcSSimon Schubert    all (-1).
2935796c8dcSSimon Schubert    gdbarch_sp_regnum will hopefully be replaced by UNWIND_SP. */
2945796c8dcSSimon Schubert 
2955796c8dcSSimon Schubert extern int gdbarch_sp_regnum (struct gdbarch *gdbarch);
2965796c8dcSSimon Schubert extern void set_gdbarch_sp_regnum (struct gdbarch *gdbarch, int sp_regnum);
2975796c8dcSSimon Schubert 
2985796c8dcSSimon Schubert extern int gdbarch_pc_regnum (struct gdbarch *gdbarch);
2995796c8dcSSimon Schubert extern void set_gdbarch_pc_regnum (struct gdbarch *gdbarch, int pc_regnum);
3005796c8dcSSimon Schubert 
3015796c8dcSSimon Schubert extern int gdbarch_ps_regnum (struct gdbarch *gdbarch);
3025796c8dcSSimon Schubert extern void set_gdbarch_ps_regnum (struct gdbarch *gdbarch, int ps_regnum);
3035796c8dcSSimon Schubert 
3045796c8dcSSimon Schubert extern int gdbarch_fp0_regnum (struct gdbarch *gdbarch);
3055796c8dcSSimon Schubert extern void set_gdbarch_fp0_regnum (struct gdbarch *gdbarch, int fp0_regnum);
3065796c8dcSSimon Schubert 
3075796c8dcSSimon Schubert /* Convert stab register number (from `r' declaration) to a gdb REGNUM. */
3085796c8dcSSimon Schubert 
3095796c8dcSSimon Schubert typedef int (gdbarch_stab_reg_to_regnum_ftype) (struct gdbarch *gdbarch, int stab_regnr);
3105796c8dcSSimon Schubert extern int gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, int stab_regnr);
3115796c8dcSSimon Schubert extern void set_gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum);
3125796c8dcSSimon Schubert 
3135796c8dcSSimon Schubert /* Provide a default mapping from a ecoff register number to a gdb REGNUM. */
3145796c8dcSSimon Schubert 
3155796c8dcSSimon Schubert typedef int (gdbarch_ecoff_reg_to_regnum_ftype) (struct gdbarch *gdbarch, int ecoff_regnr);
3165796c8dcSSimon Schubert extern int gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, int ecoff_regnr);
3175796c8dcSSimon Schubert extern void set_gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum);
3185796c8dcSSimon Schubert 
3195796c8dcSSimon Schubert /* Convert from an sdb register number to an internal gdb register number. */
3205796c8dcSSimon Schubert 
3215796c8dcSSimon Schubert typedef int (gdbarch_sdb_reg_to_regnum_ftype) (struct gdbarch *gdbarch, int sdb_regnr);
3225796c8dcSSimon Schubert extern int gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, int sdb_regnr);
3235796c8dcSSimon Schubert extern void set_gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum);
3245796c8dcSSimon Schubert 
3255796c8dcSSimon Schubert /* Provide a default mapping from a DWARF2 register number to a gdb REGNUM. */
3265796c8dcSSimon Schubert 
3275796c8dcSSimon Schubert typedef int (gdbarch_dwarf2_reg_to_regnum_ftype) (struct gdbarch *gdbarch, int dwarf2_regnr);
3285796c8dcSSimon Schubert extern int gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int dwarf2_regnr);
3295796c8dcSSimon Schubert extern void set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum);
3305796c8dcSSimon Schubert 
3315796c8dcSSimon Schubert typedef const char * (gdbarch_register_name_ftype) (struct gdbarch *gdbarch, int regnr);
3325796c8dcSSimon Schubert extern const char * gdbarch_register_name (struct gdbarch *gdbarch, int regnr);
3335796c8dcSSimon Schubert extern void set_gdbarch_register_name (struct gdbarch *gdbarch, gdbarch_register_name_ftype *register_name);
3345796c8dcSSimon Schubert 
3355796c8dcSSimon Schubert /* Return the type of a register specified by the architecture.  Only
3365796c8dcSSimon Schubert    the register cache should call this function directly; others should
3375796c8dcSSimon Schubert    use "register_type". */
3385796c8dcSSimon Schubert 
3395796c8dcSSimon Schubert extern int gdbarch_register_type_p (struct gdbarch *gdbarch);
3405796c8dcSSimon Schubert 
3415796c8dcSSimon Schubert typedef struct type * (gdbarch_register_type_ftype) (struct gdbarch *gdbarch, int reg_nr);
3425796c8dcSSimon Schubert extern struct type * gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr);
3435796c8dcSSimon Schubert extern void set_gdbarch_register_type (struct gdbarch *gdbarch, gdbarch_register_type_ftype *register_type);
3445796c8dcSSimon Schubert 
3455796c8dcSSimon Schubert /* See gdbint.texinfo, and PUSH_DUMMY_CALL. */
3465796c8dcSSimon Schubert 
3475796c8dcSSimon Schubert extern int gdbarch_dummy_id_p (struct gdbarch *gdbarch);
3485796c8dcSSimon Schubert 
3495796c8dcSSimon Schubert typedef struct frame_id (gdbarch_dummy_id_ftype) (struct gdbarch *gdbarch, struct frame_info *this_frame);
3505796c8dcSSimon Schubert extern struct frame_id gdbarch_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame);
3515796c8dcSSimon Schubert extern void set_gdbarch_dummy_id (struct gdbarch *gdbarch, gdbarch_dummy_id_ftype *dummy_id);
3525796c8dcSSimon Schubert 
3535796c8dcSSimon Schubert /* Implement DUMMY_ID and PUSH_DUMMY_CALL, then delete
3545796c8dcSSimon Schubert    deprecated_fp_regnum. */
3555796c8dcSSimon Schubert 
3565796c8dcSSimon Schubert extern int gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch);
3575796c8dcSSimon Schubert extern void set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch, int deprecated_fp_regnum);
3585796c8dcSSimon Schubert 
3595796c8dcSSimon Schubert /* See gdbint.texinfo.  See infcall.c. */
3605796c8dcSSimon Schubert 
3615796c8dcSSimon Schubert extern int gdbarch_push_dummy_call_p (struct gdbarch *gdbarch);
3625796c8dcSSimon Schubert 
3635796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_push_dummy_call_ftype) (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
3645796c8dcSSimon Schubert extern CORE_ADDR gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
3655796c8dcSSimon Schubert extern void set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype *push_dummy_call);
3665796c8dcSSimon Schubert 
3675796c8dcSSimon Schubert extern int gdbarch_call_dummy_location (struct gdbarch *gdbarch);
3685796c8dcSSimon Schubert extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, int call_dummy_location);
3695796c8dcSSimon Schubert 
3705796c8dcSSimon Schubert extern int gdbarch_push_dummy_code_p (struct gdbarch *gdbarch);
3715796c8dcSSimon Schubert 
3725796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_push_dummy_code_ftype) (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr, struct regcache *regcache);
3735796c8dcSSimon Schubert extern CORE_ADDR gdbarch_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr, struct regcache *regcache);
3745796c8dcSSimon Schubert extern void set_gdbarch_push_dummy_code (struct gdbarch *gdbarch, gdbarch_push_dummy_code_ftype *push_dummy_code);
3755796c8dcSSimon Schubert 
3765796c8dcSSimon Schubert typedef void (gdbarch_print_registers_info_ftype) (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, int regnum, int all);
3775796c8dcSSimon Schubert extern void gdbarch_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, int regnum, int all);
3785796c8dcSSimon Schubert extern void set_gdbarch_print_registers_info (struct gdbarch *gdbarch, gdbarch_print_registers_info_ftype *print_registers_info);
3795796c8dcSSimon Schubert 
3805796c8dcSSimon Schubert extern int gdbarch_print_float_info_p (struct gdbarch *gdbarch);
3815796c8dcSSimon Schubert 
3825796c8dcSSimon Schubert typedef void (gdbarch_print_float_info_ftype) (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args);
3835796c8dcSSimon Schubert extern void gdbarch_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args);
3845796c8dcSSimon Schubert extern void set_gdbarch_print_float_info (struct gdbarch *gdbarch, gdbarch_print_float_info_ftype *print_float_info);
3855796c8dcSSimon Schubert 
3865796c8dcSSimon Schubert extern int gdbarch_print_vector_info_p (struct gdbarch *gdbarch);
3875796c8dcSSimon Schubert 
3885796c8dcSSimon Schubert typedef void (gdbarch_print_vector_info_ftype) (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args);
3895796c8dcSSimon Schubert extern void gdbarch_print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args);
3905796c8dcSSimon Schubert extern void set_gdbarch_print_vector_info (struct gdbarch *gdbarch, gdbarch_print_vector_info_ftype *print_vector_info);
3915796c8dcSSimon Schubert 
3925796c8dcSSimon Schubert /* MAP a GDB RAW register number onto a simulator register number.  See
3935796c8dcSSimon Schubert    also include/...-sim.h. */
3945796c8dcSSimon Schubert 
3955796c8dcSSimon Schubert typedef int (gdbarch_register_sim_regno_ftype) (struct gdbarch *gdbarch, int reg_nr);
3965796c8dcSSimon Schubert extern int gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr);
3975796c8dcSSimon Schubert extern void set_gdbarch_register_sim_regno (struct gdbarch *gdbarch, gdbarch_register_sim_regno_ftype *register_sim_regno);
3985796c8dcSSimon Schubert 
3995796c8dcSSimon Schubert typedef int (gdbarch_cannot_fetch_register_ftype) (struct gdbarch *gdbarch, int regnum);
4005796c8dcSSimon Schubert extern int gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, int regnum);
4015796c8dcSSimon Schubert extern void set_gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, gdbarch_cannot_fetch_register_ftype *cannot_fetch_register);
4025796c8dcSSimon Schubert 
4035796c8dcSSimon Schubert typedef int (gdbarch_cannot_store_register_ftype) (struct gdbarch *gdbarch, int regnum);
4045796c8dcSSimon Schubert extern int gdbarch_cannot_store_register (struct gdbarch *gdbarch, int regnum);
4055796c8dcSSimon Schubert extern void set_gdbarch_cannot_store_register (struct gdbarch *gdbarch, gdbarch_cannot_store_register_ftype *cannot_store_register);
4065796c8dcSSimon Schubert 
4075796c8dcSSimon Schubert /* setjmp/longjmp support. */
4085796c8dcSSimon Schubert 
4095796c8dcSSimon Schubert extern int gdbarch_get_longjmp_target_p (struct gdbarch *gdbarch);
4105796c8dcSSimon Schubert 
4115796c8dcSSimon Schubert typedef int (gdbarch_get_longjmp_target_ftype) (struct frame_info *frame, CORE_ADDR *pc);
4125796c8dcSSimon Schubert extern int gdbarch_get_longjmp_target (struct gdbarch *gdbarch, struct frame_info *frame, CORE_ADDR *pc);
4135796c8dcSSimon Schubert extern void set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch, gdbarch_get_longjmp_target_ftype *get_longjmp_target);
4145796c8dcSSimon Schubert 
4155796c8dcSSimon Schubert extern int gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch);
4165796c8dcSSimon Schubert extern void set_gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch, int believe_pcc_promotion);
4175796c8dcSSimon Schubert 
4185796c8dcSSimon Schubert typedef int (gdbarch_convert_register_p_ftype) (struct gdbarch *gdbarch, int regnum, struct type *type);
4195796c8dcSSimon Schubert extern int gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type);
4205796c8dcSSimon Schubert extern void set_gdbarch_convert_register_p (struct gdbarch *gdbarch, gdbarch_convert_register_p_ftype *convert_register_p);
4215796c8dcSSimon Schubert 
422c50c785cSJohn Marino typedef int (gdbarch_register_to_value_ftype) (struct frame_info *frame, int regnum, struct type *type, gdb_byte *buf, int *optimizedp, int *unavailablep);
423c50c785cSJohn Marino extern int gdbarch_register_to_value (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, gdb_byte *buf, int *optimizedp, int *unavailablep);
4245796c8dcSSimon Schubert extern void set_gdbarch_register_to_value (struct gdbarch *gdbarch, gdbarch_register_to_value_ftype *register_to_value);
4255796c8dcSSimon Schubert 
4265796c8dcSSimon Schubert typedef void (gdbarch_value_to_register_ftype) (struct frame_info *frame, int regnum, struct type *type, const gdb_byte *buf);
4275796c8dcSSimon Schubert extern void gdbarch_value_to_register (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, const gdb_byte *buf);
4285796c8dcSSimon Schubert extern void set_gdbarch_value_to_register (struct gdbarch *gdbarch, gdbarch_value_to_register_ftype *value_to_register);
4295796c8dcSSimon Schubert 
4305796c8dcSSimon Schubert /* Construct a value representing the contents of register REGNUM in
4315796c8dcSSimon Schubert    frame FRAME, interpreted as type TYPE.  The routine needs to
4325796c8dcSSimon Schubert    allocate and return a struct value with all value attributes
4335796c8dcSSimon Schubert    (but not the value contents) filled in. */
4345796c8dcSSimon Schubert 
4355796c8dcSSimon Schubert typedef struct value * (gdbarch_value_from_register_ftype) (struct type *type, int regnum, struct frame_info *frame);
4365796c8dcSSimon Schubert extern struct value * gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type, int regnum, struct frame_info *frame);
4375796c8dcSSimon Schubert extern void set_gdbarch_value_from_register (struct gdbarch *gdbarch, gdbarch_value_from_register_ftype *value_from_register);
4385796c8dcSSimon Schubert 
4395796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_pointer_to_address_ftype) (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
4405796c8dcSSimon Schubert extern CORE_ADDR gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
4415796c8dcSSimon Schubert extern void set_gdbarch_pointer_to_address (struct gdbarch *gdbarch, gdbarch_pointer_to_address_ftype *pointer_to_address);
4425796c8dcSSimon Schubert 
4435796c8dcSSimon Schubert typedef void (gdbarch_address_to_pointer_ftype) (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr);
4445796c8dcSSimon Schubert extern void gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr);
4455796c8dcSSimon Schubert extern void set_gdbarch_address_to_pointer (struct gdbarch *gdbarch, gdbarch_address_to_pointer_ftype *address_to_pointer);
4465796c8dcSSimon Schubert 
4475796c8dcSSimon Schubert extern int gdbarch_integer_to_address_p (struct gdbarch *gdbarch);
4485796c8dcSSimon Schubert 
4495796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_integer_to_address_ftype) (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
4505796c8dcSSimon Schubert extern CORE_ADDR gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
4515796c8dcSSimon Schubert extern void set_gdbarch_integer_to_address (struct gdbarch *gdbarch, gdbarch_integer_to_address_ftype *integer_to_address);
4525796c8dcSSimon Schubert 
453*ef5ccd6cSJohn Marino /* Return the return-value convention that will be used by FUNCTION
454*ef5ccd6cSJohn Marino    to return a value of type VALTYPE.  FUNCTION may be NULL in which
4555796c8dcSSimon Schubert    case the return convention is computed based only on VALTYPE.
4565796c8dcSSimon Schubert 
4575796c8dcSSimon Schubert    If READBUF is not NULL, extract the return value and save it in this buffer.
4585796c8dcSSimon Schubert 
4595796c8dcSSimon Schubert    If WRITEBUF is not NULL, it contains a return value which will be
4605796c8dcSSimon Schubert    stored into the appropriate register.  This can be used when we want
4615796c8dcSSimon Schubert    to force the value returned by a function (see the "return" command
4625796c8dcSSimon Schubert    for instance). */
4635796c8dcSSimon Schubert 
4645796c8dcSSimon Schubert extern int gdbarch_return_value_p (struct gdbarch *gdbarch);
4655796c8dcSSimon Schubert 
466*ef5ccd6cSJohn Marino typedef enum return_value_convention (gdbarch_return_value_ftype) (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf);
467*ef5ccd6cSJohn Marino extern enum return_value_convention gdbarch_return_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf);
4685796c8dcSSimon Schubert extern void set_gdbarch_return_value (struct gdbarch *gdbarch, gdbarch_return_value_ftype *return_value);
4695796c8dcSSimon Schubert 
470*ef5ccd6cSJohn Marino /* Return true if the return value of function is stored in the first hidden
471*ef5ccd6cSJohn Marino    parameter.  In theory, this feature should be language-dependent, specified
472*ef5ccd6cSJohn Marino    by language and its ABI, such as C++.  Unfortunately, compiler may
473*ef5ccd6cSJohn Marino    implement it to a target-dependent feature.  So that we need such hook here
474*ef5ccd6cSJohn Marino    to be aware of this in GDB. */
475*ef5ccd6cSJohn Marino 
476*ef5ccd6cSJohn Marino typedef int (gdbarch_return_in_first_hidden_param_p_ftype) (struct gdbarch *gdbarch, struct type *type);
477*ef5ccd6cSJohn Marino extern int gdbarch_return_in_first_hidden_param_p (struct gdbarch *gdbarch, struct type *type);
478*ef5ccd6cSJohn Marino extern void set_gdbarch_return_in_first_hidden_param_p (struct gdbarch *gdbarch, gdbarch_return_in_first_hidden_param_p_ftype *return_in_first_hidden_param_p);
479*ef5ccd6cSJohn Marino 
4805796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_skip_prologue_ftype) (struct gdbarch *gdbarch, CORE_ADDR ip);
4815796c8dcSSimon Schubert extern CORE_ADDR gdbarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip);
4825796c8dcSSimon Schubert extern void set_gdbarch_skip_prologue (struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype *skip_prologue);
4835796c8dcSSimon Schubert 
4845796c8dcSSimon Schubert extern int gdbarch_skip_main_prologue_p (struct gdbarch *gdbarch);
4855796c8dcSSimon Schubert 
4865796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_skip_main_prologue_ftype) (struct gdbarch *gdbarch, CORE_ADDR ip);
4875796c8dcSSimon Schubert extern CORE_ADDR gdbarch_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR ip);
4885796c8dcSSimon Schubert extern void set_gdbarch_skip_main_prologue (struct gdbarch *gdbarch, gdbarch_skip_main_prologue_ftype *skip_main_prologue);
4895796c8dcSSimon Schubert 
4905796c8dcSSimon Schubert typedef int (gdbarch_inner_than_ftype) (CORE_ADDR lhs, CORE_ADDR rhs);
4915796c8dcSSimon Schubert extern int gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs);
4925796c8dcSSimon Schubert extern void set_gdbarch_inner_than (struct gdbarch *gdbarch, gdbarch_inner_than_ftype *inner_than);
4935796c8dcSSimon Schubert 
4945796c8dcSSimon Schubert typedef const gdb_byte * (gdbarch_breakpoint_from_pc_ftype) (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr);
4955796c8dcSSimon Schubert extern const gdb_byte * gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr);
4965796c8dcSSimon Schubert extern void set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc);
4975796c8dcSSimon Schubert 
498cf7f2e2dSJohn Marino /* Return the adjusted address and kind to use for Z0/Z1 packets.
499cf7f2e2dSJohn Marino    KIND is usually the memory length of the breakpoint, but may have a
500cf7f2e2dSJohn Marino    different target-specific meaning. */
501cf7f2e2dSJohn Marino 
502cf7f2e2dSJohn Marino typedef void (gdbarch_remote_breakpoint_from_pc_ftype) (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *kindptr);
503cf7f2e2dSJohn Marino extern void gdbarch_remote_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *kindptr);
504cf7f2e2dSJohn Marino extern void set_gdbarch_remote_breakpoint_from_pc (struct gdbarch *gdbarch, gdbarch_remote_breakpoint_from_pc_ftype *remote_breakpoint_from_pc);
505cf7f2e2dSJohn Marino 
5065796c8dcSSimon Schubert extern int gdbarch_adjust_breakpoint_address_p (struct gdbarch *gdbarch);
5075796c8dcSSimon Schubert 
5085796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_adjust_breakpoint_address_ftype) (struct gdbarch *gdbarch, CORE_ADDR bpaddr);
5095796c8dcSSimon Schubert extern CORE_ADDR gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr);
5105796c8dcSSimon Schubert extern void set_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address);
5115796c8dcSSimon Schubert 
5125796c8dcSSimon Schubert typedef int (gdbarch_memory_insert_breakpoint_ftype) (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt);
5135796c8dcSSimon Schubert extern int gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt);
5145796c8dcSSimon Schubert extern void set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint);
5155796c8dcSSimon Schubert 
5165796c8dcSSimon Schubert typedef int (gdbarch_memory_remove_breakpoint_ftype) (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt);
5175796c8dcSSimon Schubert extern int gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt);
5185796c8dcSSimon Schubert extern void set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint);
5195796c8dcSSimon Schubert 
5205796c8dcSSimon Schubert extern CORE_ADDR gdbarch_decr_pc_after_break (struct gdbarch *gdbarch);
5215796c8dcSSimon Schubert extern void set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break);
5225796c8dcSSimon Schubert 
5235796c8dcSSimon Schubert /* A function can be addressed by either it's "pointer" (possibly a
5245796c8dcSSimon Schubert    descriptor address) or "entry point" (first executable instruction).
5255796c8dcSSimon Schubert    The method "convert_from_func_ptr_addr" converting the former to the
5265796c8dcSSimon Schubert    latter.  gdbarch_deprecated_function_start_offset is being used to implement
5275796c8dcSSimon Schubert    a simplified subset of that functionality - the function's address
5285796c8dcSSimon Schubert    corresponds to the "function pointer" and the function's start
5295796c8dcSSimon Schubert    corresponds to the "function entry point" - and hence is redundant. */
5305796c8dcSSimon Schubert 
5315796c8dcSSimon Schubert extern CORE_ADDR gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch);
5325796c8dcSSimon Schubert extern void set_gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch, CORE_ADDR deprecated_function_start_offset);
5335796c8dcSSimon Schubert 
5345796c8dcSSimon Schubert /* Return the remote protocol register number associated with this
5355796c8dcSSimon Schubert    register.  Normally the identity mapping. */
5365796c8dcSSimon Schubert 
5375796c8dcSSimon Schubert typedef int (gdbarch_remote_register_number_ftype) (struct gdbarch *gdbarch, int regno);
5385796c8dcSSimon Schubert extern int gdbarch_remote_register_number (struct gdbarch *gdbarch, int regno);
5395796c8dcSSimon Schubert extern void set_gdbarch_remote_register_number (struct gdbarch *gdbarch, gdbarch_remote_register_number_ftype *remote_register_number);
5405796c8dcSSimon Schubert 
5415796c8dcSSimon Schubert /* Fetch the target specific address used to represent a load module. */
5425796c8dcSSimon Schubert 
5435796c8dcSSimon Schubert extern int gdbarch_fetch_tls_load_module_address_p (struct gdbarch *gdbarch);
5445796c8dcSSimon Schubert 
5455796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_fetch_tls_load_module_address_ftype) (struct objfile *objfile);
5465796c8dcSSimon Schubert extern CORE_ADDR gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch, struct objfile *objfile);
5475796c8dcSSimon Schubert extern void set_gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch, gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address);
5485796c8dcSSimon Schubert 
5495796c8dcSSimon Schubert extern CORE_ADDR gdbarch_frame_args_skip (struct gdbarch *gdbarch);
5505796c8dcSSimon Schubert extern void set_gdbarch_frame_args_skip (struct gdbarch *gdbarch, CORE_ADDR frame_args_skip);
5515796c8dcSSimon Schubert 
5525796c8dcSSimon Schubert extern int gdbarch_unwind_pc_p (struct gdbarch *gdbarch);
5535796c8dcSSimon Schubert 
5545796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_unwind_pc_ftype) (struct gdbarch *gdbarch, struct frame_info *next_frame);
5555796c8dcSSimon Schubert extern CORE_ADDR gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame);
5565796c8dcSSimon Schubert extern void set_gdbarch_unwind_pc (struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype *unwind_pc);
5575796c8dcSSimon Schubert 
5585796c8dcSSimon Schubert extern int gdbarch_unwind_sp_p (struct gdbarch *gdbarch);
5595796c8dcSSimon Schubert 
5605796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_unwind_sp_ftype) (struct gdbarch *gdbarch, struct frame_info *next_frame);
5615796c8dcSSimon Schubert extern CORE_ADDR gdbarch_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame);
5625796c8dcSSimon Schubert extern void set_gdbarch_unwind_sp (struct gdbarch *gdbarch, gdbarch_unwind_sp_ftype *unwind_sp);
5635796c8dcSSimon Schubert 
5645796c8dcSSimon Schubert /* DEPRECATED_FRAME_LOCALS_ADDRESS as been replaced by the per-frame
5655796c8dcSSimon Schubert    frame-base.  Enable frame-base before frame-unwind. */
5665796c8dcSSimon Schubert 
5675796c8dcSSimon Schubert extern int gdbarch_frame_num_args_p (struct gdbarch *gdbarch);
5685796c8dcSSimon Schubert 
5695796c8dcSSimon Schubert typedef int (gdbarch_frame_num_args_ftype) (struct frame_info *frame);
5705796c8dcSSimon Schubert extern int gdbarch_frame_num_args (struct gdbarch *gdbarch, struct frame_info *frame);
5715796c8dcSSimon Schubert extern void set_gdbarch_frame_num_args (struct gdbarch *gdbarch, gdbarch_frame_num_args_ftype *frame_num_args);
5725796c8dcSSimon Schubert 
5735796c8dcSSimon Schubert extern int gdbarch_frame_align_p (struct gdbarch *gdbarch);
5745796c8dcSSimon Schubert 
5755796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_frame_align_ftype) (struct gdbarch *gdbarch, CORE_ADDR address);
5765796c8dcSSimon Schubert extern CORE_ADDR gdbarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR address);
5775796c8dcSSimon Schubert extern void set_gdbarch_frame_align (struct gdbarch *gdbarch, gdbarch_frame_align_ftype *frame_align);
5785796c8dcSSimon Schubert 
5795796c8dcSSimon Schubert typedef int (gdbarch_stabs_argument_has_addr_ftype) (struct gdbarch *gdbarch, struct type *type);
5805796c8dcSSimon Schubert extern int gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type);
5815796c8dcSSimon Schubert extern void set_gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr);
5825796c8dcSSimon Schubert 
5835796c8dcSSimon Schubert extern int gdbarch_frame_red_zone_size (struct gdbarch *gdbarch);
5845796c8dcSSimon Schubert extern void set_gdbarch_frame_red_zone_size (struct gdbarch *gdbarch, int frame_red_zone_size);
5855796c8dcSSimon Schubert 
5865796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_convert_from_func_ptr_addr_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ);
5875796c8dcSSimon Schubert extern CORE_ADDR gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ);
5885796c8dcSSimon Schubert extern void set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr);
5895796c8dcSSimon Schubert 
5905796c8dcSSimon Schubert /* On some machines there are bits in addresses which are not really
5915796c8dcSSimon Schubert    part of the address, but are used by the kernel, the hardware, etc.
5925796c8dcSSimon Schubert    for special purposes.  gdbarch_addr_bits_remove takes out any such bits so
5935796c8dcSSimon Schubert    we get a "real" address such as one would find in a symbol table.
5945796c8dcSSimon Schubert    This is used only for addresses of instructions, and even then I'm
5955796c8dcSSimon Schubert    not sure it's used in all contexts.  It exists to deal with there
5965796c8dcSSimon Schubert    being a few stray bits in the PC which would mislead us, not as some
5975796c8dcSSimon Schubert    sort of generic thing to handle alignment or segmentation (it's
5985796c8dcSSimon Schubert    possible it should be in TARGET_READ_PC instead). */
5995796c8dcSSimon Schubert 
6005796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_addr_bits_remove_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
6015796c8dcSSimon Schubert extern CORE_ADDR gdbarch_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr);
6025796c8dcSSimon Schubert extern void set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch, gdbarch_addr_bits_remove_ftype *addr_bits_remove);
6035796c8dcSSimon Schubert 
6045796c8dcSSimon Schubert /* FIXME/cagney/2001-01-18: This should be split in two.  A target method that
6055796c8dcSSimon Schubert    indicates if the target needs software single step.  An ISA method to
6065796c8dcSSimon Schubert    implement it.
6075796c8dcSSimon Schubert 
6085796c8dcSSimon Schubert    FIXME/cagney/2001-01-18: This should be replaced with something that inserts
6095796c8dcSSimon Schubert    breakpoints using the breakpoint system instead of blatting memory directly
6105796c8dcSSimon Schubert    (as with rs6000).
6115796c8dcSSimon Schubert 
6125796c8dcSSimon Schubert    FIXME/cagney/2001-01-18: The logic is backwards.  It should be asking if the
6135796c8dcSSimon Schubert    target can single step.  If not, then implement single step using breakpoints.
6145796c8dcSSimon Schubert 
6155796c8dcSSimon Schubert    A return value of 1 means that the software_single_step breakpoints
6165796c8dcSSimon Schubert    were inserted; 0 means they were not. */
6175796c8dcSSimon Schubert 
6185796c8dcSSimon Schubert extern int gdbarch_software_single_step_p (struct gdbarch *gdbarch);
6195796c8dcSSimon Schubert 
6205796c8dcSSimon Schubert typedef int (gdbarch_software_single_step_ftype) (struct frame_info *frame);
6215796c8dcSSimon Schubert extern int gdbarch_software_single_step (struct gdbarch *gdbarch, struct frame_info *frame);
6225796c8dcSSimon Schubert extern void set_gdbarch_software_single_step (struct gdbarch *gdbarch, gdbarch_software_single_step_ftype *software_single_step);
6235796c8dcSSimon Schubert 
6245796c8dcSSimon Schubert /* Return non-zero if the processor is executing a delay slot and a
6255796c8dcSSimon Schubert    further single-step is needed before the instruction finishes. */
6265796c8dcSSimon Schubert 
6275796c8dcSSimon Schubert extern int gdbarch_single_step_through_delay_p (struct gdbarch *gdbarch);
6285796c8dcSSimon Schubert 
6295796c8dcSSimon Schubert typedef int (gdbarch_single_step_through_delay_ftype) (struct gdbarch *gdbarch, struct frame_info *frame);
6305796c8dcSSimon Schubert extern int gdbarch_single_step_through_delay (struct gdbarch *gdbarch, struct frame_info *frame);
6315796c8dcSSimon Schubert extern void set_gdbarch_single_step_through_delay (struct gdbarch *gdbarch, gdbarch_single_step_through_delay_ftype *single_step_through_delay);
6325796c8dcSSimon Schubert 
6335796c8dcSSimon Schubert /* FIXME: cagney/2003-08-28: Need to find a better way of selecting the
6345796c8dcSSimon Schubert    disassembler.  Perhaps objdump can handle it? */
6355796c8dcSSimon Schubert 
6365796c8dcSSimon Schubert typedef int (gdbarch_print_insn_ftype) (bfd_vma vma, struct disassemble_info *info);
6375796c8dcSSimon Schubert extern int gdbarch_print_insn (struct gdbarch *gdbarch, bfd_vma vma, struct disassemble_info *info);
6385796c8dcSSimon Schubert extern void set_gdbarch_print_insn (struct gdbarch *gdbarch, gdbarch_print_insn_ftype *print_insn);
6395796c8dcSSimon Schubert 
6405796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_skip_trampoline_code_ftype) (struct frame_info *frame, CORE_ADDR pc);
6415796c8dcSSimon Schubert extern CORE_ADDR gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, struct frame_info *frame, CORE_ADDR pc);
6425796c8dcSSimon Schubert extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_skip_trampoline_code_ftype *skip_trampoline_code);
6435796c8dcSSimon Schubert 
6445796c8dcSSimon Schubert /* If in_solib_dynsym_resolve_code() returns true, and SKIP_SOLIB_RESOLVER
6455796c8dcSSimon Schubert    evaluates non-zero, this is the address where the debugger will place
6465796c8dcSSimon Schubert    a step-resume breakpoint to get us past the dynamic linker. */
6475796c8dcSSimon Schubert 
6485796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_skip_solib_resolver_ftype) (struct gdbarch *gdbarch, CORE_ADDR pc);
6495796c8dcSSimon Schubert extern CORE_ADDR gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc);
6505796c8dcSSimon Schubert extern void set_gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, gdbarch_skip_solib_resolver_ftype *skip_solib_resolver);
6515796c8dcSSimon Schubert 
6525796c8dcSSimon Schubert /* Some systems also have trampoline code for returning from shared libs. */
6535796c8dcSSimon Schubert 
654*ef5ccd6cSJohn Marino typedef int (gdbarch_in_solib_return_trampoline_ftype) (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name);
655*ef5ccd6cSJohn Marino extern int gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name);
6565796c8dcSSimon Schubert extern void set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline);
6575796c8dcSSimon Schubert 
6585796c8dcSSimon Schubert /* A target might have problems with watchpoints as soon as the stack
6595796c8dcSSimon Schubert    frame of the current function has been destroyed.  This mostly happens
6605796c8dcSSimon Schubert    as the first action in a funtion's epilogue.  in_function_epilogue_p()
6615796c8dcSSimon Schubert    is defined to return a non-zero value if either the given addr is one
6625796c8dcSSimon Schubert    instruction after the stack destroying instruction up to the trailing
6635796c8dcSSimon Schubert    return instruction or if we can figure out that the stack frame has
6645796c8dcSSimon Schubert    already been invalidated regardless of the value of addr.  Targets
6655796c8dcSSimon Schubert    which don't suffer from that problem could just let this functionality
6665796c8dcSSimon Schubert    untouched. */
6675796c8dcSSimon Schubert 
6685796c8dcSSimon Schubert typedef int (gdbarch_in_function_epilogue_p_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
6695796c8dcSSimon Schubert extern int gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR addr);
6705796c8dcSSimon Schubert extern void set_gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch, gdbarch_in_function_epilogue_p_ftype *in_function_epilogue_p);
6715796c8dcSSimon Schubert 
6725796c8dcSSimon Schubert typedef void (gdbarch_elf_make_msymbol_special_ftype) (asymbol *sym, struct minimal_symbol *msym);
6735796c8dcSSimon Schubert extern void gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, asymbol *sym, struct minimal_symbol *msym);
6745796c8dcSSimon Schubert extern void set_gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, gdbarch_elf_make_msymbol_special_ftype *elf_make_msymbol_special);
6755796c8dcSSimon Schubert 
6765796c8dcSSimon Schubert typedef void (gdbarch_coff_make_msymbol_special_ftype) (int val, struct minimal_symbol *msym);
6775796c8dcSSimon Schubert extern void gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, int val, struct minimal_symbol *msym);
6785796c8dcSSimon Schubert extern void set_gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, gdbarch_coff_make_msymbol_special_ftype *coff_make_msymbol_special);
6795796c8dcSSimon Schubert 
6805796c8dcSSimon Schubert extern int gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch);
6815796c8dcSSimon Schubert extern void set_gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch, int cannot_step_breakpoint);
6825796c8dcSSimon Schubert 
6835796c8dcSSimon Schubert extern int gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch);
6845796c8dcSSimon Schubert extern void set_gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch, int have_nonsteppable_watchpoint);
6855796c8dcSSimon Schubert 
6865796c8dcSSimon Schubert extern int gdbarch_address_class_type_flags_p (struct gdbarch *gdbarch);
6875796c8dcSSimon Schubert 
6885796c8dcSSimon Schubert typedef int (gdbarch_address_class_type_flags_ftype) (int byte_size, int dwarf2_addr_class);
6895796c8dcSSimon Schubert extern int gdbarch_address_class_type_flags (struct gdbarch *gdbarch, int byte_size, int dwarf2_addr_class);
6905796c8dcSSimon Schubert extern void set_gdbarch_address_class_type_flags (struct gdbarch *gdbarch, gdbarch_address_class_type_flags_ftype *address_class_type_flags);
6915796c8dcSSimon Schubert 
6925796c8dcSSimon Schubert extern int gdbarch_address_class_type_flags_to_name_p (struct gdbarch *gdbarch);
6935796c8dcSSimon Schubert 
6945796c8dcSSimon Schubert typedef const char * (gdbarch_address_class_type_flags_to_name_ftype) (struct gdbarch *gdbarch, int type_flags);
6955796c8dcSSimon Schubert extern const char * gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags);
6965796c8dcSSimon Schubert extern void set_gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, gdbarch_address_class_type_flags_to_name_ftype *address_class_type_flags_to_name);
6975796c8dcSSimon Schubert 
6985796c8dcSSimon Schubert extern int gdbarch_address_class_name_to_type_flags_p (struct gdbarch *gdbarch);
6995796c8dcSSimon Schubert 
7005796c8dcSSimon Schubert typedef int (gdbarch_address_class_name_to_type_flags_ftype) (struct gdbarch *gdbarch, const char *name, int *type_flags_ptr);
7015796c8dcSSimon Schubert extern int gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name, int *type_flags_ptr);
7025796c8dcSSimon Schubert extern void set_gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_type_flags);
7035796c8dcSSimon Schubert 
7045796c8dcSSimon Schubert /* Is a register in a group */
7055796c8dcSSimon Schubert 
7065796c8dcSSimon Schubert typedef int (gdbarch_register_reggroup_p_ftype) (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup);
7075796c8dcSSimon Schubert extern int gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup);
7085796c8dcSSimon Schubert extern void set_gdbarch_register_reggroup_p (struct gdbarch *gdbarch, gdbarch_register_reggroup_p_ftype *register_reggroup_p);
7095796c8dcSSimon Schubert 
7105796c8dcSSimon Schubert /* Fetch the pointer to the ith function argument. */
7115796c8dcSSimon Schubert 
7125796c8dcSSimon Schubert extern int gdbarch_fetch_pointer_argument_p (struct gdbarch *gdbarch);
7135796c8dcSSimon Schubert 
7145796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_fetch_pointer_argument_ftype) (struct frame_info *frame, int argi, struct type *type);
7155796c8dcSSimon Schubert extern CORE_ADDR gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, struct frame_info *frame, int argi, struct type *type);
7165796c8dcSSimon Schubert extern void set_gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument);
7175796c8dcSSimon Schubert 
7185796c8dcSSimon Schubert /* Return the appropriate register set for a core file section with
7195796c8dcSSimon Schubert    name SECT_NAME and size SECT_SIZE. */
7205796c8dcSSimon Schubert 
7215796c8dcSSimon Schubert extern int gdbarch_regset_from_core_section_p (struct gdbarch *gdbarch);
7225796c8dcSSimon Schubert 
7235796c8dcSSimon Schubert typedef const struct regset * (gdbarch_regset_from_core_section_ftype) (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size);
7245796c8dcSSimon Schubert extern const struct regset * gdbarch_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size);
7255796c8dcSSimon Schubert extern void set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch, gdbarch_regset_from_core_section_ftype *regset_from_core_section);
7265796c8dcSSimon Schubert 
7275796c8dcSSimon Schubert /* Supported register notes in a core file. */
7285796c8dcSSimon Schubert 
7295796c8dcSSimon Schubert extern struct core_regset_section * gdbarch_core_regset_sections (struct gdbarch *gdbarch);
7305796c8dcSSimon Schubert extern void set_gdbarch_core_regset_sections (struct gdbarch *gdbarch, struct core_regset_section * core_regset_sections);
7315796c8dcSSimon Schubert 
732*ef5ccd6cSJohn Marino /* Create core file notes */
733*ef5ccd6cSJohn Marino 
734*ef5ccd6cSJohn Marino extern int gdbarch_make_corefile_notes_p (struct gdbarch *gdbarch);
735*ef5ccd6cSJohn Marino 
736*ef5ccd6cSJohn Marino typedef char * (gdbarch_make_corefile_notes_ftype) (struct gdbarch *gdbarch, bfd *obfd, int *note_size);
737*ef5ccd6cSJohn Marino extern char * gdbarch_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size);
738*ef5ccd6cSJohn Marino extern void set_gdbarch_make_corefile_notes (struct gdbarch *gdbarch, gdbarch_make_corefile_notes_ftype *make_corefile_notes);
739*ef5ccd6cSJohn Marino 
740*ef5ccd6cSJohn Marino /* The elfcore writer hook to use to write Linux prpsinfo notes to core
741*ef5ccd6cSJohn Marino    files.  Most Linux architectures use the same prpsinfo32 or
742*ef5ccd6cSJohn Marino    prpsinfo64 layouts, and so won't need to provide this hook, as we
743*ef5ccd6cSJohn Marino    call the Linux generic routines in bfd to write prpsinfo notes by
744*ef5ccd6cSJohn Marino    default. */
745*ef5ccd6cSJohn Marino 
746*ef5ccd6cSJohn Marino extern int gdbarch_elfcore_write_linux_prpsinfo_p (struct gdbarch *gdbarch);
747*ef5ccd6cSJohn Marino 
748*ef5ccd6cSJohn Marino typedef char * (gdbarch_elfcore_write_linux_prpsinfo_ftype) (bfd *obfd, char *note_data, int *note_size, const struct elf_internal_linux_prpsinfo *info);
749*ef5ccd6cSJohn Marino extern char * gdbarch_elfcore_write_linux_prpsinfo (struct gdbarch *gdbarch, bfd *obfd, char *note_data, int *note_size, const struct elf_internal_linux_prpsinfo *info);
750*ef5ccd6cSJohn Marino extern void set_gdbarch_elfcore_write_linux_prpsinfo (struct gdbarch *gdbarch, gdbarch_elfcore_write_linux_prpsinfo_ftype *elfcore_write_linux_prpsinfo);
751*ef5ccd6cSJohn Marino 
752*ef5ccd6cSJohn Marino /* Find core file memory regions */
753*ef5ccd6cSJohn Marino 
754*ef5ccd6cSJohn Marino extern int gdbarch_find_memory_regions_p (struct gdbarch *gdbarch);
755*ef5ccd6cSJohn Marino 
756*ef5ccd6cSJohn Marino typedef int (gdbarch_find_memory_regions_ftype) (struct gdbarch *gdbarch, find_memory_region_ftype func, void *data);
757*ef5ccd6cSJohn Marino extern int gdbarch_find_memory_regions (struct gdbarch *gdbarch, find_memory_region_ftype func, void *data);
758*ef5ccd6cSJohn Marino extern void set_gdbarch_find_memory_regions (struct gdbarch *gdbarch, gdbarch_find_memory_regions_ftype *find_memory_regions);
759*ef5ccd6cSJohn Marino 
7605796c8dcSSimon Schubert /* Read offset OFFSET of TARGET_OBJECT_LIBRARIES formatted shared libraries list from
7615796c8dcSSimon Schubert    core file into buffer READBUF with length LEN. */
7625796c8dcSSimon Schubert 
7635796c8dcSSimon Schubert extern int gdbarch_core_xfer_shared_libraries_p (struct gdbarch *gdbarch);
7645796c8dcSSimon Schubert 
7655796c8dcSSimon Schubert typedef LONGEST (gdbarch_core_xfer_shared_libraries_ftype) (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, LONGEST len);
7665796c8dcSSimon Schubert extern LONGEST gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, LONGEST len);
7675796c8dcSSimon Schubert extern void set_gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries);
7685796c8dcSSimon Schubert 
769c50c785cSJohn Marino /* How the core target converts a PTID from a core file to a string. */
7705796c8dcSSimon Schubert 
7715796c8dcSSimon Schubert extern int gdbarch_core_pid_to_str_p (struct gdbarch *gdbarch);
7725796c8dcSSimon Schubert 
7735796c8dcSSimon Schubert typedef char * (gdbarch_core_pid_to_str_ftype) (struct gdbarch *gdbarch, ptid_t ptid);
7745796c8dcSSimon Schubert extern char * gdbarch_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid);
7755796c8dcSSimon Schubert extern void set_gdbarch_core_pid_to_str (struct gdbarch *gdbarch, gdbarch_core_pid_to_str_ftype *core_pid_to_str);
7765796c8dcSSimon Schubert 
7775796c8dcSSimon Schubert /* BFD target to use when generating a core file. */
7785796c8dcSSimon Schubert 
7795796c8dcSSimon Schubert extern int gdbarch_gcore_bfd_target_p (struct gdbarch *gdbarch);
7805796c8dcSSimon Schubert 
7815796c8dcSSimon Schubert extern const char * gdbarch_gcore_bfd_target (struct gdbarch *gdbarch);
7825796c8dcSSimon Schubert extern void set_gdbarch_gcore_bfd_target (struct gdbarch *gdbarch, const char * gcore_bfd_target);
7835796c8dcSSimon Schubert 
7845796c8dcSSimon Schubert /* If the elements of C++ vtables are in-place function descriptors rather
7855796c8dcSSimon Schubert    than normal function pointers (which may point to code or a descriptor),
7865796c8dcSSimon Schubert    set this to one. */
7875796c8dcSSimon Schubert 
7885796c8dcSSimon Schubert extern int gdbarch_vtable_function_descriptors (struct gdbarch *gdbarch);
7895796c8dcSSimon Schubert extern void set_gdbarch_vtable_function_descriptors (struct gdbarch *gdbarch, int vtable_function_descriptors);
7905796c8dcSSimon Schubert 
7915796c8dcSSimon Schubert /* Set if the least significant bit of the delta is used instead of the least
7925796c8dcSSimon Schubert    significant bit of the pfn for pointers to virtual member functions. */
7935796c8dcSSimon Schubert 
7945796c8dcSSimon Schubert extern int gdbarch_vbit_in_delta (struct gdbarch *gdbarch);
7955796c8dcSSimon Schubert extern void set_gdbarch_vbit_in_delta (struct gdbarch *gdbarch, int vbit_in_delta);
7965796c8dcSSimon Schubert 
7975796c8dcSSimon Schubert /* Advance PC to next instruction in order to skip a permanent breakpoint. */
7985796c8dcSSimon Schubert 
7995796c8dcSSimon Schubert extern int gdbarch_skip_permanent_breakpoint_p (struct gdbarch *gdbarch);
8005796c8dcSSimon Schubert 
8015796c8dcSSimon Schubert typedef void (gdbarch_skip_permanent_breakpoint_ftype) (struct regcache *regcache);
8025796c8dcSSimon Schubert extern void gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, struct regcache *regcache);
8035796c8dcSSimon Schubert extern void set_gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint);
8045796c8dcSSimon Schubert 
805*ef5ccd6cSJohn Marino /* The maximum length of an instruction on this architecture in bytes. */
8065796c8dcSSimon Schubert 
8075796c8dcSSimon Schubert extern int gdbarch_max_insn_length_p (struct gdbarch *gdbarch);
8085796c8dcSSimon Schubert 
8095796c8dcSSimon Schubert extern ULONGEST gdbarch_max_insn_length (struct gdbarch *gdbarch);
8105796c8dcSSimon Schubert extern void set_gdbarch_max_insn_length (struct gdbarch *gdbarch, ULONGEST max_insn_length);
8115796c8dcSSimon Schubert 
8125796c8dcSSimon Schubert /* Copy the instruction at FROM to TO, and make any adjustments
8135796c8dcSSimon Schubert    necessary to single-step it at that address.
8145796c8dcSSimon Schubert 
8155796c8dcSSimon Schubert    REGS holds the state the thread's registers will have before
8165796c8dcSSimon Schubert    executing the copied instruction; the PC in REGS will refer to FROM,
8175796c8dcSSimon Schubert    not the copy at TO.  The caller should update it to point at TO later.
8185796c8dcSSimon Schubert 
8195796c8dcSSimon Schubert    Return a pointer to data of the architecture's choice to be passed
8205796c8dcSSimon Schubert    to gdbarch_displaced_step_fixup.  Or, return NULL to indicate that
8215796c8dcSSimon Schubert    the instruction's effects have been completely simulated, with the
8225796c8dcSSimon Schubert    resulting state written back to REGS.
8235796c8dcSSimon Schubert 
8245796c8dcSSimon Schubert    For a general explanation of displaced stepping and how GDB uses it,
8255796c8dcSSimon Schubert    see the comments in infrun.c.
8265796c8dcSSimon Schubert 
8275796c8dcSSimon Schubert    The TO area is only guaranteed to have space for
8285796c8dcSSimon Schubert    gdbarch_max_insn_length (arch) bytes, so this function must not
8295796c8dcSSimon Schubert    write more bytes than that to that area.
8305796c8dcSSimon Schubert 
8315796c8dcSSimon Schubert    If you do not provide this function, GDB assumes that the
8325796c8dcSSimon Schubert    architecture does not support displaced stepping.
8335796c8dcSSimon Schubert 
8345796c8dcSSimon Schubert    If your architecture doesn't need to adjust instructions before
8355796c8dcSSimon Schubert    single-stepping them, consider using simple_displaced_step_copy_insn
8365796c8dcSSimon Schubert    here. */
8375796c8dcSSimon Schubert 
8385796c8dcSSimon Schubert extern int gdbarch_displaced_step_copy_insn_p (struct gdbarch *gdbarch);
8395796c8dcSSimon Schubert 
8405796c8dcSSimon Schubert typedef struct displaced_step_closure * (gdbarch_displaced_step_copy_insn_ftype) (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
8415796c8dcSSimon Schubert extern struct displaced_step_closure * gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
8425796c8dcSSimon Schubert extern void set_gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, gdbarch_displaced_step_copy_insn_ftype *displaced_step_copy_insn);
8435796c8dcSSimon Schubert 
8445796c8dcSSimon Schubert /* Return true if GDB should use hardware single-stepping to execute
8455796c8dcSSimon Schubert    the displaced instruction identified by CLOSURE.  If false,
8465796c8dcSSimon Schubert    GDB will simply restart execution at the displaced instruction
8475796c8dcSSimon Schubert    location, and it is up to the target to ensure GDB will receive
8485796c8dcSSimon Schubert    control again (e.g. by placing a software breakpoint instruction
8495796c8dcSSimon Schubert    into the displaced instruction buffer).
8505796c8dcSSimon Schubert 
8515796c8dcSSimon Schubert    The default implementation returns false on all targets that
8525796c8dcSSimon Schubert    provide a gdbarch_software_single_step routine, and true otherwise. */
8535796c8dcSSimon Schubert 
8545796c8dcSSimon Schubert typedef int (gdbarch_displaced_step_hw_singlestep_ftype) (struct gdbarch *gdbarch, struct displaced_step_closure *closure);
8555796c8dcSSimon Schubert extern int gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch, struct displaced_step_closure *closure);
8565796c8dcSSimon Schubert extern void set_gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch, gdbarch_displaced_step_hw_singlestep_ftype *displaced_step_hw_singlestep);
8575796c8dcSSimon Schubert 
8585796c8dcSSimon Schubert /* Fix up the state resulting from successfully single-stepping a
8595796c8dcSSimon Schubert    displaced instruction, to give the result we would have gotten from
8605796c8dcSSimon Schubert    stepping the instruction in its original location.
8615796c8dcSSimon Schubert 
8625796c8dcSSimon Schubert    REGS is the register state resulting from single-stepping the
8635796c8dcSSimon Schubert    displaced instruction.
8645796c8dcSSimon Schubert 
8655796c8dcSSimon Schubert    CLOSURE is the result from the matching call to
8665796c8dcSSimon Schubert    gdbarch_displaced_step_copy_insn.
8675796c8dcSSimon Schubert 
8685796c8dcSSimon Schubert    If you provide gdbarch_displaced_step_copy_insn.but not this
8695796c8dcSSimon Schubert    function, then GDB assumes that no fixup is needed after
8705796c8dcSSimon Schubert    single-stepping the instruction.
8715796c8dcSSimon Schubert 
8725796c8dcSSimon Schubert    For a general explanation of displaced stepping and how GDB uses it,
8735796c8dcSSimon Schubert    see the comments in infrun.c. */
8745796c8dcSSimon Schubert 
8755796c8dcSSimon Schubert extern int gdbarch_displaced_step_fixup_p (struct gdbarch *gdbarch);
8765796c8dcSSimon Schubert 
8775796c8dcSSimon Schubert typedef void (gdbarch_displaced_step_fixup_ftype) (struct gdbarch *gdbarch, struct displaced_step_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
8785796c8dcSSimon Schubert extern void gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, struct displaced_step_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
8795796c8dcSSimon Schubert extern void set_gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, gdbarch_displaced_step_fixup_ftype *displaced_step_fixup);
8805796c8dcSSimon Schubert 
8815796c8dcSSimon Schubert /* Free a closure returned by gdbarch_displaced_step_copy_insn.
8825796c8dcSSimon Schubert 
8835796c8dcSSimon Schubert    If you provide gdbarch_displaced_step_copy_insn, you must provide
8845796c8dcSSimon Schubert    this function as well.
8855796c8dcSSimon Schubert 
8865796c8dcSSimon Schubert    If your architecture uses closures that don't need to be freed, then
8875796c8dcSSimon Schubert    you can use simple_displaced_step_free_closure here.
8885796c8dcSSimon Schubert 
8895796c8dcSSimon Schubert    For a general explanation of displaced stepping and how GDB uses it,
8905796c8dcSSimon Schubert    see the comments in infrun.c. */
8915796c8dcSSimon Schubert 
8925796c8dcSSimon Schubert typedef void (gdbarch_displaced_step_free_closure_ftype) (struct gdbarch *gdbarch, struct displaced_step_closure *closure);
8935796c8dcSSimon Schubert extern void gdbarch_displaced_step_free_closure (struct gdbarch *gdbarch, struct displaced_step_closure *closure);
8945796c8dcSSimon Schubert extern void set_gdbarch_displaced_step_free_closure (struct gdbarch *gdbarch, gdbarch_displaced_step_free_closure_ftype *displaced_step_free_closure);
8955796c8dcSSimon Schubert 
8965796c8dcSSimon Schubert /* Return the address of an appropriate place to put displaced
8975796c8dcSSimon Schubert    instructions while we step over them.  There need only be one such
8985796c8dcSSimon Schubert    place, since we're only stepping one thread over a breakpoint at a
8995796c8dcSSimon Schubert    time.
9005796c8dcSSimon Schubert 
9015796c8dcSSimon Schubert    For a general explanation of displaced stepping and how GDB uses it,
9025796c8dcSSimon Schubert    see the comments in infrun.c. */
9035796c8dcSSimon Schubert 
9045796c8dcSSimon Schubert typedef CORE_ADDR (gdbarch_displaced_step_location_ftype) (struct gdbarch *gdbarch);
9055796c8dcSSimon Schubert extern CORE_ADDR gdbarch_displaced_step_location (struct gdbarch *gdbarch);
9065796c8dcSSimon Schubert extern void set_gdbarch_displaced_step_location (struct gdbarch *gdbarch, gdbarch_displaced_step_location_ftype *displaced_step_location);
9075796c8dcSSimon Schubert 
908cf7f2e2dSJohn Marino /* Relocate an instruction to execute at a different address.  OLDLOC
909cf7f2e2dSJohn Marino    is the address in the inferior memory where the instruction to
910cf7f2e2dSJohn Marino    relocate is currently at.  On input, TO points to the destination
911cf7f2e2dSJohn Marino    where we want the instruction to be copied (and possibly adjusted)
912cf7f2e2dSJohn Marino    to.  On output, it points to one past the end of the resulting
913cf7f2e2dSJohn Marino    instruction(s).  The effect of executing the instruction at TO shall
914cf7f2e2dSJohn Marino    be the same as if executing it at FROM.  For example, call
915cf7f2e2dSJohn Marino    instructions that implicitly push the return address on the stack
916cf7f2e2dSJohn Marino    should be adjusted to return to the instruction after OLDLOC;
917cf7f2e2dSJohn Marino    relative branches, and other PC-relative instructions need the
918cf7f2e2dSJohn Marino    offset adjusted; etc. */
919cf7f2e2dSJohn Marino 
920cf7f2e2dSJohn Marino extern int gdbarch_relocate_instruction_p (struct gdbarch *gdbarch);
921cf7f2e2dSJohn Marino 
922cf7f2e2dSJohn Marino typedef void (gdbarch_relocate_instruction_ftype) (struct gdbarch *gdbarch, CORE_ADDR *to, CORE_ADDR from);
923cf7f2e2dSJohn Marino extern void gdbarch_relocate_instruction (struct gdbarch *gdbarch, CORE_ADDR *to, CORE_ADDR from);
924cf7f2e2dSJohn Marino extern void set_gdbarch_relocate_instruction (struct gdbarch *gdbarch, gdbarch_relocate_instruction_ftype *relocate_instruction);
925cf7f2e2dSJohn Marino 
9265796c8dcSSimon Schubert /* Refresh overlay mapped state for section OSECT. */
9275796c8dcSSimon Schubert 
9285796c8dcSSimon Schubert extern int gdbarch_overlay_update_p (struct gdbarch *gdbarch);
9295796c8dcSSimon Schubert 
9305796c8dcSSimon Schubert typedef void (gdbarch_overlay_update_ftype) (struct obj_section *osect);
9315796c8dcSSimon Schubert extern void gdbarch_overlay_update (struct gdbarch *gdbarch, struct obj_section *osect);
9325796c8dcSSimon Schubert extern void set_gdbarch_overlay_update (struct gdbarch *gdbarch, gdbarch_overlay_update_ftype *overlay_update);
9335796c8dcSSimon Schubert 
9345796c8dcSSimon Schubert extern int gdbarch_core_read_description_p (struct gdbarch *gdbarch);
9355796c8dcSSimon Schubert 
9365796c8dcSSimon Schubert typedef const struct target_desc * (gdbarch_core_read_description_ftype) (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd);
9375796c8dcSSimon Schubert extern const struct target_desc * gdbarch_core_read_description (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd);
9385796c8dcSSimon Schubert extern void set_gdbarch_core_read_description (struct gdbarch *gdbarch, gdbarch_core_read_description_ftype *core_read_description);
9395796c8dcSSimon Schubert 
9405796c8dcSSimon Schubert /* Handle special encoding of static variables in stabs debug info. */
9415796c8dcSSimon Schubert 
9425796c8dcSSimon Schubert extern int gdbarch_static_transform_name_p (struct gdbarch *gdbarch);
9435796c8dcSSimon Schubert 
944*ef5ccd6cSJohn Marino typedef const char * (gdbarch_static_transform_name_ftype) (const char *name);
945*ef5ccd6cSJohn Marino extern const char * gdbarch_static_transform_name (struct gdbarch *gdbarch, const char *name);
9465796c8dcSSimon Schubert extern void set_gdbarch_static_transform_name (struct gdbarch *gdbarch, gdbarch_static_transform_name_ftype *static_transform_name);
9475796c8dcSSimon Schubert 
9485796c8dcSSimon Schubert /* Set if the address in N_SO or N_FUN stabs may be zero. */
9495796c8dcSSimon Schubert 
9505796c8dcSSimon Schubert extern int gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch);
9515796c8dcSSimon Schubert extern void set_gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch, int sofun_address_maybe_missing);
9525796c8dcSSimon Schubert 
9535796c8dcSSimon Schubert /* Parse the instruction at ADDR storing in the record execution log
9545796c8dcSSimon Schubert    the registers REGCACHE and memory ranges that will be affected when
9555796c8dcSSimon Schubert    the instruction executes, along with their current values.
9565796c8dcSSimon Schubert    Return -1 if something goes wrong, 0 otherwise. */
9575796c8dcSSimon Schubert 
9585796c8dcSSimon Schubert extern int gdbarch_process_record_p (struct gdbarch *gdbarch);
9595796c8dcSSimon Schubert 
9605796c8dcSSimon Schubert typedef int (gdbarch_process_record_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr);
9615796c8dcSSimon Schubert extern int gdbarch_process_record (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr);
9625796c8dcSSimon Schubert extern void set_gdbarch_process_record (struct gdbarch *gdbarch, gdbarch_process_record_ftype *process_record);
9635796c8dcSSimon Schubert 
9645796c8dcSSimon Schubert /* Save process state after a signal.
9655796c8dcSSimon Schubert    Return -1 if something goes wrong, 0 otherwise. */
9665796c8dcSSimon Schubert 
9675796c8dcSSimon Schubert extern int gdbarch_process_record_signal_p (struct gdbarch *gdbarch);
9685796c8dcSSimon Schubert 
969*ef5ccd6cSJohn Marino typedef int (gdbarch_process_record_signal_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, enum gdb_signal signal);
970*ef5ccd6cSJohn Marino extern int gdbarch_process_record_signal (struct gdbarch *gdbarch, struct regcache *regcache, enum gdb_signal signal);
9715796c8dcSSimon Schubert extern void set_gdbarch_process_record_signal (struct gdbarch *gdbarch, gdbarch_process_record_signal_ftype *process_record_signal);
9725796c8dcSSimon Schubert 
973*ef5ccd6cSJohn Marino /* Signal translation: translate inferior's signal (target's) number
974*ef5ccd6cSJohn Marino    into GDB's representation.  The implementation of this method must
975*ef5ccd6cSJohn Marino    be host independent.  IOW, don't rely on symbols of the NAT_FILE
976*ef5ccd6cSJohn Marino    header (the nm-*.h files), the host <signal.h> header, or similar
977*ef5ccd6cSJohn Marino    headers.  This is mainly used when cross-debugging core files ---
978*ef5ccd6cSJohn Marino    "Live" targets hide the translation behind the target interface
979*ef5ccd6cSJohn Marino    (target_wait, target_resume, etc.). */
9805796c8dcSSimon Schubert 
981*ef5ccd6cSJohn Marino extern int gdbarch_gdb_signal_from_target_p (struct gdbarch *gdbarch);
9825796c8dcSSimon Schubert 
983*ef5ccd6cSJohn Marino typedef enum gdb_signal (gdbarch_gdb_signal_from_target_ftype) (struct gdbarch *gdbarch, int signo);
984*ef5ccd6cSJohn Marino extern enum gdb_signal gdbarch_gdb_signal_from_target (struct gdbarch *gdbarch, int signo);
985*ef5ccd6cSJohn Marino extern void set_gdbarch_gdb_signal_from_target (struct gdbarch *gdbarch, gdbarch_gdb_signal_from_target_ftype *gdb_signal_from_target);
9865796c8dcSSimon Schubert 
9875796c8dcSSimon Schubert /* Extra signal info inspection.
9885796c8dcSSimon Schubert 
9895796c8dcSSimon Schubert    Return a type suitable to inspect extra signal information. */
9905796c8dcSSimon Schubert 
9915796c8dcSSimon Schubert extern int gdbarch_get_siginfo_type_p (struct gdbarch *gdbarch);
9925796c8dcSSimon Schubert 
9935796c8dcSSimon Schubert typedef struct type * (gdbarch_get_siginfo_type_ftype) (struct gdbarch *gdbarch);
9945796c8dcSSimon Schubert extern struct type * gdbarch_get_siginfo_type (struct gdbarch *gdbarch);
9955796c8dcSSimon Schubert extern void set_gdbarch_get_siginfo_type (struct gdbarch *gdbarch, gdbarch_get_siginfo_type_ftype *get_siginfo_type);
9965796c8dcSSimon Schubert 
9975796c8dcSSimon Schubert /* Record architecture-specific information from the symbol table. */
9985796c8dcSSimon Schubert 
9995796c8dcSSimon Schubert extern int gdbarch_record_special_symbol_p (struct gdbarch *gdbarch);
10005796c8dcSSimon Schubert 
10015796c8dcSSimon Schubert typedef void (gdbarch_record_special_symbol_ftype) (struct gdbarch *gdbarch, struct objfile *objfile, asymbol *sym);
10025796c8dcSSimon Schubert extern void gdbarch_record_special_symbol (struct gdbarch *gdbarch, struct objfile *objfile, asymbol *sym);
10035796c8dcSSimon Schubert extern void set_gdbarch_record_special_symbol (struct gdbarch *gdbarch, gdbarch_record_special_symbol_ftype *record_special_symbol);
10045796c8dcSSimon Schubert 
10055796c8dcSSimon Schubert /* Function for the 'catch syscall' feature.
10065796c8dcSSimon Schubert    Get architecture-specific system calls information from registers. */
10075796c8dcSSimon Schubert 
10085796c8dcSSimon Schubert extern int gdbarch_get_syscall_number_p (struct gdbarch *gdbarch);
10095796c8dcSSimon Schubert 
10105796c8dcSSimon Schubert typedef LONGEST (gdbarch_get_syscall_number_ftype) (struct gdbarch *gdbarch, ptid_t ptid);
10115796c8dcSSimon Schubert extern LONGEST gdbarch_get_syscall_number (struct gdbarch *gdbarch, ptid_t ptid);
10125796c8dcSSimon Schubert extern void set_gdbarch_get_syscall_number (struct gdbarch *gdbarch, gdbarch_get_syscall_number_ftype *get_syscall_number);
10135796c8dcSSimon Schubert 
1014*ef5ccd6cSJohn Marino /* SystemTap related fields and functions.
1015*ef5ccd6cSJohn Marino    Prefix used to mark an integer constant on the architecture's assembly
1016*ef5ccd6cSJohn Marino    For example, on x86 integer constants are written as:
1017*ef5ccd6cSJohn Marino 
1018*ef5ccd6cSJohn Marino     $10 ;; integer constant 10
1019*ef5ccd6cSJohn Marino 
1020*ef5ccd6cSJohn Marino    in this case, this prefix would be the character `$'. */
1021*ef5ccd6cSJohn Marino 
1022*ef5ccd6cSJohn Marino extern const char * gdbarch_stap_integer_prefix (struct gdbarch *gdbarch);
1023*ef5ccd6cSJohn Marino extern void set_gdbarch_stap_integer_prefix (struct gdbarch *gdbarch, const char * stap_integer_prefix);
1024*ef5ccd6cSJohn Marino 
1025*ef5ccd6cSJohn Marino /* Suffix used to mark an integer constant on the architecture's assembly. */
1026*ef5ccd6cSJohn Marino 
1027*ef5ccd6cSJohn Marino extern const char * gdbarch_stap_integer_suffix (struct gdbarch *gdbarch);
1028*ef5ccd6cSJohn Marino extern void set_gdbarch_stap_integer_suffix (struct gdbarch *gdbarch, const char * stap_integer_suffix);
1029*ef5ccd6cSJohn Marino 
1030*ef5ccd6cSJohn Marino /* Prefix used to mark a register name on the architecture's assembly.
1031*ef5ccd6cSJohn Marino    For example, on x86 the register name is written as:
1032*ef5ccd6cSJohn Marino 
1033*ef5ccd6cSJohn Marino     %eax ;; register eax
1034*ef5ccd6cSJohn Marino 
1035*ef5ccd6cSJohn Marino    in this case, this prefix would be the character `%'. */
1036*ef5ccd6cSJohn Marino 
1037*ef5ccd6cSJohn Marino extern const char * gdbarch_stap_register_prefix (struct gdbarch *gdbarch);
1038*ef5ccd6cSJohn Marino extern void set_gdbarch_stap_register_prefix (struct gdbarch *gdbarch, const char * stap_register_prefix);
1039*ef5ccd6cSJohn Marino 
1040*ef5ccd6cSJohn Marino /* Suffix used to mark a register name on the architecture's assembly */
1041*ef5ccd6cSJohn Marino 
1042*ef5ccd6cSJohn Marino extern const char * gdbarch_stap_register_suffix (struct gdbarch *gdbarch);
1043*ef5ccd6cSJohn Marino extern void set_gdbarch_stap_register_suffix (struct gdbarch *gdbarch, const char * stap_register_suffix);
1044*ef5ccd6cSJohn Marino 
1045*ef5ccd6cSJohn Marino /* Prefix used to mark a register indirection on the architecture's assembly.
1046*ef5ccd6cSJohn Marino    For example, on x86 the register indirection is written as:
1047*ef5ccd6cSJohn Marino 
1048*ef5ccd6cSJohn Marino     (%eax) ;; indirecting eax
1049*ef5ccd6cSJohn Marino 
1050*ef5ccd6cSJohn Marino    in this case, this prefix would be the charater `('.
1051*ef5ccd6cSJohn Marino 
1052*ef5ccd6cSJohn Marino    Please note that we use the indirection prefix also for register
1053*ef5ccd6cSJohn Marino    displacement, e.g., `4(%eax)' on x86. */
1054*ef5ccd6cSJohn Marino 
1055*ef5ccd6cSJohn Marino extern const char * gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch);
1056*ef5ccd6cSJohn Marino extern void set_gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch, const char * stap_register_indirection_prefix);
1057*ef5ccd6cSJohn Marino 
1058*ef5ccd6cSJohn Marino /* Suffix used to mark a register indirection on the architecture's assembly.
1059*ef5ccd6cSJohn Marino    For example, on x86 the register indirection is written as:
1060*ef5ccd6cSJohn Marino 
1061*ef5ccd6cSJohn Marino     (%eax) ;; indirecting eax
1062*ef5ccd6cSJohn Marino 
1063*ef5ccd6cSJohn Marino    in this case, this prefix would be the charater `)'.
1064*ef5ccd6cSJohn Marino 
1065*ef5ccd6cSJohn Marino    Please note that we use the indirection suffix also for register
1066*ef5ccd6cSJohn Marino    displacement, e.g., `4(%eax)' on x86. */
1067*ef5ccd6cSJohn Marino 
1068*ef5ccd6cSJohn Marino extern const char * gdbarch_stap_register_indirection_suffix (struct gdbarch *gdbarch);
1069*ef5ccd6cSJohn Marino extern void set_gdbarch_stap_register_indirection_suffix (struct gdbarch *gdbarch, const char * stap_register_indirection_suffix);
1070*ef5ccd6cSJohn Marino 
1071*ef5ccd6cSJohn Marino /* Prefix used to name a register using GDB's nomenclature.
1072*ef5ccd6cSJohn Marino 
1073*ef5ccd6cSJohn Marino    For example, on PPC a register is represented by a number in the assembly
1074*ef5ccd6cSJohn Marino    language (e.g., `10' is the 10th general-purpose register).  However,
1075*ef5ccd6cSJohn Marino    inside GDB this same register has an `r' appended to its name, so the 10th
1076*ef5ccd6cSJohn Marino    register would be represented as `r10' internally. */
1077*ef5ccd6cSJohn Marino 
1078*ef5ccd6cSJohn Marino extern const char * gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch);
1079*ef5ccd6cSJohn Marino extern void set_gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch, const char * stap_gdb_register_prefix);
1080*ef5ccd6cSJohn Marino 
1081*ef5ccd6cSJohn Marino /* Suffix used to name a register using GDB's nomenclature. */
1082*ef5ccd6cSJohn Marino 
1083*ef5ccd6cSJohn Marino extern const char * gdbarch_stap_gdb_register_suffix (struct gdbarch *gdbarch);
1084*ef5ccd6cSJohn Marino extern void set_gdbarch_stap_gdb_register_suffix (struct gdbarch *gdbarch, const char * stap_gdb_register_suffix);
1085*ef5ccd6cSJohn Marino 
1086*ef5ccd6cSJohn Marino /* Check if S is a single operand.
1087*ef5ccd6cSJohn Marino 
1088*ef5ccd6cSJohn Marino    Single operands can be:
1089*ef5ccd6cSJohn Marino     - Literal integers, e.g. `$10' on x86
1090*ef5ccd6cSJohn Marino     - Register access, e.g. `%eax' on x86
1091*ef5ccd6cSJohn Marino     - Register indirection, e.g. `(%eax)' on x86
1092*ef5ccd6cSJohn Marino     - Register displacement, e.g. `4(%eax)' on x86
1093*ef5ccd6cSJohn Marino 
1094*ef5ccd6cSJohn Marino    This function should check for these patterns on the string
1095*ef5ccd6cSJohn Marino    and return 1 if some were found, or zero otherwise.  Please try to match
1096*ef5ccd6cSJohn Marino    as much info as you can from the string, i.e., if you have to match
1097*ef5ccd6cSJohn Marino    something like `(%', do not match just the `('. */
1098*ef5ccd6cSJohn Marino 
1099*ef5ccd6cSJohn Marino extern int gdbarch_stap_is_single_operand_p (struct gdbarch *gdbarch);
1100*ef5ccd6cSJohn Marino 
1101*ef5ccd6cSJohn Marino typedef int (gdbarch_stap_is_single_operand_ftype) (struct gdbarch *gdbarch, const char *s);
1102*ef5ccd6cSJohn Marino extern int gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, const char *s);
1103*ef5ccd6cSJohn Marino extern void set_gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, gdbarch_stap_is_single_operand_ftype *stap_is_single_operand);
1104*ef5ccd6cSJohn Marino 
1105*ef5ccd6cSJohn Marino /* Function used to handle a "special case" in the parser.
1106*ef5ccd6cSJohn Marino 
1107*ef5ccd6cSJohn Marino    A "special case" is considered to be an unknown token, i.e., a token
1108*ef5ccd6cSJohn Marino    that the parser does not know how to parse.  A good example of special
1109*ef5ccd6cSJohn Marino    case would be ARM's register displacement syntax:
1110*ef5ccd6cSJohn Marino 
1111*ef5ccd6cSJohn Marino     [R0, #4]  ;; displacing R0 by 4
1112*ef5ccd6cSJohn Marino 
1113*ef5ccd6cSJohn Marino    Since the parser assumes that a register displacement is of the form:
1114*ef5ccd6cSJohn Marino 
1115*ef5ccd6cSJohn Marino     <number> <indirection_prefix> <register_name> <indirection_suffix>
1116*ef5ccd6cSJohn Marino 
1117*ef5ccd6cSJohn Marino    it means that it will not be able to recognize and parse this odd syntax.
1118*ef5ccd6cSJohn Marino    Therefore, we should add a special case function that will handle this token.
1119*ef5ccd6cSJohn Marino 
1120*ef5ccd6cSJohn Marino    This function should generate the proper expression form of the expression
1121*ef5ccd6cSJohn Marino    using GDB's internal expression mechanism (e.g., `write_exp_elt_opcode'
1122*ef5ccd6cSJohn Marino    and so on).  It should also return 1 if the parsing was successful, or zero
1123*ef5ccd6cSJohn Marino    if the token was not recognized as a special token (in this case, returning
1124*ef5ccd6cSJohn Marino    zero means that the special parser is deferring the parsing to the generic
1125*ef5ccd6cSJohn Marino    parser), and should advance the buffer pointer (p->arg). */
1126*ef5ccd6cSJohn Marino 
1127*ef5ccd6cSJohn Marino extern int gdbarch_stap_parse_special_token_p (struct gdbarch *gdbarch);
1128*ef5ccd6cSJohn Marino 
1129*ef5ccd6cSJohn Marino typedef int (gdbarch_stap_parse_special_token_ftype) (struct gdbarch *gdbarch, struct stap_parse_info *p);
1130*ef5ccd6cSJohn Marino extern int gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, struct stap_parse_info *p);
1131*ef5ccd6cSJohn Marino extern void set_gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, gdbarch_stap_parse_special_token_ftype *stap_parse_special_token);
1132*ef5ccd6cSJohn Marino 
11335796c8dcSSimon Schubert /* True if the list of shared libraries is one and only for all
11345796c8dcSSimon Schubert    processes, as opposed to a list of shared libraries per inferior.
11355796c8dcSSimon Schubert    This usually means that all processes, although may or may not share
11365796c8dcSSimon Schubert    an address space, will see the same set of symbols at the same
11375796c8dcSSimon Schubert    addresses. */
11385796c8dcSSimon Schubert 
11395796c8dcSSimon Schubert extern int gdbarch_has_global_solist (struct gdbarch *gdbarch);
11405796c8dcSSimon Schubert extern void set_gdbarch_has_global_solist (struct gdbarch *gdbarch, int has_global_solist);
11415796c8dcSSimon Schubert 
11425796c8dcSSimon Schubert /* On some targets, even though each inferior has its own private
11435796c8dcSSimon Schubert    address space, the debug interface takes care of making breakpoints
11445796c8dcSSimon Schubert    visible to all address spaces automatically.  For such cases,
11455796c8dcSSimon Schubert    this property should be set to true. */
11465796c8dcSSimon Schubert 
11475796c8dcSSimon Schubert extern int gdbarch_has_global_breakpoints (struct gdbarch *gdbarch);
11485796c8dcSSimon Schubert extern void set_gdbarch_has_global_breakpoints (struct gdbarch *gdbarch, int has_global_breakpoints);
11495796c8dcSSimon Schubert 
1150cf7f2e2dSJohn Marino /* True if inferiors share an address space (e.g., uClinux). */
1151cf7f2e2dSJohn Marino 
1152cf7f2e2dSJohn Marino typedef int (gdbarch_has_shared_address_space_ftype) (struct gdbarch *gdbarch);
1153cf7f2e2dSJohn Marino extern int gdbarch_has_shared_address_space (struct gdbarch *gdbarch);
1154cf7f2e2dSJohn Marino extern void set_gdbarch_has_shared_address_space (struct gdbarch *gdbarch, gdbarch_has_shared_address_space_ftype *has_shared_address_space);
1155cf7f2e2dSJohn Marino 
1156cf7f2e2dSJohn Marino /* True if a fast tracepoint can be set at an address. */
1157cf7f2e2dSJohn Marino 
1158cf7f2e2dSJohn Marino typedef int (gdbarch_fast_tracepoint_valid_at_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr, int *isize, char **msg);
1159cf7f2e2dSJohn Marino extern int gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch, CORE_ADDR addr, int *isize, char **msg);
1160cf7f2e2dSJohn Marino extern void set_gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch, gdbarch_fast_tracepoint_valid_at_ftype *fast_tracepoint_valid_at);
1161cf7f2e2dSJohn Marino 
1162cf7f2e2dSJohn Marino /* Return the "auto" target charset. */
1163cf7f2e2dSJohn Marino 
1164cf7f2e2dSJohn Marino typedef const char * (gdbarch_auto_charset_ftype) (void);
1165cf7f2e2dSJohn Marino extern const char * gdbarch_auto_charset (struct gdbarch *gdbarch);
1166cf7f2e2dSJohn Marino extern void set_gdbarch_auto_charset (struct gdbarch *gdbarch, gdbarch_auto_charset_ftype *auto_charset);
1167cf7f2e2dSJohn Marino 
1168cf7f2e2dSJohn Marino /* Return the "auto" target wide charset. */
1169cf7f2e2dSJohn Marino 
1170cf7f2e2dSJohn Marino typedef const char * (gdbarch_auto_wide_charset_ftype) (void);
1171cf7f2e2dSJohn Marino extern const char * gdbarch_auto_wide_charset (struct gdbarch *gdbarch);
1172cf7f2e2dSJohn Marino extern void set_gdbarch_auto_wide_charset (struct gdbarch *gdbarch, gdbarch_auto_wide_charset_ftype *auto_wide_charset);
1173cf7f2e2dSJohn Marino 
1174cf7f2e2dSJohn Marino /* If non-empty, this is a file extension that will be opened in place
1175cf7f2e2dSJohn Marino    of the file extension reported by the shared library list.
1176cf7f2e2dSJohn Marino 
1177cf7f2e2dSJohn Marino    This is most useful for toolchains that use a post-linker tool,
1178cf7f2e2dSJohn Marino    where the names of the files run on the target differ in extension
1179cf7f2e2dSJohn Marino    compared to the names of the files GDB should load for debug info. */
1180cf7f2e2dSJohn Marino 
1181cf7f2e2dSJohn Marino extern const char * gdbarch_solib_symbols_extension (struct gdbarch *gdbarch);
1182cf7f2e2dSJohn Marino extern void set_gdbarch_solib_symbols_extension (struct gdbarch *gdbarch, const char * solib_symbols_extension);
1183cf7f2e2dSJohn Marino 
1184cf7f2e2dSJohn Marino /* If true, the target OS has DOS-based file system semantics.  That
1185cf7f2e2dSJohn Marino    is, absolute paths include a drive name, and the backslash is
1186cf7f2e2dSJohn Marino    considered a directory separator. */
1187cf7f2e2dSJohn Marino 
1188cf7f2e2dSJohn Marino extern int gdbarch_has_dos_based_file_system (struct gdbarch *gdbarch);
1189cf7f2e2dSJohn Marino extern void set_gdbarch_has_dos_based_file_system (struct gdbarch *gdbarch, int has_dos_based_file_system);
1190cf7f2e2dSJohn Marino 
1191a45ae5f8SJohn Marino /* Generate bytecodes to collect the return address in a frame.
1192a45ae5f8SJohn Marino    Since the bytecodes run on the target, possibly with GDB not even
1193a45ae5f8SJohn Marino    connected, the full unwinding machinery is not available, and
1194a45ae5f8SJohn Marino    typically this function will issue bytecodes for one or more likely
1195a45ae5f8SJohn Marino    places that the return address may be found. */
1196a45ae5f8SJohn Marino 
1197a45ae5f8SJohn Marino typedef void (gdbarch_gen_return_address_ftype) (struct gdbarch *gdbarch, struct agent_expr *ax, struct axs_value *value, CORE_ADDR scope);
1198a45ae5f8SJohn Marino extern void gdbarch_gen_return_address (struct gdbarch *gdbarch, struct agent_expr *ax, struct axs_value *value, CORE_ADDR scope);
1199a45ae5f8SJohn Marino extern void set_gdbarch_gen_return_address (struct gdbarch *gdbarch, gdbarch_gen_return_address_ftype *gen_return_address);
1200a45ae5f8SJohn Marino 
1201*ef5ccd6cSJohn Marino /* Implement the "info proc" command. */
1202*ef5ccd6cSJohn Marino 
1203*ef5ccd6cSJohn Marino extern int gdbarch_info_proc_p (struct gdbarch *gdbarch);
1204*ef5ccd6cSJohn Marino 
1205*ef5ccd6cSJohn Marino typedef void (gdbarch_info_proc_ftype) (struct gdbarch *gdbarch, char *args, enum info_proc_what what);
1206*ef5ccd6cSJohn Marino extern void gdbarch_info_proc (struct gdbarch *gdbarch, char *args, enum info_proc_what what);
1207*ef5ccd6cSJohn Marino extern void set_gdbarch_info_proc (struct gdbarch *gdbarch, gdbarch_info_proc_ftype *info_proc);
1208*ef5ccd6cSJohn Marino 
1209*ef5ccd6cSJohn Marino /* Implement the "info proc" command for core files.  Noe that there
1210*ef5ccd6cSJohn Marino    are two "info_proc"-like methods on gdbarch -- one for core files,
1211*ef5ccd6cSJohn Marino    one for live targets. */
1212*ef5ccd6cSJohn Marino 
1213*ef5ccd6cSJohn Marino extern int gdbarch_core_info_proc_p (struct gdbarch *gdbarch);
1214*ef5ccd6cSJohn Marino 
1215*ef5ccd6cSJohn Marino typedef void (gdbarch_core_info_proc_ftype) (struct gdbarch *gdbarch, char *args, enum info_proc_what what);
1216*ef5ccd6cSJohn Marino extern void gdbarch_core_info_proc (struct gdbarch *gdbarch, char *args, enum info_proc_what what);
1217*ef5ccd6cSJohn Marino extern void set_gdbarch_core_info_proc (struct gdbarch *gdbarch, gdbarch_core_info_proc_ftype *core_info_proc);
1218*ef5ccd6cSJohn Marino 
1219*ef5ccd6cSJohn Marino /* Iterate over all objfiles in the order that makes the most sense
1220*ef5ccd6cSJohn Marino    for the architecture to make global symbol searches.
1221*ef5ccd6cSJohn Marino 
1222*ef5ccd6cSJohn Marino    CB is a callback function where OBJFILE is the objfile to be searched,
1223*ef5ccd6cSJohn Marino    and CB_DATA a pointer to user-defined data (the same data that is passed
1224*ef5ccd6cSJohn Marino    when calling this gdbarch method).  The iteration stops if this function
1225*ef5ccd6cSJohn Marino    returns nonzero.
1226*ef5ccd6cSJohn Marino 
1227*ef5ccd6cSJohn Marino    CB_DATA is a pointer to some user-defined data to be passed to
1228*ef5ccd6cSJohn Marino    the callback.
1229*ef5ccd6cSJohn Marino 
1230*ef5ccd6cSJohn Marino    If not NULL, CURRENT_OBJFILE corresponds to the objfile being
1231*ef5ccd6cSJohn Marino    inspected when the symbol search was requested. */
1232*ef5ccd6cSJohn Marino 
1233*ef5ccd6cSJohn Marino typedef void (gdbarch_iterate_over_objfiles_in_search_order_ftype) (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype *cb, void *cb_data, struct objfile *current_objfile);
1234*ef5ccd6cSJohn Marino extern void gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype *cb, void *cb_data, struct objfile *current_objfile);
1235*ef5ccd6cSJohn Marino extern void set_gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, gdbarch_iterate_over_objfiles_in_search_order_ftype *iterate_over_objfiles_in_search_order);
1236*ef5ccd6cSJohn Marino 
1237*ef5ccd6cSJohn Marino /* Ravenscar arch-dependent ops. */
1238*ef5ccd6cSJohn Marino 
1239*ef5ccd6cSJohn Marino extern struct ravenscar_arch_ops * gdbarch_ravenscar_ops (struct gdbarch *gdbarch);
1240*ef5ccd6cSJohn Marino extern void set_gdbarch_ravenscar_ops (struct gdbarch *gdbarch, struct ravenscar_arch_ops * ravenscar_ops);
1241*ef5ccd6cSJohn Marino 
12425796c8dcSSimon Schubert /* Definition for an unknown syscall, used basically in error-cases.  */
12435796c8dcSSimon Schubert #define UNKNOWN_SYSCALL (-1)
12445796c8dcSSimon Schubert 
12455796c8dcSSimon Schubert extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);
12465796c8dcSSimon Schubert 
12475796c8dcSSimon Schubert 
12485796c8dcSSimon Schubert /* Mechanism for co-ordinating the selection of a specific
12495796c8dcSSimon Schubert    architecture.
12505796c8dcSSimon Schubert 
12515796c8dcSSimon Schubert    GDB targets (*-tdep.c) can register an interest in a specific
12525796c8dcSSimon Schubert    architecture.  Other GDB components can register a need to maintain
12535796c8dcSSimon Schubert    per-architecture data.
12545796c8dcSSimon Schubert 
12555796c8dcSSimon Schubert    The mechanisms below ensures that there is only a loose connection
12565796c8dcSSimon Schubert    between the set-architecture command and the various GDB
12575796c8dcSSimon Schubert    components.  Each component can independently register their need
12585796c8dcSSimon Schubert    to maintain architecture specific data with gdbarch.
12595796c8dcSSimon Schubert 
12605796c8dcSSimon Schubert    Pragmatics:
12615796c8dcSSimon Schubert 
12625796c8dcSSimon Schubert    Previously, a single TARGET_ARCHITECTURE_HOOK was provided.  It
12635796c8dcSSimon Schubert    didn't scale.
12645796c8dcSSimon Schubert 
12655796c8dcSSimon Schubert    The more traditional mega-struct containing architecture specific
12665796c8dcSSimon Schubert    data for all the various GDB components was also considered.  Since
12675796c8dcSSimon Schubert    GDB is built from a variable number of (fairly independent)
12685796c8dcSSimon Schubert    components it was determined that the global aproach was not
12695796c8dcSSimon Schubert    applicable.  */
12705796c8dcSSimon Schubert 
12715796c8dcSSimon Schubert 
12725796c8dcSSimon Schubert /* Register a new architectural family with GDB.
12735796c8dcSSimon Schubert 
12745796c8dcSSimon Schubert    Register support for the specified ARCHITECTURE with GDB.  When
12755796c8dcSSimon Schubert    gdbarch determines that the specified architecture has been
12765796c8dcSSimon Schubert    selected, the corresponding INIT function is called.
12775796c8dcSSimon Schubert 
12785796c8dcSSimon Schubert    --
12795796c8dcSSimon Schubert 
12805796c8dcSSimon Schubert    The INIT function takes two parameters: INFO which contains the
12815796c8dcSSimon Schubert    information available to gdbarch about the (possibly new)
12825796c8dcSSimon Schubert    architecture; ARCHES which is a list of the previously created
12835796c8dcSSimon Schubert    ``struct gdbarch'' for this architecture.
12845796c8dcSSimon Schubert 
12855796c8dcSSimon Schubert    The INFO parameter is, as far as possible, be pre-initialized with
12865796c8dcSSimon Schubert    information obtained from INFO.ABFD or the global defaults.
12875796c8dcSSimon Schubert 
12885796c8dcSSimon Schubert    The ARCHES parameter is a linked list (sorted most recently used)
12895796c8dcSSimon Schubert    of all the previously created architures for this architecture
12905796c8dcSSimon Schubert    family.  The (possibly NULL) ARCHES->gdbarch can used to access
12915796c8dcSSimon Schubert    values from the previously selected architecture for this
12925796c8dcSSimon Schubert    architecture family.
12935796c8dcSSimon Schubert 
12945796c8dcSSimon Schubert    The INIT function shall return any of: NULL - indicating that it
12955796c8dcSSimon Schubert    doesn't recognize the selected architecture; an existing ``struct
12965796c8dcSSimon Schubert    gdbarch'' from the ARCHES list - indicating that the new
12975796c8dcSSimon Schubert    architecture is just a synonym for an earlier architecture (see
12985796c8dcSSimon Schubert    gdbarch_list_lookup_by_info()); a newly created ``struct gdbarch''
12995796c8dcSSimon Schubert    - that describes the selected architecture (see gdbarch_alloc()).
13005796c8dcSSimon Schubert 
13015796c8dcSSimon Schubert    The DUMP_TDEP function shall print out all target specific values.
13025796c8dcSSimon Schubert    Care should be taken to ensure that the function works in both the
13035796c8dcSSimon Schubert    multi-arch and non- multi-arch cases.  */
13045796c8dcSSimon Schubert 
13055796c8dcSSimon Schubert struct gdbarch_list
13065796c8dcSSimon Schubert {
13075796c8dcSSimon Schubert   struct gdbarch *gdbarch;
13085796c8dcSSimon Schubert   struct gdbarch_list *next;
13095796c8dcSSimon Schubert };
13105796c8dcSSimon Schubert 
13115796c8dcSSimon Schubert struct gdbarch_info
13125796c8dcSSimon Schubert {
13135796c8dcSSimon Schubert   /* Use default: NULL (ZERO).  */
13145796c8dcSSimon Schubert   const struct bfd_arch_info *bfd_arch_info;
13155796c8dcSSimon Schubert 
13165796c8dcSSimon Schubert   /* Use default: BFD_ENDIAN_UNKNOWN (NB: is not ZERO).  */
13175796c8dcSSimon Schubert   int byte_order;
13185796c8dcSSimon Schubert 
13195796c8dcSSimon Schubert   int byte_order_for_code;
13205796c8dcSSimon Schubert 
13215796c8dcSSimon Schubert   /* Use default: NULL (ZERO).  */
13225796c8dcSSimon Schubert   bfd *abfd;
13235796c8dcSSimon Schubert 
13245796c8dcSSimon Schubert   /* Use default: NULL (ZERO).  */
13255796c8dcSSimon Schubert   struct gdbarch_tdep_info *tdep_info;
13265796c8dcSSimon Schubert 
13275796c8dcSSimon Schubert   /* Use default: GDB_OSABI_UNINITIALIZED (-1).  */
13285796c8dcSSimon Schubert   enum gdb_osabi osabi;
13295796c8dcSSimon Schubert 
13305796c8dcSSimon Schubert   /* Use default: NULL (ZERO).  */
13315796c8dcSSimon Schubert   const struct target_desc *target_desc;
13325796c8dcSSimon Schubert };
13335796c8dcSSimon Schubert 
13345796c8dcSSimon Schubert typedef struct gdbarch *(gdbarch_init_ftype) (struct gdbarch_info info, struct gdbarch_list *arches);
13355796c8dcSSimon Schubert typedef void (gdbarch_dump_tdep_ftype) (struct gdbarch *gdbarch, struct ui_file *file);
13365796c8dcSSimon Schubert 
13375796c8dcSSimon Schubert /* DEPRECATED - use gdbarch_register() */
13385796c8dcSSimon Schubert extern void register_gdbarch_init (enum bfd_architecture architecture, gdbarch_init_ftype *);
13395796c8dcSSimon Schubert 
13405796c8dcSSimon Schubert extern void gdbarch_register (enum bfd_architecture architecture,
13415796c8dcSSimon Schubert                               gdbarch_init_ftype *,
13425796c8dcSSimon Schubert                               gdbarch_dump_tdep_ftype *);
13435796c8dcSSimon Schubert 
13445796c8dcSSimon Schubert 
13455796c8dcSSimon Schubert /* Return a freshly allocated, NULL terminated, array of the valid
13465796c8dcSSimon Schubert    architecture names.  Since architectures are registered during the
13475796c8dcSSimon Schubert    _initialize phase this function only returns useful information
13485796c8dcSSimon Schubert    once initialization has been completed.  */
13495796c8dcSSimon Schubert 
13505796c8dcSSimon Schubert extern const char **gdbarch_printable_names (void);
13515796c8dcSSimon Schubert 
13525796c8dcSSimon Schubert 
13535796c8dcSSimon Schubert /* Helper function.  Search the list of ARCHES for a GDBARCH that
13545796c8dcSSimon Schubert    matches the information provided by INFO.  */
13555796c8dcSSimon Schubert 
13565796c8dcSSimon Schubert extern struct gdbarch_list *gdbarch_list_lookup_by_info (struct gdbarch_list *arches, const struct gdbarch_info *info);
13575796c8dcSSimon Schubert 
13585796c8dcSSimon Schubert 
13595796c8dcSSimon Schubert /* Helper function.  Create a preliminary ``struct gdbarch''.  Perform
13605796c8dcSSimon Schubert    basic initialization using values obtained from the INFO and TDEP
13615796c8dcSSimon Schubert    parameters.  set_gdbarch_*() functions are called to complete the
13625796c8dcSSimon Schubert    initialization of the object.  */
13635796c8dcSSimon Schubert 
13645796c8dcSSimon Schubert extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info, struct gdbarch_tdep *tdep);
13655796c8dcSSimon Schubert 
13665796c8dcSSimon Schubert 
13675796c8dcSSimon Schubert /* Helper function.  Free a partially-constructed ``struct gdbarch''.
13685796c8dcSSimon Schubert    It is assumed that the caller freeds the ``struct
13695796c8dcSSimon Schubert    gdbarch_tdep''.  */
13705796c8dcSSimon Schubert 
13715796c8dcSSimon Schubert extern void gdbarch_free (struct gdbarch *);
13725796c8dcSSimon Schubert 
13735796c8dcSSimon Schubert 
13745796c8dcSSimon Schubert /* Helper function.  Allocate memory from the ``struct gdbarch''
13755796c8dcSSimon Schubert    obstack.  The memory is freed when the corresponding architecture
13765796c8dcSSimon Schubert    is also freed.  */
13775796c8dcSSimon Schubert 
13785796c8dcSSimon Schubert extern void *gdbarch_obstack_zalloc (struct gdbarch *gdbarch, long size);
13795796c8dcSSimon Schubert #define GDBARCH_OBSTACK_CALLOC(GDBARCH, NR, TYPE) ((TYPE *) gdbarch_obstack_zalloc ((GDBARCH), (NR) * sizeof (TYPE)))
13805796c8dcSSimon Schubert #define GDBARCH_OBSTACK_ZALLOC(GDBARCH, TYPE) ((TYPE *) gdbarch_obstack_zalloc ((GDBARCH), sizeof (TYPE)))
13815796c8dcSSimon Schubert 
13825796c8dcSSimon Schubert 
13835796c8dcSSimon Schubert /* Helper function.  Force an update of the current architecture.
13845796c8dcSSimon Schubert 
13855796c8dcSSimon Schubert    The actual architecture selected is determined by INFO, ``(gdb) set
13865796c8dcSSimon Schubert    architecture'' et.al., the existing architecture and BFD's default
13875796c8dcSSimon Schubert    architecture.  INFO should be initialized to zero and then selected
13885796c8dcSSimon Schubert    fields should be updated.
13895796c8dcSSimon Schubert 
1390c50c785cSJohn Marino    Returns non-zero if the update succeeds.  */
13915796c8dcSSimon Schubert 
13925796c8dcSSimon Schubert extern int gdbarch_update_p (struct gdbarch_info info);
13935796c8dcSSimon Schubert 
13945796c8dcSSimon Schubert 
13955796c8dcSSimon Schubert /* Helper function.  Find an architecture matching info.
13965796c8dcSSimon Schubert 
13975796c8dcSSimon Schubert    INFO should be initialized using gdbarch_info_init, relevant fields
13985796c8dcSSimon Schubert    set, and then finished using gdbarch_info_fill.
13995796c8dcSSimon Schubert 
14005796c8dcSSimon Schubert    Returns the corresponding architecture, or NULL if no matching
14015796c8dcSSimon Schubert    architecture was found.  */
14025796c8dcSSimon Schubert 
14035796c8dcSSimon Schubert extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info);
14045796c8dcSSimon Schubert 
14055796c8dcSSimon Schubert 
1406*ef5ccd6cSJohn Marino /* Helper function.  Set the target gdbarch to "gdbarch".  */
14075796c8dcSSimon Schubert 
1408*ef5ccd6cSJohn Marino extern void set_target_gdbarch (struct gdbarch *gdbarch);
14095796c8dcSSimon Schubert 
14105796c8dcSSimon Schubert 
14115796c8dcSSimon Schubert /* Register per-architecture data-pointer.
14125796c8dcSSimon Schubert 
14135796c8dcSSimon Schubert    Reserve space for a per-architecture data-pointer.  An identifier
14145796c8dcSSimon Schubert    for the reserved data-pointer is returned.  That identifer should
14155796c8dcSSimon Schubert    be saved in a local static variable.
14165796c8dcSSimon Schubert 
14175796c8dcSSimon Schubert    Memory for the per-architecture data shall be allocated using
14185796c8dcSSimon Schubert    gdbarch_obstack_zalloc.  That memory will be deleted when the
14195796c8dcSSimon Schubert    corresponding architecture object is deleted.
14205796c8dcSSimon Schubert 
14215796c8dcSSimon Schubert    When a previously created architecture is re-selected, the
14225796c8dcSSimon Schubert    per-architecture data-pointer for that previous architecture is
14235796c8dcSSimon Schubert    restored.  INIT() is not re-called.
14245796c8dcSSimon Schubert 
14255796c8dcSSimon Schubert    Multiple registrarants for any architecture are allowed (and
14265796c8dcSSimon Schubert    strongly encouraged).  */
14275796c8dcSSimon Schubert 
14285796c8dcSSimon Schubert struct gdbarch_data;
14295796c8dcSSimon Schubert 
14305796c8dcSSimon Schubert typedef void *(gdbarch_data_pre_init_ftype) (struct obstack *obstack);
14315796c8dcSSimon Schubert extern struct gdbarch_data *gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *init);
14325796c8dcSSimon Schubert typedef void *(gdbarch_data_post_init_ftype) (struct gdbarch *gdbarch);
14335796c8dcSSimon Schubert extern struct gdbarch_data *gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *init);
14345796c8dcSSimon Schubert extern void deprecated_set_gdbarch_data (struct gdbarch *gdbarch,
14355796c8dcSSimon Schubert                                          struct gdbarch_data *data,
14365796c8dcSSimon Schubert 			                 void *pointer);
14375796c8dcSSimon Schubert 
14385796c8dcSSimon Schubert extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *);
14395796c8dcSSimon Schubert 
14405796c8dcSSimon Schubert 
14415796c8dcSSimon Schubert /* Set the dynamic target-system-dependent parameters (architecture,
1442c50c785cSJohn Marino    byte-order, ...) using information found in the BFD.  */
14435796c8dcSSimon Schubert 
14445796c8dcSSimon Schubert extern void set_gdbarch_from_file (bfd *);
14455796c8dcSSimon Schubert 
14465796c8dcSSimon Schubert 
14475796c8dcSSimon Schubert /* Initialize the current architecture to the "first" one we find on
14485796c8dcSSimon Schubert    our list.  */
14495796c8dcSSimon Schubert 
14505796c8dcSSimon Schubert extern void initialize_current_architecture (void);
14515796c8dcSSimon Schubert 
14525796c8dcSSimon Schubert /* gdbarch trace variable */
1453*ef5ccd6cSJohn Marino extern unsigned int gdbarch_debug;
14545796c8dcSSimon Schubert 
14555796c8dcSSimon Schubert extern void gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file);
14565796c8dcSSimon Schubert 
14575796c8dcSSimon Schubert #endif
1458