* gdbarch.sh (read_sp): Remove.
[deliverable/binutils-gdb.git] / gdb / gdbarch.h
CommitLineData
59233f88
AC
1/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
2
adf40b2e 3/* Dynamic architecture support for GDB, the GNU debugger.
79d45cd4 4
424163ea
DJ
5 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
c906108c 7
c5aa993b 8 This file is part of GDB.
c906108c 9
c5aa993b
JM
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
c906108c 14
c5aa993b
JM
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
c906108c 19
c5aa993b
JM
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
197e01b6
EZ
22 Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 Boston, MA 02110-1301, USA. */
c906108c 24
104c1213
JM
25/* This file was created with the aid of ``gdbarch.sh''.
26
52204a0b 27 The Bourne shell script ``gdbarch.sh'' creates the files
104c1213
JM
28 ``new-gdbarch.c'' and ``new-gdbarch.h and then compares them
29 against the existing ``gdbarch.[hc]''. Any differences found
30 being reported.
31
32 If editing this file, please also run gdbarch.sh and merge any
52204a0b 33 changes into that script. Conversely, when making sweeping changes
104c1213
JM
34 to this file, modifying gdbarch.sh and using its output may prove
35 easier. */
adf40b2e 36
c906108c
SS
37#ifndef GDBARCH_H
38#define GDBARCH_H
39
da3331ec
AC
40struct floatformat;
41struct ui_file;
cce74817
JM
42struct frame_info;
43struct value;
b6af0555 44struct objfile;
1c772458 45struct obj_section;
a2cf933a 46struct minimal_symbol;
049ee0e4 47struct regcache;
b59ff9d5 48struct reggroup;
6ce6d90f 49struct regset;
a89aa300 50struct disassemble_info;
e2d0e7eb 51struct target_ops;
030f20e1 52struct obstack;
8181d85f 53struct bp_target_info;
424163ea 54struct target_desc;
0f71a2f6 55
0f71a2f6
JM
56extern struct gdbarch *current_gdbarch;
57
0f71a2f6
JM
58
59/* The following are pre-initialized by GDBARCH. */
60
104c1213 61extern const struct bfd_arch_info * gdbarch_bfd_arch_info (struct gdbarch *gdbarch);
0f71a2f6 62/* set_gdbarch_bfd_arch_info() - not applicable - pre-initialized. */
5010d38b 63#if !defined (GDB_TM_FILE) && defined (TARGET_ARCHITECTURE)
83905903
AC
64#error "Non multi-arch definition of TARGET_ARCHITECTURE"
65#endif
c25083af 66#if !defined (TARGET_ARCHITECTURE)
0f71a2f6
JM
67#define TARGET_ARCHITECTURE (gdbarch_bfd_arch_info (current_gdbarch))
68#endif
0f71a2f6 69
104c1213 70extern int gdbarch_byte_order (struct gdbarch *gdbarch);
0f71a2f6 71/* set_gdbarch_byte_order() - not applicable - pre-initialized. */
5010d38b 72#if !defined (GDB_TM_FILE) && defined (TARGET_BYTE_ORDER)
83905903
AC
73#error "Non multi-arch definition of TARGET_BYTE_ORDER"
74#endif
c25083af 75#if !defined (TARGET_BYTE_ORDER)
0f71a2f6
JM
76#define TARGET_BYTE_ORDER (gdbarch_byte_order (current_gdbarch))
77#endif
0f71a2f6 78
4be87837
DJ
79extern enum gdb_osabi gdbarch_osabi (struct gdbarch *gdbarch);
80/* set_gdbarch_osabi() - not applicable - pre-initialized. */
5010d38b 81#if !defined (GDB_TM_FILE) && defined (TARGET_OSABI)
4be87837
DJ
82#error "Non multi-arch definition of TARGET_OSABI"
83#endif
c25083af 84#if !defined (TARGET_OSABI)
4be87837
DJ
85#define TARGET_OSABI (gdbarch_osabi (current_gdbarch))
86#endif
4be87837 87
424163ea
DJ
88extern const struct target_desc * gdbarch_target_desc (struct gdbarch *gdbarch);
89/* set_gdbarch_target_desc() - not applicable - pre-initialized. */
90
0f71a2f6 91
99e7bb18 92/* The following are initialized by the target dependent code. */
0f71a2f6 93
66b43ecb
AC
94/* Number of bits in a char or unsigned char for the target machine.
95 Just like CHAR_BIT in <limits.h> but describes the target machine.
57010b1c 96 v:TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):8::0:
66b43ecb
AC
97
98 Number of bits in a short or unsigned short for the target machine. */
c4093a6a 99
104c1213
JM
100extern int gdbarch_short_bit (struct gdbarch *gdbarch);
101extern void set_gdbarch_short_bit (struct gdbarch *gdbarch, int short_bit);
5010d38b 102#if !defined (GDB_TM_FILE) && defined (TARGET_SHORT_BIT)
83905903
AC
103#error "Non multi-arch definition of TARGET_SHORT_BIT"
104#endif
c25083af 105#if !defined (TARGET_SHORT_BIT)
0f71a2f6
JM
106#define TARGET_SHORT_BIT (gdbarch_short_bit (current_gdbarch))
107#endif
0f71a2f6 108
66b43ecb
AC
109/* Number of bits in an int or unsigned int for the target machine. */
110
104c1213
JM
111extern int gdbarch_int_bit (struct gdbarch *gdbarch);
112extern void set_gdbarch_int_bit (struct gdbarch *gdbarch, int int_bit);
5010d38b 113#if !defined (GDB_TM_FILE) && defined (TARGET_INT_BIT)
83905903
AC
114#error "Non multi-arch definition of TARGET_INT_BIT"
115#endif
c25083af 116#if !defined (TARGET_INT_BIT)
0f71a2f6
JM
117#define TARGET_INT_BIT (gdbarch_int_bit (current_gdbarch))
118#endif
0f71a2f6 119
66b43ecb
AC
120/* Number of bits in a long or unsigned long for the target machine. */
121
104c1213
JM
122extern int gdbarch_long_bit (struct gdbarch *gdbarch);
123extern void set_gdbarch_long_bit (struct gdbarch *gdbarch, int long_bit);
5010d38b 124#if !defined (GDB_TM_FILE) && defined (TARGET_LONG_BIT)
83905903
AC
125#error "Non multi-arch definition of TARGET_LONG_BIT"
126#endif
c25083af 127#if !defined (TARGET_LONG_BIT)
0f71a2f6
JM
128#define TARGET_LONG_BIT (gdbarch_long_bit (current_gdbarch))
129#endif
0f71a2f6 130
66b43ecb
AC
131/* Number of bits in a long long or unsigned long long for the target
132 machine. */
133
104c1213
JM
134extern int gdbarch_long_long_bit (struct gdbarch *gdbarch);
135extern void set_gdbarch_long_long_bit (struct gdbarch *gdbarch, int long_long_bit);
5010d38b 136#if !defined (GDB_TM_FILE) && defined (TARGET_LONG_LONG_BIT)
83905903
AC
137#error "Non multi-arch definition of TARGET_LONG_LONG_BIT"
138#endif
c25083af 139#if !defined (TARGET_LONG_LONG_BIT)
0f71a2f6
JM
140#define TARGET_LONG_LONG_BIT (gdbarch_long_long_bit (current_gdbarch))
141#endif
0f71a2f6 142
456fcf94
AC
143/* The ABI default bit-size and format for "float", "double", and "long
144 double". These bit/format pairs should eventually be combined into
8da61cc4
DJ
145 a single object. For the moment, just initialize them as a pair.
146 Each format describes both the big and little endian layouts (if
147 useful). */
66b43ecb 148
104c1213
JM
149extern int gdbarch_float_bit (struct gdbarch *gdbarch);
150extern void set_gdbarch_float_bit (struct gdbarch *gdbarch, int float_bit);
5010d38b 151#if !defined (GDB_TM_FILE) && defined (TARGET_FLOAT_BIT)
83905903
AC
152#error "Non multi-arch definition of TARGET_FLOAT_BIT"
153#endif
c25083af 154#if !defined (TARGET_FLOAT_BIT)
0f71a2f6
JM
155#define TARGET_FLOAT_BIT (gdbarch_float_bit (current_gdbarch))
156#endif
0f71a2f6 157
8da61cc4
DJ
158extern const struct floatformat ** gdbarch_float_format (struct gdbarch *gdbarch);
159extern void set_gdbarch_float_format (struct gdbarch *gdbarch, const struct floatformat ** float_format);
5010d38b 160#if !defined (GDB_TM_FILE) && defined (TARGET_FLOAT_FORMAT)
456fcf94
AC
161#error "Non multi-arch definition of TARGET_FLOAT_FORMAT"
162#endif
163#if !defined (TARGET_FLOAT_FORMAT)
164#define TARGET_FLOAT_FORMAT (gdbarch_float_format (current_gdbarch))
165#endif
66b43ecb 166
104c1213
JM
167extern int gdbarch_double_bit (struct gdbarch *gdbarch);
168extern void set_gdbarch_double_bit (struct gdbarch *gdbarch, int double_bit);
5010d38b 169#if !defined (GDB_TM_FILE) && defined (TARGET_DOUBLE_BIT)
83905903
AC
170#error "Non multi-arch definition of TARGET_DOUBLE_BIT"
171#endif
c25083af 172#if !defined (TARGET_DOUBLE_BIT)
0f71a2f6
JM
173#define TARGET_DOUBLE_BIT (gdbarch_double_bit (current_gdbarch))
174#endif
0f71a2f6 175
8da61cc4
DJ
176extern const struct floatformat ** gdbarch_double_format (struct gdbarch *gdbarch);
177extern void set_gdbarch_double_format (struct gdbarch *gdbarch, const struct floatformat ** double_format);
5010d38b 178#if !defined (GDB_TM_FILE) && defined (TARGET_DOUBLE_FORMAT)
456fcf94
AC
179#error "Non multi-arch definition of TARGET_DOUBLE_FORMAT"
180#endif
181#if !defined (TARGET_DOUBLE_FORMAT)
182#define TARGET_DOUBLE_FORMAT (gdbarch_double_format (current_gdbarch))
183#endif
66b43ecb 184
104c1213
JM
185extern int gdbarch_long_double_bit (struct gdbarch *gdbarch);
186extern void set_gdbarch_long_double_bit (struct gdbarch *gdbarch, int long_double_bit);
5010d38b 187#if !defined (GDB_TM_FILE) && defined (TARGET_LONG_DOUBLE_BIT)
83905903
AC
188#error "Non multi-arch definition of TARGET_LONG_DOUBLE_BIT"
189#endif
c25083af 190#if !defined (TARGET_LONG_DOUBLE_BIT)
0f71a2f6
JM
191#define TARGET_LONG_DOUBLE_BIT (gdbarch_long_double_bit (current_gdbarch))
192#endif
0f71a2f6 193
8da61cc4
DJ
194extern const struct floatformat ** gdbarch_long_double_format (struct gdbarch *gdbarch);
195extern void set_gdbarch_long_double_format (struct gdbarch *gdbarch, const struct floatformat ** long_double_format);
5010d38b 196#if !defined (GDB_TM_FILE) && defined (TARGET_LONG_DOUBLE_FORMAT)
456fcf94
AC
197#error "Non multi-arch definition of TARGET_LONG_DOUBLE_FORMAT"
198#endif
199#if !defined (TARGET_LONG_DOUBLE_FORMAT)
200#define TARGET_LONG_DOUBLE_FORMAT (gdbarch_long_double_format (current_gdbarch))
201#endif
202
52204a0b
DT
203/* For most targets, a pointer on the target and its representation as an
204 address in GDB have the same size and "look the same". For such a
205 target, you need only set TARGET_PTR_BIT / ptr_bit and TARGET_ADDR_BIT
206 / addr_bit will be set from it.
207
208 If TARGET_PTR_BIT and TARGET_ADDR_BIT are different, you'll probably
209 also need to set POINTER_TO_ADDRESS and ADDRESS_TO_POINTER as well.
210
211 ptr_bit is the size of a pointer on the target */
66b43ecb 212
66b43ecb
AC
213extern int gdbarch_ptr_bit (struct gdbarch *gdbarch);
214extern void set_gdbarch_ptr_bit (struct gdbarch *gdbarch, int ptr_bit);
5010d38b 215#if !defined (GDB_TM_FILE) && defined (TARGET_PTR_BIT)
83905903
AC
216#error "Non multi-arch definition of TARGET_PTR_BIT"
217#endif
c25083af 218#if !defined (TARGET_PTR_BIT)
66b43ecb
AC
219#define TARGET_PTR_BIT (gdbarch_ptr_bit (current_gdbarch))
220#endif
66b43ecb 221
52204a0b
DT
222/* addr_bit is the size of a target address as represented in gdb */
223
52204a0b
DT
224extern int gdbarch_addr_bit (struct gdbarch *gdbarch);
225extern void set_gdbarch_addr_bit (struct gdbarch *gdbarch, int addr_bit);
5010d38b 226#if !defined (GDB_TM_FILE) && defined (TARGET_ADDR_BIT)
83905903
AC
227#error "Non multi-arch definition of TARGET_ADDR_BIT"
228#endif
c25083af 229#if !defined (TARGET_ADDR_BIT)
52204a0b
DT
230#define TARGET_ADDR_BIT (gdbarch_addr_bit (current_gdbarch))
231#endif
52204a0b 232
66b43ecb
AC
233/* Number of bits in a BFD_VMA for the target object file format. */
234
66b43ecb
AC
235extern int gdbarch_bfd_vma_bit (struct gdbarch *gdbarch);
236extern void set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch, int bfd_vma_bit);
5010d38b 237#if !defined (GDB_TM_FILE) && defined (TARGET_BFD_VMA_BIT)
83905903
AC
238#error "Non multi-arch definition of TARGET_BFD_VMA_BIT"
239#endif
c25083af 240#if !defined (TARGET_BFD_VMA_BIT)
66b43ecb
AC
241#define TARGET_BFD_VMA_BIT (gdbarch_bfd_vma_bit (current_gdbarch))
242#endif
66b43ecb 243
4e409299
JB
244/* One if `char' acts like `signed char', zero if `unsigned char'. */
245
4e409299
JB
246extern int gdbarch_char_signed (struct gdbarch *gdbarch);
247extern void set_gdbarch_char_signed (struct gdbarch *gdbarch, int char_signed);
5010d38b 248#if !defined (GDB_TM_FILE) && defined (TARGET_CHAR_SIGNED)
4e409299
JB
249#error "Non multi-arch definition of TARGET_CHAR_SIGNED"
250#endif
c25083af 251#if !defined (TARGET_CHAR_SIGNED)
4e409299
JB
252#define TARGET_CHAR_SIGNED (gdbarch_char_signed (current_gdbarch))
253#endif
4e409299 254
cde9ea48
AC
255#if defined (TARGET_READ_PC)
256/* Legacy for systems yet to multi-arch TARGET_READ_PC */
257#if !defined (TARGET_READ_PC_P)
258#define TARGET_READ_PC_P() (1)
259#endif
260#endif
261
cde9ea48 262extern int gdbarch_read_pc_p (struct gdbarch *gdbarch);
5010d38b 263#if !defined (GDB_TM_FILE) && defined (TARGET_READ_PC_P)
cde9ea48
AC
264#error "Non multi-arch definition of TARGET_READ_PC"
265#endif
bceabdd8 266#if !defined (TARGET_READ_PC_P)
cde9ea48
AC
267#define TARGET_READ_PC_P() (gdbarch_read_pc_p (current_gdbarch))
268#endif
269
39f77062
KB
270typedef CORE_ADDR (gdbarch_read_pc_ftype) (ptid_t ptid);
271extern CORE_ADDR gdbarch_read_pc (struct gdbarch *gdbarch, ptid_t ptid);
104c1213 272extern void set_gdbarch_read_pc (struct gdbarch *gdbarch, gdbarch_read_pc_ftype *read_pc);
5010d38b 273#if !defined (GDB_TM_FILE) && defined (TARGET_READ_PC)
83905903
AC
274#error "Non multi-arch definition of TARGET_READ_PC"
275#endif
c25083af 276#if !defined (TARGET_READ_PC)
39f77062 277#define TARGET_READ_PC(ptid) (gdbarch_read_pc (current_gdbarch, ptid))
0f71a2f6 278#endif
0f71a2f6 279
39f77062
KB
280typedef void (gdbarch_write_pc_ftype) (CORE_ADDR val, ptid_t ptid);
281extern void gdbarch_write_pc (struct gdbarch *gdbarch, CORE_ADDR val, ptid_t ptid);
104c1213 282extern void set_gdbarch_write_pc (struct gdbarch *gdbarch, gdbarch_write_pc_ftype *write_pc);
5010d38b 283#if !defined (GDB_TM_FILE) && defined (TARGET_WRITE_PC)
83905903
AC
284#error "Non multi-arch definition of TARGET_WRITE_PC"
285#endif
c25083af 286#if !defined (TARGET_WRITE_PC)
39f77062 287#define TARGET_WRITE_PC(val, ptid) (gdbarch_write_pc (current_gdbarch, val, ptid))
0f71a2f6 288#endif
0f71a2f6 289
39d4ef09
AC
290/* Function for getting target's idea of a frame pointer. FIXME: GDB's
291 whole scheme for dealing with "frames" and "frame pointers" needs a
292 serious shakedown. */
293
39d4ef09
AC
294typedef void (gdbarch_virtual_frame_pointer_ftype) (CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset);
295extern void gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset);
296extern void set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer);
5010d38b 297#if !defined (GDB_TM_FILE) && defined (TARGET_VIRTUAL_FRAME_POINTER)
39d4ef09
AC
298#error "Non multi-arch definition of TARGET_VIRTUAL_FRAME_POINTER"
299#endif
c25083af 300#if !defined (TARGET_VIRTUAL_FRAME_POINTER)
39d4ef09
AC
301#define TARGET_VIRTUAL_FRAME_POINTER(pc, frame_regnum, frame_offset) (gdbarch_virtual_frame_pointer (current_gdbarch, pc, frame_regnum, frame_offset))
302#endif
39d4ef09 303
d8124050 304extern int gdbarch_pseudo_register_read_p (struct gdbarch *gdbarch);
61a0eb5b 305
b60c417a
AC
306typedef void (gdbarch_pseudo_register_read_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, gdb_byte *buf);
307extern void gdbarch_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, gdb_byte *buf);
d8124050 308extern void set_gdbarch_pseudo_register_read (struct gdbarch *gdbarch, gdbarch_pseudo_register_read_ftype *pseudo_register_read);
61a0eb5b 309
d8124050 310extern int gdbarch_pseudo_register_write_p (struct gdbarch *gdbarch);
61a0eb5b 311
b60c417a
AC
312typedef void (gdbarch_pseudo_register_write_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const gdb_byte *buf);
313extern void gdbarch_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const gdb_byte *buf);
d8124050 314extern void set_gdbarch_pseudo_register_write (struct gdbarch *gdbarch, gdbarch_pseudo_register_write_ftype *pseudo_register_write);
61a0eb5b 315
104c1213
JM
316extern int gdbarch_num_regs (struct gdbarch *gdbarch);
317extern void set_gdbarch_num_regs (struct gdbarch *gdbarch, int num_regs);
5010d38b 318#if !defined (GDB_TM_FILE) && defined (NUM_REGS)
83905903
AC
319#error "Non multi-arch definition of NUM_REGS"
320#endif
c25083af 321#if !defined (NUM_REGS)
0f71a2f6
JM
322#define NUM_REGS (gdbarch_num_regs (current_gdbarch))
323#endif
0f71a2f6 324
34620563
AC
325/* This macro gives the number of pseudo-registers that live in the
326 register namespace but do not get fetched or stored on the target.
327 These pseudo-registers may be aliases for other registers,
328 combinations of other registers, or they may be computed by GDB. */
329
0aba1244
EZ
330extern int gdbarch_num_pseudo_regs (struct gdbarch *gdbarch);
331extern void set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch, int num_pseudo_regs);
5010d38b 332#if !defined (GDB_TM_FILE) && defined (NUM_PSEUDO_REGS)
83905903
AC
333#error "Non multi-arch definition of NUM_PSEUDO_REGS"
334#endif
c25083af 335#if !defined (NUM_PSEUDO_REGS)
0aba1244
EZ
336#define NUM_PSEUDO_REGS (gdbarch_num_pseudo_regs (current_gdbarch))
337#endif
0aba1244 338
c2169756
AC
339/* GDB's standard (or well known) register numbers. These can map onto
340 a real register or a pseudo (computed) register or not be defined at
a9e5fdc2
AC
341 all (-1).
342 SP_REGNUM will hopefully be replaced by UNWIND_SP. */
1200cd6e 343
104c1213
JM
344extern int gdbarch_sp_regnum (struct gdbarch *gdbarch);
345extern void set_gdbarch_sp_regnum (struct gdbarch *gdbarch, int sp_regnum);
5010d38b 346#if !defined (GDB_TM_FILE) && defined (SP_REGNUM)
83905903
AC
347#error "Non multi-arch definition of SP_REGNUM"
348#endif
c25083af 349#if !defined (SP_REGNUM)
0f71a2f6
JM
350#define SP_REGNUM (gdbarch_sp_regnum (current_gdbarch))
351#endif
0f71a2f6 352
104c1213
JM
353extern int gdbarch_pc_regnum (struct gdbarch *gdbarch);
354extern void set_gdbarch_pc_regnum (struct gdbarch *gdbarch, int pc_regnum);
5010d38b 355#if !defined (GDB_TM_FILE) && defined (PC_REGNUM)
83905903
AC
356#error "Non multi-arch definition of PC_REGNUM"
357#endif
c25083af 358#if !defined (PC_REGNUM)
0f71a2f6
JM
359#define PC_REGNUM (gdbarch_pc_regnum (current_gdbarch))
360#endif
0f71a2f6 361
c2169756
AC
362extern int gdbarch_ps_regnum (struct gdbarch *gdbarch);
363extern void set_gdbarch_ps_regnum (struct gdbarch *gdbarch, int ps_regnum);
5010d38b 364#if !defined (GDB_TM_FILE) && defined (PS_REGNUM)
c2169756
AC
365#error "Non multi-arch definition of PS_REGNUM"
366#endif
c25083af 367#if !defined (PS_REGNUM)
c2169756
AC
368#define PS_REGNUM (gdbarch_ps_regnum (current_gdbarch))
369#endif
c2169756 370
60054393
MS
371extern int gdbarch_fp0_regnum (struct gdbarch *gdbarch);
372extern void set_gdbarch_fp0_regnum (struct gdbarch *gdbarch, int fp0_regnum);
5010d38b 373#if !defined (GDB_TM_FILE) && defined (FP0_REGNUM)
83905903
AC
374#error "Non multi-arch definition of FP0_REGNUM"
375#endif
c25083af 376#if !defined (FP0_REGNUM)
60054393
MS
377#define FP0_REGNUM (gdbarch_fp0_regnum (current_gdbarch))
378#endif
60054393 379
88c72b7d
AC
380/* Convert stab register number (from `r' declaration) to a gdb REGNUM. */
381
88c72b7d
AC
382typedef int (gdbarch_stab_reg_to_regnum_ftype) (int stab_regnr);
383extern int gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, int stab_regnr);
384extern void set_gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum);
5010d38b 385#if !defined (GDB_TM_FILE) && defined (STAB_REG_TO_REGNUM)
83905903
AC
386#error "Non multi-arch definition of STAB_REG_TO_REGNUM"
387#endif
c25083af 388#if !defined (STAB_REG_TO_REGNUM)
88c72b7d
AC
389#define STAB_REG_TO_REGNUM(stab_regnr) (gdbarch_stab_reg_to_regnum (current_gdbarch, stab_regnr))
390#endif
88c72b7d
AC
391
392/* Provide a default mapping from a ecoff register number to a gdb REGNUM. */
393
88c72b7d
AC
394typedef int (gdbarch_ecoff_reg_to_regnum_ftype) (int ecoff_regnr);
395extern int gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, int ecoff_regnr);
396extern void set_gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum);
5010d38b 397#if !defined (GDB_TM_FILE) && defined (ECOFF_REG_TO_REGNUM)
83905903
AC
398#error "Non multi-arch definition of ECOFF_REG_TO_REGNUM"
399#endif
c25083af 400#if !defined (ECOFF_REG_TO_REGNUM)
88c72b7d
AC
401#define ECOFF_REG_TO_REGNUM(ecoff_regnr) (gdbarch_ecoff_reg_to_regnum (current_gdbarch, ecoff_regnr))
402#endif
88c72b7d
AC
403
404/* Provide a default mapping from a DWARF register number to a gdb REGNUM. */
405
88c72b7d
AC
406typedef int (gdbarch_dwarf_reg_to_regnum_ftype) (int dwarf_regnr);
407extern int gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int dwarf_regnr);
408extern void set_gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_dwarf_reg_to_regnum_ftype *dwarf_reg_to_regnum);
5010d38b 409#if !defined (GDB_TM_FILE) && defined (DWARF_REG_TO_REGNUM)
83905903
AC
410#error "Non multi-arch definition of DWARF_REG_TO_REGNUM"
411#endif
c25083af 412#if !defined (DWARF_REG_TO_REGNUM)
88c72b7d
AC
413#define DWARF_REG_TO_REGNUM(dwarf_regnr) (gdbarch_dwarf_reg_to_regnum (current_gdbarch, dwarf_regnr))
414#endif
88c72b7d 415
77949794 416/* Convert from an sdb register number to an internal gdb register number. */
88c72b7d 417
88c72b7d
AC
418typedef int (gdbarch_sdb_reg_to_regnum_ftype) (int sdb_regnr);
419extern int gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, int sdb_regnr);
420extern void set_gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum);
5010d38b 421#if !defined (GDB_TM_FILE) && defined (SDB_REG_TO_REGNUM)
83905903
AC
422#error "Non multi-arch definition of SDB_REG_TO_REGNUM"
423#endif
c25083af 424#if !defined (SDB_REG_TO_REGNUM)
88c72b7d
AC
425#define SDB_REG_TO_REGNUM(sdb_regnr) (gdbarch_sdb_reg_to_regnum (current_gdbarch, sdb_regnr))
426#endif
88c72b7d 427
88c72b7d
AC
428typedef int (gdbarch_dwarf2_reg_to_regnum_ftype) (int dwarf2_regnr);
429extern int gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int dwarf2_regnr);
430extern void set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum);
5010d38b 431#if !defined (GDB_TM_FILE) && defined (DWARF2_REG_TO_REGNUM)
83905903
AC
432#error "Non multi-arch definition of DWARF2_REG_TO_REGNUM"
433#endif
c25083af 434#if !defined (DWARF2_REG_TO_REGNUM)
88c72b7d
AC
435#define DWARF2_REG_TO_REGNUM(dwarf2_regnr) (gdbarch_dwarf2_reg_to_regnum (current_gdbarch, dwarf2_regnr))
436#endif
88c72b7d 437
fa88f677
AC
438typedef const char * (gdbarch_register_name_ftype) (int regnr);
439extern const char * gdbarch_register_name (struct gdbarch *gdbarch, int regnr);
104c1213 440extern void set_gdbarch_register_name (struct gdbarch *gdbarch, gdbarch_register_name_ftype *register_name);
5010d38b 441#if !defined (GDB_TM_FILE) && defined (REGISTER_NAME)
83905903
AC
442#error "Non multi-arch definition of REGISTER_NAME"
443#endif
c25083af 444#if !defined (REGISTER_NAME)
0f71a2f6
JM
445#define REGISTER_NAME(regnr) (gdbarch_register_name (current_gdbarch, regnr))
446#endif
0f71a2f6 447
7b9ee6a8
DJ
448/* Return the type of a register specified by the architecture. Only
449 the register cache should call this function directly; others should
450 use "register_type". */
9c04cab7
AC
451
452extern int gdbarch_register_type_p (struct gdbarch *gdbarch);
453
454typedef struct type * (gdbarch_register_type_ftype) (struct gdbarch *gdbarch, int reg_nr);
455extern struct type * gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr);
456extern void set_gdbarch_register_type (struct gdbarch *gdbarch, gdbarch_register_type_ftype *register_type);
457
f3be58bc
AC
458/* See gdbint.texinfo, and PUSH_DUMMY_CALL. */
459
460extern int gdbarch_unwind_dummy_id_p (struct gdbarch *gdbarch);
461
462typedef struct frame_id (gdbarch_unwind_dummy_id_ftype) (struct gdbarch *gdbarch, struct frame_info *info);
463extern struct frame_id gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *info);
464extern void set_gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, gdbarch_unwind_dummy_id_ftype *unwind_dummy_id);
465
f3be58bc
AC
466/* Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete
467 DEPRECATED_FP_REGNUM. */
468
f3be58bc
AC
469extern int gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch);
470extern void set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch, int deprecated_fp_regnum);
5010d38b 471#if !defined (GDB_TM_FILE) && defined (DEPRECATED_FP_REGNUM)
f3be58bc
AC
472#error "Non multi-arch definition of DEPRECATED_FP_REGNUM"
473#endif
474#if !defined (DEPRECATED_FP_REGNUM)
475#define DEPRECATED_FP_REGNUM (gdbarch_deprecated_fp_regnum (current_gdbarch))
476#endif
477
a86c5fc9 478/* See gdbint.texinfo. See infcall.c. */
b8de8283
AC
479
480extern int gdbarch_push_dummy_call_p (struct gdbarch *gdbarch);
481
7d9b040b
RC
482typedef 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);
483extern 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);
b8de8283
AC
484extern void set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype *push_dummy_call);
485
b8de8283
AC
486/* DEPRECATED_REGISTER_SIZE can be deleted. */
487
488extern int gdbarch_deprecated_register_size (struct gdbarch *gdbarch);
489extern void set_gdbarch_deprecated_register_size (struct gdbarch *gdbarch, int deprecated_register_size);
5010d38b 490#if !defined (GDB_TM_FILE) && defined (DEPRECATED_REGISTER_SIZE)
b8de8283
AC
491#error "Non multi-arch definition of DEPRECATED_REGISTER_SIZE"
492#endif
493#if !defined (DEPRECATED_REGISTER_SIZE)
494#define DEPRECATED_REGISTER_SIZE (gdbarch_deprecated_register_size (current_gdbarch))
495#endif
496
b8de8283
AC
497extern int gdbarch_call_dummy_location (struct gdbarch *gdbarch);
498extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, int call_dummy_location);
5010d38b 499#if !defined (GDB_TM_FILE) && defined (CALL_DUMMY_LOCATION)
b8de8283
AC
500#error "Non multi-arch definition of CALL_DUMMY_LOCATION"
501#endif
502#if !defined (CALL_DUMMY_LOCATION)
503#define CALL_DUMMY_LOCATION (gdbarch_call_dummy_location (current_gdbarch))
504#endif
505
b8de8283
AC
506extern int gdbarch_push_dummy_code_p (struct gdbarch *gdbarch);
507
508typedef CORE_ADDR (gdbarch_push_dummy_code_ftype) (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr);
509extern CORE_ADDR gdbarch_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr);
510extern void set_gdbarch_push_dummy_code (struct gdbarch *gdbarch, gdbarch_push_dummy_code_ftype *push_dummy_code);
511
0ab7a791
AC
512typedef void (gdbarch_print_registers_info_ftype) (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, int regnum, int all);
513extern void gdbarch_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, int regnum, int all);
514extern void set_gdbarch_print_registers_info (struct gdbarch *gdbarch, gdbarch_print_registers_info_ftype *print_registers_info);
515
23e3a7ac
AC
516extern int gdbarch_print_float_info_p (struct gdbarch *gdbarch);
517
518typedef void (gdbarch_print_float_info_ftype) (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args);
519extern void gdbarch_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args);
5e74b15c 520extern void set_gdbarch_print_float_info (struct gdbarch *gdbarch, gdbarch_print_float_info_ftype *print_float_info);
5e74b15c 521
e76f1f2e
AC
522extern int gdbarch_print_vector_info_p (struct gdbarch *gdbarch);
523
524typedef void (gdbarch_print_vector_info_ftype) (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args);
525extern void gdbarch_print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args);
526extern void set_gdbarch_print_vector_info (struct gdbarch *gdbarch, gdbarch_print_vector_info_ftype *print_vector_info);
527
7c7651b2
AC
528/* MAP a GDB RAW register number onto a simulator register number. See
529 also include/...-sim.h. */
530
7c7651b2
AC
531typedef int (gdbarch_register_sim_regno_ftype) (int reg_nr);
532extern int gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr);
533extern void set_gdbarch_register_sim_regno (struct gdbarch *gdbarch, gdbarch_register_sim_regno_ftype *register_sim_regno);
5010d38b 534#if !defined (GDB_TM_FILE) && defined (REGISTER_SIM_REGNO)
83905903
AC
535#error "Non multi-arch definition of REGISTER_SIM_REGNO"
536#endif
c25083af 537#if !defined (REGISTER_SIM_REGNO)
7c7651b2
AC
538#define REGISTER_SIM_REGNO(reg_nr) (gdbarch_register_sim_regno (current_gdbarch, reg_nr))
539#endif
7c7651b2 540
2649061d
AC
541#if defined (REGISTER_BYTES_OK)
542/* Legacy for systems yet to multi-arch REGISTER_BYTES_OK */
eee30e78 543#if !defined (REGISTER_BYTES_OK_P)
2649061d
AC
544#define REGISTER_BYTES_OK_P() (1)
545#endif
eee30e78 546#endif
2649061d 547
2649061d 548extern int gdbarch_register_bytes_ok_p (struct gdbarch *gdbarch);
5010d38b 549#if !defined (GDB_TM_FILE) && defined (REGISTER_BYTES_OK_P)
83905903
AC
550#error "Non multi-arch definition of REGISTER_BYTES_OK"
551#endif
bceabdd8 552#if !defined (REGISTER_BYTES_OK_P)
2649061d
AC
553#define REGISTER_BYTES_OK_P() (gdbarch_register_bytes_ok_p (current_gdbarch))
554#endif
555
2649061d
AC
556typedef int (gdbarch_register_bytes_ok_ftype) (long nr_bytes);
557extern int gdbarch_register_bytes_ok (struct gdbarch *gdbarch, long nr_bytes);
558extern void set_gdbarch_register_bytes_ok (struct gdbarch *gdbarch, gdbarch_register_bytes_ok_ftype *register_bytes_ok);
5010d38b 559#if !defined (GDB_TM_FILE) && defined (REGISTER_BYTES_OK)
83905903
AC
560#error "Non multi-arch definition of REGISTER_BYTES_OK"
561#endif
c25083af 562#if !defined (REGISTER_BYTES_OK)
2649061d
AC
563#define REGISTER_BYTES_OK(nr_bytes) (gdbarch_register_bytes_ok (current_gdbarch, nr_bytes))
564#endif
2649061d 565
01fb7433
AC
566typedef int (gdbarch_cannot_fetch_register_ftype) (int regnum);
567extern int gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, int regnum);
568extern void set_gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, gdbarch_cannot_fetch_register_ftype *cannot_fetch_register);
5010d38b 569#if !defined (GDB_TM_FILE) && defined (CANNOT_FETCH_REGISTER)
83905903
AC
570#error "Non multi-arch definition of CANNOT_FETCH_REGISTER"
571#endif
c25083af 572#if !defined (CANNOT_FETCH_REGISTER)
01fb7433
AC
573#define CANNOT_FETCH_REGISTER(regnum) (gdbarch_cannot_fetch_register (current_gdbarch, regnum))
574#endif
01fb7433 575
01fb7433
AC
576typedef int (gdbarch_cannot_store_register_ftype) (int regnum);
577extern int gdbarch_cannot_store_register (struct gdbarch *gdbarch, int regnum);
578extern void set_gdbarch_cannot_store_register (struct gdbarch *gdbarch, gdbarch_cannot_store_register_ftype *cannot_store_register);
5010d38b 579#if !defined (GDB_TM_FILE) && defined (CANNOT_STORE_REGISTER)
83905903
AC
580#error "Non multi-arch definition of CANNOT_STORE_REGISTER"
581#endif
c25083af 582#if !defined (CANNOT_STORE_REGISTER)
01fb7433
AC
583#define CANNOT_STORE_REGISTER(regnum) (gdbarch_cannot_store_register (current_gdbarch, regnum))
584#endif
01fb7433 585
9df628e0
RE
586/* setjmp/longjmp support. */
587
588#if defined (GET_LONGJMP_TARGET)
589/* Legacy for systems yet to multi-arch GET_LONGJMP_TARGET */
590#if !defined (GET_LONGJMP_TARGET_P)
591#define GET_LONGJMP_TARGET_P() (1)
592#endif
593#endif
594
9df628e0 595extern int gdbarch_get_longjmp_target_p (struct gdbarch *gdbarch);
5010d38b 596#if !defined (GDB_TM_FILE) && defined (GET_LONGJMP_TARGET_P)
9df628e0
RE
597#error "Non multi-arch definition of GET_LONGJMP_TARGET"
598#endif
bceabdd8 599#if !defined (GET_LONGJMP_TARGET_P)
b8de8283 600#define GET_LONGJMP_TARGET_P() (gdbarch_get_longjmp_target_p (current_gdbarch))
0f71a2f6 601#endif
0f71a2f6 602
b8de8283
AC
603typedef int (gdbarch_get_longjmp_target_ftype) (CORE_ADDR *pc);
604extern int gdbarch_get_longjmp_target (struct gdbarch *gdbarch, CORE_ADDR *pc);
605extern void set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch, gdbarch_get_longjmp_target_ftype *get_longjmp_target);
5010d38b 606#if !defined (GDB_TM_FILE) && defined (GET_LONGJMP_TARGET)
b8de8283 607#error "Non multi-arch definition of GET_LONGJMP_TARGET"
83905903 608#endif
b8de8283
AC
609#if !defined (GET_LONGJMP_TARGET)
610#define GET_LONGJMP_TARGET(pc) (gdbarch_get_longjmp_target (current_gdbarch, pc))
0f71a2f6 611#endif
0f71a2f6 612
104c1213
JM
613extern int gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch);
614extern void set_gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch, int believe_pcc_promotion);
5010d38b 615#if !defined (GDB_TM_FILE) && defined (BELIEVE_PCC_PROMOTION)
83905903
AC
616#error "Non multi-arch definition of BELIEVE_PCC_PROMOTION"
617#endif
c25083af 618#if !defined (BELIEVE_PCC_PROMOTION)
0f71a2f6
JM
619#define BELIEVE_PCC_PROMOTION (gdbarch_believe_pcc_promotion (current_gdbarch))
620#endif
0f71a2f6 621
ff2e87ac
AC
622typedef int (gdbarch_convert_register_p_ftype) (int regnum, struct type *type);
623extern int gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type);
13d01224 624extern void set_gdbarch_convert_register_p (struct gdbarch *gdbarch, gdbarch_convert_register_p_ftype *convert_register_p);
5010d38b 625#if !defined (GDB_TM_FILE) && defined (CONVERT_REGISTER_P)
13d01224
AC
626#error "Non multi-arch definition of CONVERT_REGISTER_P"
627#endif
c25083af 628#if !defined (CONVERT_REGISTER_P)
ff2e87ac 629#define CONVERT_REGISTER_P(regnum, type) (gdbarch_convert_register_p (current_gdbarch, regnum, type))
13d01224 630#endif
13d01224 631
b60c417a
AC
632typedef void (gdbarch_register_to_value_ftype) (struct frame_info *frame, int regnum, struct type *type, gdb_byte *buf);
633extern void gdbarch_register_to_value (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, gdb_byte *buf);
13d01224 634extern void set_gdbarch_register_to_value (struct gdbarch *gdbarch, gdbarch_register_to_value_ftype *register_to_value);
5010d38b 635#if !defined (GDB_TM_FILE) && defined (REGISTER_TO_VALUE)
13d01224
AC
636#error "Non multi-arch definition of REGISTER_TO_VALUE"
637#endif
c25083af 638#if !defined (REGISTER_TO_VALUE)
ff2e87ac 639#define REGISTER_TO_VALUE(frame, regnum, type, buf) (gdbarch_register_to_value (current_gdbarch, frame, regnum, type, buf))
13d01224 640#endif
13d01224 641
b60c417a
AC
642typedef void (gdbarch_value_to_register_ftype) (struct frame_info *frame, int regnum, struct type *type, const gdb_byte *buf);
643extern void gdbarch_value_to_register (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, const gdb_byte *buf);
13d01224 644extern void set_gdbarch_value_to_register (struct gdbarch *gdbarch, gdbarch_value_to_register_ftype *value_to_register);
5010d38b 645#if !defined (GDB_TM_FILE) && defined (VALUE_TO_REGISTER)
13d01224
AC
646#error "Non multi-arch definition of VALUE_TO_REGISTER"
647#endif
c25083af 648#if !defined (VALUE_TO_REGISTER)
ff2e87ac 649#define VALUE_TO_REGISTER(frame, regnum, type, buf) (gdbarch_value_to_register (current_gdbarch, frame, regnum, type, buf))
13d01224 650#endif
13d01224 651
9acbedc0
UW
652/* Construct a value representing the contents of register REGNUM in
653 frame FRAME, interpreted as type TYPE. The routine needs to
654 allocate and return a struct value with all value attributes
655 (but not the value contents) filled in. */
656
657typedef struct value * (gdbarch_value_from_register_ftype) (struct type *type, int regnum, struct frame_info *frame);
658extern struct value * gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type, int regnum, struct frame_info *frame);
659extern void set_gdbarch_value_from_register (struct gdbarch *gdbarch, gdbarch_value_from_register_ftype *value_from_register);
660
b60c417a
AC
661typedef CORE_ADDR (gdbarch_pointer_to_address_ftype) (struct type *type, const gdb_byte *buf);
662extern CORE_ADDR gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
4478b372 663extern void set_gdbarch_pointer_to_address (struct gdbarch *gdbarch, gdbarch_pointer_to_address_ftype *pointer_to_address);
5010d38b 664#if !defined (GDB_TM_FILE) && defined (POINTER_TO_ADDRESS)
83905903
AC
665#error "Non multi-arch definition of POINTER_TO_ADDRESS"
666#endif
c25083af 667#if !defined (POINTER_TO_ADDRESS)
4478b372
JB
668#define POINTER_TO_ADDRESS(type, buf) (gdbarch_pointer_to_address (current_gdbarch, type, buf))
669#endif
33489c5b 670
b60c417a
AC
671typedef void (gdbarch_address_to_pointer_ftype) (struct type *type, gdb_byte *buf, CORE_ADDR addr);
672extern void gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr);
4478b372 673extern void set_gdbarch_address_to_pointer (struct gdbarch *gdbarch, gdbarch_address_to_pointer_ftype *address_to_pointer);
5010d38b 674#if !defined (GDB_TM_FILE) && defined (ADDRESS_TO_POINTER)
83905903
AC
675#error "Non multi-arch definition of ADDRESS_TO_POINTER"
676#endif
c25083af 677#if !defined (ADDRESS_TO_POINTER)
4478b372
JB
678#define ADDRESS_TO_POINTER(type, buf, addr) (gdbarch_address_to_pointer (current_gdbarch, type, buf, addr))
679#endif
33489c5b 680
fc0c74b1 681extern int gdbarch_integer_to_address_p (struct gdbarch *gdbarch);
fc0c74b1 682
fc1a4b47
AC
683typedef CORE_ADDR (gdbarch_integer_to_address_ftype) (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
684extern CORE_ADDR gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
fc0c74b1 685extern void set_gdbarch_integer_to_address (struct gdbarch *gdbarch, gdbarch_integer_to_address_ftype *integer_to_address);
fc0c74b1 686
92ad9cd9
AC
687/* It has been suggested that this, well actually its predecessor,
688 should take the type/value of the function to be called and not the
750eb019
AC
689 return type. This is left as an exercise for the reader.
690 NOTE: cagney/2004-06-13: The function stack.c:return_command uses
691 the predicate with default hack to avoid calling STORE_RETURN_VALUE
692 (via legacy_return_value), when a small struct is involved. */
92ad9cd9
AC
693
694extern int gdbarch_return_value_p (struct gdbarch *gdbarch);
695
b60c417a
AC
696typedef enum return_value_convention (gdbarch_return_value_ftype) (struct gdbarch *gdbarch, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf);
697extern enum return_value_convention gdbarch_return_value (struct gdbarch *gdbarch, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf);
92ad9cd9
AC
698extern void set_gdbarch_return_value (struct gdbarch *gdbarch, gdbarch_return_value_ftype *return_value);
699
b5622e8d
AC
700/* The deprecated methods EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE,
701 DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS and
702 DEPRECATED_USE_STRUCT_CONVENTION have all been folded into
703 RETURN_VALUE. */
92ad9cd9 704
b60c417a
AC
705typedef void (gdbarch_extract_return_value_ftype) (struct type *type, struct regcache *regcache, gdb_byte *valbuf);
706extern void gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, gdb_byte *valbuf);
ebba8386 707extern void set_gdbarch_extract_return_value (struct gdbarch *gdbarch, gdbarch_extract_return_value_ftype *extract_return_value);
5010d38b 708#if !defined (GDB_TM_FILE) && defined (EXTRACT_RETURN_VALUE)
ebba8386
AC
709#error "Non multi-arch definition of EXTRACT_RETURN_VALUE"
710#endif
c25083af 711#if !defined (EXTRACT_RETURN_VALUE)
ebba8386
AC
712#define EXTRACT_RETURN_VALUE(type, regcache, valbuf) (gdbarch_extract_return_value (current_gdbarch, type, regcache, valbuf))
713#endif
ebba8386 714
b60c417a
AC
715typedef void (gdbarch_store_return_value_ftype) (struct type *type, struct regcache *regcache, const gdb_byte *valbuf);
716extern void gdbarch_store_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, const gdb_byte *valbuf);
104c1213 717extern void set_gdbarch_store_return_value (struct gdbarch *gdbarch, gdbarch_store_return_value_ftype *store_return_value);
5010d38b 718#if !defined (GDB_TM_FILE) && defined (STORE_RETURN_VALUE)
83905903
AC
719#error "Non multi-arch definition of STORE_RETURN_VALUE"
720#endif
c25083af 721#if !defined (STORE_RETURN_VALUE)
ebba8386
AC
722#define STORE_RETURN_VALUE(type, regcache, valbuf) (gdbarch_store_return_value (current_gdbarch, type, regcache, valbuf))
723#endif
ebba8386 724
b5622e8d
AC
725typedef int (gdbarch_deprecated_use_struct_convention_ftype) (int gcc_p, struct type *value_type);
726extern int gdbarch_deprecated_use_struct_convention (struct gdbarch *gdbarch, int gcc_p, struct type *value_type);
727extern void set_gdbarch_deprecated_use_struct_convention (struct gdbarch *gdbarch, gdbarch_deprecated_use_struct_convention_ftype *deprecated_use_struct_convention);
5010d38b 728#if !defined (GDB_TM_FILE) && defined (DEPRECATED_USE_STRUCT_CONVENTION)
b5622e8d 729#error "Non multi-arch definition of DEPRECATED_USE_STRUCT_CONVENTION"
92ad9cd9 730#endif
b5622e8d
AC
731#if !defined (DEPRECATED_USE_STRUCT_CONVENTION)
732#define DEPRECATED_USE_STRUCT_CONVENTION(gcc_p, value_type) (gdbarch_deprecated_use_struct_convention (current_gdbarch, gcc_p, value_type))
92ad9cd9
AC
733#endif
734
74055713
AC
735/* As of 2004-01-17 only the 32-bit SPARC ABI has been identified as an
736 ABI suitable for the implementation of a robust extract
737 struct-convention return-value address method (the sparc saves the
738 address in the callers frame). All the other cases so far examined,
739 the DEPRECATED_EXTRACT_STRUCT_VALUE implementation has been
740 erreneous - the code was incorrectly assuming that the return-value
741 address, stored in a register, was preserved across the entire
742 function call.
743 For the moment retain DEPRECATED_EXTRACT_STRUCT_VALUE as a marker of
744 the ABIs that are still to be analyzed - perhaps this should simply
745 be deleted. The commented out extract_returned_value_address method
746 is provided as a starting point for the 32-bit SPARC. It, or
747 something like it, along with changes to both infcmd.c and stack.c
748 will be needed for that case to work. NB: It is passed the callers
749 frame since it is only after the callee has returned that this
750 function is used.
57010b1c 751 M::CORE_ADDR:extract_returned_value_address:struct frame_info *caller_frame:caller_frame */
74055713
AC
752
753#if defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS)
754/* Legacy for systems yet to multi-arch DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS */
755#if !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P)
756#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() (1)
049ee0e4
AC
757#endif
758#endif
759
74055713 760extern int gdbarch_deprecated_extract_struct_value_address_p (struct gdbarch *gdbarch);
5010d38b 761#if !defined (GDB_TM_FILE) && defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P)
74055713 762#error "Non multi-arch definition of DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS"
049ee0e4 763#endif
bceabdd8 764#if !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P)
74055713 765#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() (gdbarch_deprecated_extract_struct_value_address_p (current_gdbarch))
049ee0e4
AC
766#endif
767
74055713
AC
768typedef CORE_ADDR (gdbarch_deprecated_extract_struct_value_address_ftype) (struct regcache *regcache);
769extern CORE_ADDR gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, struct regcache *regcache);
770extern void set_gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, gdbarch_deprecated_extract_struct_value_address_ftype *deprecated_extract_struct_value_address);
5010d38b 771#if !defined (GDB_TM_FILE) && defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS)
74055713 772#error "Non multi-arch definition of DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS"
049ee0e4 773#endif
74055713
AC
774#if !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS)
775#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regcache) (gdbarch_deprecated_extract_struct_value_address (current_gdbarch, regcache))
049ee0e4 776#endif
049ee0e4 777
104c1213
JM
778typedef CORE_ADDR (gdbarch_skip_prologue_ftype) (CORE_ADDR ip);
779extern CORE_ADDR gdbarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip);
780extern void set_gdbarch_skip_prologue (struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype *skip_prologue);
5010d38b 781#if !defined (GDB_TM_FILE) && defined (SKIP_PROLOGUE)
83905903
AC
782#error "Non multi-arch definition of SKIP_PROLOGUE"
783#endif
c25083af 784#if !defined (SKIP_PROLOGUE)
0f71a2f6
JM
785#define SKIP_PROLOGUE(ip) (gdbarch_skip_prologue (current_gdbarch, ip))
786#endif
0f71a2f6 787
104c1213
JM
788typedef int (gdbarch_inner_than_ftype) (CORE_ADDR lhs, CORE_ADDR rhs);
789extern int gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs);
790extern void set_gdbarch_inner_than (struct gdbarch *gdbarch, gdbarch_inner_than_ftype *inner_than);
5010d38b 791#if !defined (GDB_TM_FILE) && defined (INNER_THAN)
83905903
AC
792#error "Non multi-arch definition of INNER_THAN"
793#endif
c25083af 794#if !defined (INNER_THAN)
0f71a2f6
JM
795#define INNER_THAN(lhs, rhs) (gdbarch_inner_than (current_gdbarch, lhs, rhs))
796#endif
0f71a2f6 797
fc1a4b47
AC
798typedef const gdb_byte * (gdbarch_breakpoint_from_pc_ftype) (CORE_ADDR *pcptr, int *lenptr);
799extern const gdb_byte * gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr);
104c1213 800extern void set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc);
5010d38b 801#if !defined (GDB_TM_FILE) && defined (BREAKPOINT_FROM_PC)
83905903
AC
802#error "Non multi-arch definition of BREAKPOINT_FROM_PC"
803#endif
c25083af 804#if !defined (BREAKPOINT_FROM_PC)
0f71a2f6
JM
805#define BREAKPOINT_FROM_PC(pcptr, lenptr) (gdbarch_breakpoint_from_pc (current_gdbarch, pcptr, lenptr))
806#endif
33489c5b 807
a1131521
KB
808extern int gdbarch_adjust_breakpoint_address_p (struct gdbarch *gdbarch);
809
810typedef CORE_ADDR (gdbarch_adjust_breakpoint_address_ftype) (struct gdbarch *gdbarch, CORE_ADDR bpaddr);
811extern CORE_ADDR gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr);
812extern void set_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address);
813
8181d85f
DJ
814typedef int (gdbarch_memory_insert_breakpoint_ftype) (struct bp_target_info *bp_tgt);
815extern int gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt);
917317f4 816extern void set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint);
5010d38b 817#if !defined (GDB_TM_FILE) && defined (MEMORY_INSERT_BREAKPOINT)
83905903
AC
818#error "Non multi-arch definition of MEMORY_INSERT_BREAKPOINT"
819#endif
c25083af 820#if !defined (MEMORY_INSERT_BREAKPOINT)
8181d85f 821#define MEMORY_INSERT_BREAKPOINT(bp_tgt) (gdbarch_memory_insert_breakpoint (current_gdbarch, bp_tgt))
917317f4 822#endif
33489c5b 823
8181d85f
DJ
824typedef int (gdbarch_memory_remove_breakpoint_ftype) (struct bp_target_info *bp_tgt);
825extern int gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt);
917317f4 826extern void set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint);
5010d38b 827#if !defined (GDB_TM_FILE) && defined (MEMORY_REMOVE_BREAKPOINT)
83905903
AC
828#error "Non multi-arch definition of MEMORY_REMOVE_BREAKPOINT"
829#endif
c25083af 830#if !defined (MEMORY_REMOVE_BREAKPOINT)
8181d85f 831#define MEMORY_REMOVE_BREAKPOINT(bp_tgt) (gdbarch_memory_remove_breakpoint (current_gdbarch, bp_tgt))
917317f4 832#endif
917317f4 833
104c1213
JM
834extern CORE_ADDR gdbarch_decr_pc_after_break (struct gdbarch *gdbarch);
835extern void set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break);
5010d38b 836#if !defined (GDB_TM_FILE) && defined (DECR_PC_AFTER_BREAK)
83905903
AC
837#error "Non multi-arch definition of DECR_PC_AFTER_BREAK"
838#endif
c25083af 839#if !defined (DECR_PC_AFTER_BREAK)
0f71a2f6
JM
840#define DECR_PC_AFTER_BREAK (gdbarch_decr_pc_after_break (current_gdbarch))
841#endif
0f71a2f6 842
782263ab
AC
843/* A function can be addressed by either it's "pointer" (possibly a
844 descriptor address) or "entry point" (first executable instruction).
845 The method "convert_from_func_ptr_addr" converting the former to the
846 latter. DEPRECATED_FUNCTION_START_OFFSET is being used to implement
847 a simplified subset of that functionality - the function's address
848 corresponds to the "function pointer" and the function's start
849 corresponds to the "function entry point" - and hence is redundant. */
850
851extern CORE_ADDR gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch);
852extern void set_gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch, CORE_ADDR deprecated_function_start_offset);
5010d38b 853#if !defined (GDB_TM_FILE) && defined (DEPRECATED_FUNCTION_START_OFFSET)
782263ab
AC
854#error "Non multi-arch definition of DEPRECATED_FUNCTION_START_OFFSET"
855#endif
856#if !defined (DEPRECATED_FUNCTION_START_OFFSET)
857#define DEPRECATED_FUNCTION_START_OFFSET (gdbarch_deprecated_function_start_offset (current_gdbarch))
0f71a2f6 858#endif
0f71a2f6 859
123dc839
DJ
860/* Return the remote protocol register number associated with this
861 register. Normally the identity mapping. */
862
863typedef int (gdbarch_remote_register_number_ftype) (struct gdbarch *gdbarch, int regno);
864extern int gdbarch_remote_register_number (struct gdbarch *gdbarch, int regno);
865extern void set_gdbarch_remote_register_number (struct gdbarch *gdbarch, gdbarch_remote_register_number_ftype *remote_register_number);
866
b2756930
KB
867/* Fetch the target specific address used to represent a load module. */
868
869#if defined (FETCH_TLS_LOAD_MODULE_ADDRESS)
870/* Legacy for systems yet to multi-arch FETCH_TLS_LOAD_MODULE_ADDRESS */
871#if !defined (FETCH_TLS_LOAD_MODULE_ADDRESS_P)
872#define FETCH_TLS_LOAD_MODULE_ADDRESS_P() (1)
873#endif
874#endif
875
876extern int gdbarch_fetch_tls_load_module_address_p (struct gdbarch *gdbarch);
877#if !defined (GDB_TM_FILE) && defined (FETCH_TLS_LOAD_MODULE_ADDRESS_P)
878#error "Non multi-arch definition of FETCH_TLS_LOAD_MODULE_ADDRESS"
879#endif
880#if !defined (FETCH_TLS_LOAD_MODULE_ADDRESS_P)
881#define FETCH_TLS_LOAD_MODULE_ADDRESS_P() (gdbarch_fetch_tls_load_module_address_p (current_gdbarch))
882#endif
883
884typedef CORE_ADDR (gdbarch_fetch_tls_load_module_address_ftype) (struct objfile *objfile);
885extern CORE_ADDR gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch, struct objfile *objfile);
886extern void set_gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch, gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address);
887#if !defined (GDB_TM_FILE) && defined (FETCH_TLS_LOAD_MODULE_ADDRESS)
888#error "Non multi-arch definition of FETCH_TLS_LOAD_MODULE_ADDRESS"
889#endif
890#if !defined (FETCH_TLS_LOAD_MODULE_ADDRESS)
891#define FETCH_TLS_LOAD_MODULE_ADDRESS(objfile) (gdbarch_fetch_tls_load_module_address (current_gdbarch, objfile))
892#endif
893
104c1213
JM
894extern CORE_ADDR gdbarch_frame_args_skip (struct gdbarch *gdbarch);
895extern void set_gdbarch_frame_args_skip (struct gdbarch *gdbarch, CORE_ADDR frame_args_skip);
5010d38b 896#if !defined (GDB_TM_FILE) && defined (FRAME_ARGS_SKIP)
83905903
AC
897#error "Non multi-arch definition of FRAME_ARGS_SKIP"
898#endif
c25083af 899#if !defined (FRAME_ARGS_SKIP)
0f71a2f6
JM
900#define FRAME_ARGS_SKIP (gdbarch_frame_args_skip (current_gdbarch))
901#endif
0f71a2f6 902
12cc2063
AC
903extern int gdbarch_unwind_pc_p (struct gdbarch *gdbarch);
904
905typedef CORE_ADDR (gdbarch_unwind_pc_ftype) (struct gdbarch *gdbarch, struct frame_info *next_frame);
906extern CORE_ADDR gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame);
907extern void set_gdbarch_unwind_pc (struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype *unwind_pc);
908
a9e5fdc2
AC
909extern int gdbarch_unwind_sp_p (struct gdbarch *gdbarch);
910
911typedef CORE_ADDR (gdbarch_unwind_sp_ftype) (struct gdbarch *gdbarch, struct frame_info *next_frame);
912extern CORE_ADDR gdbarch_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame);
913extern void set_gdbarch_unwind_sp (struct gdbarch *gdbarch, gdbarch_unwind_sp_ftype *unwind_sp);
914
42efa47a
AC
915/* DEPRECATED_FRAME_LOCALS_ADDRESS as been replaced by the per-frame
916 frame-base. Enable frame-base before frame-unwind. */
917
983a287a
AC
918#if defined (FRAME_NUM_ARGS)
919/* Legacy for systems yet to multi-arch FRAME_NUM_ARGS */
920#if !defined (FRAME_NUM_ARGS_P)
921#define FRAME_NUM_ARGS_P() (1)
922#endif
923#endif
924
983a287a 925extern int gdbarch_frame_num_args_p (struct gdbarch *gdbarch);
5010d38b 926#if !defined (GDB_TM_FILE) && defined (FRAME_NUM_ARGS_P)
983a287a
AC
927#error "Non multi-arch definition of FRAME_NUM_ARGS"
928#endif
bceabdd8 929#if !defined (FRAME_NUM_ARGS_P)
983a287a
AC
930#define FRAME_NUM_ARGS_P() (gdbarch_frame_num_args_p (current_gdbarch))
931#endif
932
104c1213
JM
933typedef int (gdbarch_frame_num_args_ftype) (struct frame_info *frame);
934extern int gdbarch_frame_num_args (struct gdbarch *gdbarch, struct frame_info *frame);
935extern void set_gdbarch_frame_num_args (struct gdbarch *gdbarch, gdbarch_frame_num_args_ftype *frame_num_args);
5010d38b 936#if !defined (GDB_TM_FILE) && defined (FRAME_NUM_ARGS)
83905903
AC
937#error "Non multi-arch definition of FRAME_NUM_ARGS"
938#endif
c25083af 939#if !defined (FRAME_NUM_ARGS)
0f71a2f6
JM
940#define FRAME_NUM_ARGS(frame) (gdbarch_frame_num_args (current_gdbarch, frame))
941#endif
0f71a2f6 942
f27dd7fd
AC
943/* DEPRECATED_STACK_ALIGN has been replaced by an initial aligning call
944 to frame_align and the requirement that methods such as
945 push_dummy_call and frame_red_zone_size maintain correct stack/frame
946 alignment. */
947
948#if defined (DEPRECATED_STACK_ALIGN)
949/* Legacy for systems yet to multi-arch DEPRECATED_STACK_ALIGN */
950#if !defined (DEPRECATED_STACK_ALIGN_P)
951#define DEPRECATED_STACK_ALIGN_P() (1)
2ada493a 952#endif
eee30e78 953#endif
2ada493a 954
f27dd7fd 955extern int gdbarch_deprecated_stack_align_p (struct gdbarch *gdbarch);
5010d38b 956#if !defined (GDB_TM_FILE) && defined (DEPRECATED_STACK_ALIGN_P)
f27dd7fd 957#error "Non multi-arch definition of DEPRECATED_STACK_ALIGN"
83905903 958#endif
bceabdd8 959#if !defined (DEPRECATED_STACK_ALIGN_P)
f27dd7fd 960#define DEPRECATED_STACK_ALIGN_P() (gdbarch_deprecated_stack_align_p (current_gdbarch))
2ada493a
AC
961#endif
962
f27dd7fd
AC
963typedef CORE_ADDR (gdbarch_deprecated_stack_align_ftype) (CORE_ADDR sp);
964extern CORE_ADDR gdbarch_deprecated_stack_align (struct gdbarch *gdbarch, CORE_ADDR sp);
965extern void set_gdbarch_deprecated_stack_align (struct gdbarch *gdbarch, gdbarch_deprecated_stack_align_ftype *deprecated_stack_align);
5010d38b 966#if !defined (GDB_TM_FILE) && defined (DEPRECATED_STACK_ALIGN)
f27dd7fd 967#error "Non multi-arch definition of DEPRECATED_STACK_ALIGN"
83905903 968#endif
f27dd7fd
AC
969#if !defined (DEPRECATED_STACK_ALIGN)
970#define DEPRECATED_STACK_ALIGN(sp) (gdbarch_deprecated_stack_align (current_gdbarch, sp))
2ada493a
AC
971#endif
972
dc604539
AC
973extern int gdbarch_frame_align_p (struct gdbarch *gdbarch);
974
975typedef CORE_ADDR (gdbarch_frame_align_ftype) (struct gdbarch *gdbarch, CORE_ADDR address);
976extern CORE_ADDR gdbarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR address);
977extern void set_gdbarch_frame_align (struct gdbarch *gdbarch, gdbarch_frame_align_ftype *frame_align);
978
192cb3d4
MK
979/* DEPRECATED_REG_STRUCT_HAS_ADDR has been replaced by
980 stabs_argument_has_addr. */
981
88d89dbb
MK
982#if defined (DEPRECATED_REG_STRUCT_HAS_ADDR)
983/* Legacy for systems yet to multi-arch DEPRECATED_REG_STRUCT_HAS_ADDR */
984#if !defined (DEPRECATED_REG_STRUCT_HAS_ADDR_P)
985#define DEPRECATED_REG_STRUCT_HAS_ADDR_P() (1)
d03e67c9 986#endif
eee30e78 987#endif
d03e67c9 988
88d89dbb 989extern int gdbarch_deprecated_reg_struct_has_addr_p (struct gdbarch *gdbarch);
5010d38b 990#if !defined (GDB_TM_FILE) && defined (DEPRECATED_REG_STRUCT_HAS_ADDR_P)
88d89dbb 991#error "Non multi-arch definition of DEPRECATED_REG_STRUCT_HAS_ADDR"
83905903 992#endif
bceabdd8 993#if !defined (DEPRECATED_REG_STRUCT_HAS_ADDR_P)
88d89dbb 994#define DEPRECATED_REG_STRUCT_HAS_ADDR_P() (gdbarch_deprecated_reg_struct_has_addr_p (current_gdbarch))
d03e67c9
AC
995#endif
996
88d89dbb
MK
997typedef int (gdbarch_deprecated_reg_struct_has_addr_ftype) (int gcc_p, struct type *type);
998extern int gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch, int gcc_p, struct type *type);
999extern void set_gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch, gdbarch_deprecated_reg_struct_has_addr_ftype *deprecated_reg_struct_has_addr);
5010d38b 1000#if !defined (GDB_TM_FILE) && defined (DEPRECATED_REG_STRUCT_HAS_ADDR)
88d89dbb 1001#error "Non multi-arch definition of DEPRECATED_REG_STRUCT_HAS_ADDR"
83905903 1002#endif
88d89dbb
MK
1003#if !defined (DEPRECATED_REG_STRUCT_HAS_ADDR)
1004#define DEPRECATED_REG_STRUCT_HAS_ADDR(gcc_p, type) (gdbarch_deprecated_reg_struct_has_addr (current_gdbarch, gcc_p, type))
d03e67c9
AC
1005#endif
1006
192cb3d4
MK
1007typedef int (gdbarch_stabs_argument_has_addr_ftype) (struct gdbarch *gdbarch, struct type *type);
1008extern int gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type);
1009extern void set_gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr);
1010
8b148df9
AC
1011extern int gdbarch_frame_red_zone_size (struct gdbarch *gdbarch);
1012extern void set_gdbarch_frame_red_zone_size (struct gdbarch *gdbarch, int frame_red_zone_size);
5010d38b 1013#if !defined (GDB_TM_FILE) && defined (FRAME_RED_ZONE_SIZE)
8b148df9
AC
1014#error "Non multi-arch definition of FRAME_RED_ZONE_SIZE"
1015#endif
1016#if !defined (FRAME_RED_ZONE_SIZE)
1017#define FRAME_RED_ZONE_SIZE (gdbarch_frame_red_zone_size (current_gdbarch))
1018#endif
1019
e2d0e7eb
AC
1020typedef CORE_ADDR (gdbarch_convert_from_func_ptr_addr_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ);
1021extern CORE_ADDR gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ);
f517ea4e 1022extern void set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr);
f517ea4e 1023
875e1767
AC
1024/* On some machines there are bits in addresses which are not really
1025 part of the address, but are used by the kernel, the hardware, etc.
1026 for special purposes. ADDR_BITS_REMOVE takes out any such bits so
1027 we get a "real" address such as one would find in a symbol table.
1028 This is used only for addresses of instructions, and even then I'm
1029 not sure it's used in all contexts. It exists to deal with there
1030 being a few stray bits in the PC which would mislead us, not as some
1031 sort of generic thing to handle alignment or segmentation (it's
1032 possible it should be in TARGET_READ_PC instead). */
1033
875e1767
AC
1034typedef CORE_ADDR (gdbarch_addr_bits_remove_ftype) (CORE_ADDR addr);
1035extern CORE_ADDR gdbarch_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr);
1036extern void set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch, gdbarch_addr_bits_remove_ftype *addr_bits_remove);
5010d38b 1037#if !defined (GDB_TM_FILE) && defined (ADDR_BITS_REMOVE)
83905903
AC
1038#error "Non multi-arch definition of ADDR_BITS_REMOVE"
1039#endif
c25083af 1040#if !defined (ADDR_BITS_REMOVE)
875e1767
AC
1041#define ADDR_BITS_REMOVE(addr) (gdbarch_addr_bits_remove (current_gdbarch, addr))
1042#endif
875e1767 1043
2e092625 1044/* It is not at all clear why SMASH_TEXT_ADDRESS is not folded into
181c1381
RE
1045 ADDR_BITS_REMOVE. */
1046
181c1381
RE
1047typedef CORE_ADDR (gdbarch_smash_text_address_ftype) (CORE_ADDR addr);
1048extern CORE_ADDR gdbarch_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR addr);
1049extern void set_gdbarch_smash_text_address (struct gdbarch *gdbarch, gdbarch_smash_text_address_ftype *smash_text_address);
5010d38b 1050#if !defined (GDB_TM_FILE) && defined (SMASH_TEXT_ADDRESS)
181c1381
RE
1051#error "Non multi-arch definition of SMASH_TEXT_ADDRESS"
1052#endif
c25083af 1053#if !defined (SMASH_TEXT_ADDRESS)
181c1381
RE
1054#define SMASH_TEXT_ADDRESS(addr) (gdbarch_smash_text_address (current_gdbarch, addr))
1055#endif
181c1381 1056
e6590a1b
UW
1057/* FIXME/cagney/2001-01-18: This should be split in two. A target method that
1058 indicates if the target needs software single step. An ISA method to
1059 implement it.
64c4637f 1060
e6590a1b
UW
1061 FIXME/cagney/2001-01-18: This should be replaced with something that inserts
1062 breakpoints using the breakpoint system instead of blatting memory directly
1063 (as with rs6000).
64c4637f 1064
e6590a1b
UW
1065 FIXME/cagney/2001-01-18: The logic is backwards. It should be asking if the
1066 target can single step. If not, then implement single step using breakpoints.
1067
1068 A return value of 1 means that the software_single_step breakpoints
1069 were inserted; 0 means they were not. */
64c4637f
AC
1070
1071#if defined (SOFTWARE_SINGLE_STEP)
1072/* Legacy for systems yet to multi-arch SOFTWARE_SINGLE_STEP */
1073#if !defined (SOFTWARE_SINGLE_STEP_P)
1074#define SOFTWARE_SINGLE_STEP_P() (1)
1075#endif
1076#endif
1077
64c4637f 1078extern int gdbarch_software_single_step_p (struct gdbarch *gdbarch);
5010d38b 1079#if !defined (GDB_TM_FILE) && defined (SOFTWARE_SINGLE_STEP_P)
83905903
AC
1080#error "Non multi-arch definition of SOFTWARE_SINGLE_STEP"
1081#endif
bceabdd8 1082#if !defined (SOFTWARE_SINGLE_STEP_P)
64c4637f
AC
1083#define SOFTWARE_SINGLE_STEP_P() (gdbarch_software_single_step_p (current_gdbarch))
1084#endif
1085
e0cd558a
UW
1086typedef int (gdbarch_software_single_step_ftype) (struct regcache *regcache);
1087extern int gdbarch_software_single_step (struct gdbarch *gdbarch, struct regcache *regcache);
64c4637f 1088extern void set_gdbarch_software_single_step (struct gdbarch *gdbarch, gdbarch_software_single_step_ftype *software_single_step);
5010d38b 1089#if !defined (GDB_TM_FILE) && defined (SOFTWARE_SINGLE_STEP)
83905903
AC
1090#error "Non multi-arch definition of SOFTWARE_SINGLE_STEP"
1091#endif
c25083af 1092#if !defined (SOFTWARE_SINGLE_STEP)
e0cd558a 1093#define SOFTWARE_SINGLE_STEP(regcache) (gdbarch_software_single_step (current_gdbarch, regcache))
64c4637f 1094#endif
64c4637f 1095
3352ef37
AC
1096/* Return non-zero if the processor is executing a delay slot and a
1097 further single-step is needed before the instruction finishes. */
1098
1099extern int gdbarch_single_step_through_delay_p (struct gdbarch *gdbarch);
1100
1101typedef int (gdbarch_single_step_through_delay_ftype) (struct gdbarch *gdbarch, struct frame_info *frame);
1102extern int gdbarch_single_step_through_delay (struct gdbarch *gdbarch, struct frame_info *frame);
1103extern void set_gdbarch_single_step_through_delay (struct gdbarch *gdbarch, gdbarch_single_step_through_delay_ftype *single_step_through_delay);
1104
f6c40618 1105/* FIXME: cagney/2003-08-28: Need to find a better way of selecting the
b2fa5097 1106 disassembler. Perhaps objdump can handle it? */
f6c40618 1107
a89aa300
AC
1108typedef int (gdbarch_print_insn_ftype) (bfd_vma vma, struct disassemble_info *info);
1109extern int gdbarch_print_insn (struct gdbarch *gdbarch, bfd_vma vma, struct disassemble_info *info);
2bf0cb65 1110extern void set_gdbarch_print_insn (struct gdbarch *gdbarch, gdbarch_print_insn_ftype *print_insn);
5010d38b 1111#if !defined (GDB_TM_FILE) && defined (TARGET_PRINT_INSN)
2bf0cb65
EZ
1112#error "Non multi-arch definition of TARGET_PRINT_INSN"
1113#endif
c25083af 1114#if !defined (TARGET_PRINT_INSN)
2bf0cb65
EZ
1115#define TARGET_PRINT_INSN(vma, info) (gdbarch_print_insn (current_gdbarch, vma, info))
1116#endif
2bf0cb65 1117
bdcd319a
CV
1118typedef CORE_ADDR (gdbarch_skip_trampoline_code_ftype) (CORE_ADDR pc);
1119extern CORE_ADDR gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, CORE_ADDR pc);
1120extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_skip_trampoline_code_ftype *skip_trampoline_code);
5010d38b 1121#if !defined (GDB_TM_FILE) && defined (SKIP_TRAMPOLINE_CODE)
bdcd319a
CV
1122#error "Non multi-arch definition of SKIP_TRAMPOLINE_CODE"
1123#endif
c25083af 1124#if !defined (SKIP_TRAMPOLINE_CODE)
bdcd319a
CV
1125#define SKIP_TRAMPOLINE_CODE(pc) (gdbarch_skip_trampoline_code (current_gdbarch, pc))
1126#endif
bdcd319a 1127
dea0c52f
MK
1128/* If IN_SOLIB_DYNSYM_RESOLVE_CODE returns true, and SKIP_SOLIB_RESOLVER
1129 evaluates non-zero, this is the address where the debugger will place
1130 a step-resume breakpoint to get us past the dynamic linker. */
1131
4c8c40e6 1132typedef CORE_ADDR (gdbarch_skip_solib_resolver_ftype) (struct gdbarch *gdbarch, CORE_ADDR pc);
dea0c52f
MK
1133extern CORE_ADDR gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc);
1134extern void set_gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, gdbarch_skip_solib_resolver_ftype *skip_solib_resolver);
dea0c52f 1135
d50355b6
MS
1136/* Some systems also have trampoline code for returning from shared libs. */
1137
d50355b6
MS
1138typedef int (gdbarch_in_solib_return_trampoline_ftype) (CORE_ADDR pc, char *name);
1139extern int gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name);
1140extern void set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline);
5010d38b 1141#if !defined (GDB_TM_FILE) && defined (IN_SOLIB_RETURN_TRAMPOLINE)
d50355b6
MS
1142#error "Non multi-arch definition of IN_SOLIB_RETURN_TRAMPOLINE"
1143#endif
c25083af 1144#if !defined (IN_SOLIB_RETURN_TRAMPOLINE)
d50355b6
MS
1145#define IN_SOLIB_RETURN_TRAMPOLINE(pc, name) (gdbarch_in_solib_return_trampoline (current_gdbarch, pc, name))
1146#endif
d50355b6 1147
c12260ac
CV
1148/* A target might have problems with watchpoints as soon as the stack
1149 frame of the current function has been destroyed. This mostly happens
1150 as the first action in a funtion's epilogue. in_function_epilogue_p()
1151 is defined to return a non-zero value if either the given addr is one
1152 instruction after the stack destroying instruction up to the trailing
1153 return instruction or if we can figure out that the stack frame has
1154 already been invalidated regardless of the value of addr. Targets
1155 which don't suffer from that problem could just let this functionality
1156 untouched. */
1157
1158typedef int (gdbarch_in_function_epilogue_p_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
1159extern int gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR addr);
1160extern void set_gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch, gdbarch_in_function_epilogue_p_ftype *in_function_epilogue_p);
1161
552c04a7
TT
1162/* Given a vector of command-line arguments, return a newly allocated
1163 string which, when passed to the create_inferior function, will be
1164 parsed (on Unix systems, by the shell) to yield the same vector.
1165 This function should call error() if the argument vector is not
1166 representable for this target or if this target does not support
1167 command-line arguments.
1168 ARGC is the number of elements in the vector.
1169 ARGV is an array of strings, one per argument. */
1170
1171typedef char * (gdbarch_construct_inferior_arguments_ftype) (struct gdbarch *gdbarch, int argc, char **argv);
1172extern char * gdbarch_construct_inferior_arguments (struct gdbarch *gdbarch, int argc, char **argv);
1173extern void set_gdbarch_construct_inferior_arguments (struct gdbarch *gdbarch, gdbarch_construct_inferior_arguments_ftype *construct_inferior_arguments);
1174
a2cf933a
EZ
1175typedef void (gdbarch_elf_make_msymbol_special_ftype) (asymbol *sym, struct minimal_symbol *msym);
1176extern void gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, asymbol *sym, struct minimal_symbol *msym);
1177extern void set_gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, gdbarch_elf_make_msymbol_special_ftype *elf_make_msymbol_special);
5010d38b 1178#if !defined (GDB_TM_FILE) && defined (ELF_MAKE_MSYMBOL_SPECIAL)
a2cf933a
EZ
1179#error "Non multi-arch definition of ELF_MAKE_MSYMBOL_SPECIAL"
1180#endif
c25083af 1181#if !defined (ELF_MAKE_MSYMBOL_SPECIAL)
a2cf933a
EZ
1182#define ELF_MAKE_MSYMBOL_SPECIAL(sym, msym) (gdbarch_elf_make_msymbol_special (current_gdbarch, sym, msym))
1183#endif
a2cf933a 1184
a2cf933a
EZ
1185typedef void (gdbarch_coff_make_msymbol_special_ftype) (int val, struct minimal_symbol *msym);
1186extern void gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, int val, struct minimal_symbol *msym);
1187extern void set_gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, gdbarch_coff_make_msymbol_special_ftype *coff_make_msymbol_special);
5010d38b 1188#if !defined (GDB_TM_FILE) && defined (COFF_MAKE_MSYMBOL_SPECIAL)
a2cf933a
EZ
1189#error "Non multi-arch definition of COFF_MAKE_MSYMBOL_SPECIAL"
1190#endif
c25083af 1191#if !defined (COFF_MAKE_MSYMBOL_SPECIAL)
a2cf933a
EZ
1192#define COFF_MAKE_MSYMBOL_SPECIAL(val, msym) (gdbarch_coff_make_msymbol_special (current_gdbarch, val, msym))
1193#endif
a2cf933a 1194
5720643c
JB
1195extern const char * gdbarch_name_of_malloc (struct gdbarch *gdbarch);
1196extern void set_gdbarch_name_of_malloc (struct gdbarch *gdbarch, const char * name_of_malloc);
5010d38b 1197#if !defined (GDB_TM_FILE) && defined (NAME_OF_MALLOC)
5720643c
JB
1198#error "Non multi-arch definition of NAME_OF_MALLOC"
1199#endif
c25083af 1200#if !defined (NAME_OF_MALLOC)
5720643c
JB
1201#define NAME_OF_MALLOC (gdbarch_name_of_malloc (current_gdbarch))
1202#endif
5720643c 1203
c4ed33b9
AC
1204extern int gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch);
1205extern void set_gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch, int cannot_step_breakpoint);
5010d38b 1206#if !defined (GDB_TM_FILE) && defined (CANNOT_STEP_BREAKPOINT)
c4ed33b9
AC
1207#error "Non multi-arch definition of CANNOT_STEP_BREAKPOINT"
1208#endif
c25083af 1209#if !defined (CANNOT_STEP_BREAKPOINT)
c4ed33b9
AC
1210#define CANNOT_STEP_BREAKPOINT (gdbarch_cannot_step_breakpoint (current_gdbarch))
1211#endif
c4ed33b9 1212
f74fa174
MM
1213extern int gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch);
1214extern void set_gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch, int have_nonsteppable_watchpoint);
5010d38b 1215#if !defined (GDB_TM_FILE) && defined (HAVE_NONSTEPPABLE_WATCHPOINT)
f74fa174
MM
1216#error "Non multi-arch definition of HAVE_NONSTEPPABLE_WATCHPOINT"
1217#endif
c25083af 1218#if !defined (HAVE_NONSTEPPABLE_WATCHPOINT)
f74fa174
MM
1219#define HAVE_NONSTEPPABLE_WATCHPOINT (gdbarch_have_nonsteppable_watchpoint (current_gdbarch))
1220#endif
f74fa174 1221
8b2dbe47
KB
1222#if defined (ADDRESS_CLASS_TYPE_FLAGS)
1223/* Legacy for systems yet to multi-arch ADDRESS_CLASS_TYPE_FLAGS */
1224#if !defined (ADDRESS_CLASS_TYPE_FLAGS_P)
1225#define ADDRESS_CLASS_TYPE_FLAGS_P() (1)
1226#endif
1227#endif
1228
8b2dbe47 1229extern int gdbarch_address_class_type_flags_p (struct gdbarch *gdbarch);
5010d38b 1230#if !defined (GDB_TM_FILE) && defined (ADDRESS_CLASS_TYPE_FLAGS_P)
8b2dbe47
KB
1231#error "Non multi-arch definition of ADDRESS_CLASS_TYPE_FLAGS"
1232#endif
bceabdd8 1233#if !defined (ADDRESS_CLASS_TYPE_FLAGS_P)
8b2dbe47
KB
1234#define ADDRESS_CLASS_TYPE_FLAGS_P() (gdbarch_address_class_type_flags_p (current_gdbarch))
1235#endif
1236
8b2dbe47
KB
1237typedef int (gdbarch_address_class_type_flags_ftype) (int byte_size, int dwarf2_addr_class);
1238extern int gdbarch_address_class_type_flags (struct gdbarch *gdbarch, int byte_size, int dwarf2_addr_class);
1239extern void set_gdbarch_address_class_type_flags (struct gdbarch *gdbarch, gdbarch_address_class_type_flags_ftype *address_class_type_flags);
5010d38b 1240#if !defined (GDB_TM_FILE) && defined (ADDRESS_CLASS_TYPE_FLAGS)
8b2dbe47
KB
1241#error "Non multi-arch definition of ADDRESS_CLASS_TYPE_FLAGS"
1242#endif
c25083af 1243#if !defined (ADDRESS_CLASS_TYPE_FLAGS)
8b2dbe47
KB
1244#define ADDRESS_CLASS_TYPE_FLAGS(byte_size, dwarf2_addr_class) (gdbarch_address_class_type_flags (current_gdbarch, byte_size, dwarf2_addr_class))
1245#endif
8b2dbe47 1246
8b2dbe47 1247extern int gdbarch_address_class_type_flags_to_name_p (struct gdbarch *gdbarch);
8b2dbe47 1248
321432c0
KB
1249typedef const char * (gdbarch_address_class_type_flags_to_name_ftype) (struct gdbarch *gdbarch, int type_flags);
1250extern const char * gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags);
8b2dbe47 1251extern 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);
8b2dbe47
KB
1252
1253extern int gdbarch_address_class_name_to_type_flags_p (struct gdbarch *gdbarch);
8b2dbe47 1254
321432c0
KB
1255typedef int (gdbarch_address_class_name_to_type_flags_ftype) (struct gdbarch *gdbarch, const char *name, int *type_flags_ptr);
1256extern int gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name, int *type_flags_ptr);
8b2dbe47 1257extern 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);
8b2dbe47 1258
b59ff9d5
AC
1259/* Is a register in a group */
1260
1261typedef int (gdbarch_register_reggroup_p_ftype) (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup);
1262extern int gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup);
1263extern void set_gdbarch_register_reggroup_p (struct gdbarch *gdbarch, gdbarch_register_reggroup_p_ftype *register_reggroup_p);
1264
2e092625 1265/* Fetch the pointer to the ith function argument. */
143985b7
AF
1266
1267#if defined (FETCH_POINTER_ARGUMENT)
1268/* Legacy for systems yet to multi-arch FETCH_POINTER_ARGUMENT */
1269#if !defined (FETCH_POINTER_ARGUMENT_P)
1270#define FETCH_POINTER_ARGUMENT_P() (1)
1271#endif
1272#endif
1273
143985b7 1274extern int gdbarch_fetch_pointer_argument_p (struct gdbarch *gdbarch);
5010d38b 1275#if !defined (GDB_TM_FILE) && defined (FETCH_POINTER_ARGUMENT_P)
143985b7
AF
1276#error "Non multi-arch definition of FETCH_POINTER_ARGUMENT"
1277#endif
bceabdd8 1278#if !defined (FETCH_POINTER_ARGUMENT_P)
143985b7
AF
1279#define FETCH_POINTER_ARGUMENT_P() (gdbarch_fetch_pointer_argument_p (current_gdbarch))
1280#endif
1281
143985b7
AF
1282typedef CORE_ADDR (gdbarch_fetch_pointer_argument_ftype) (struct frame_info *frame, int argi, struct type *type);
1283extern CORE_ADDR gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, struct frame_info *frame, int argi, struct type *type);
1284extern void set_gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument);
5010d38b 1285#if !defined (GDB_TM_FILE) && defined (FETCH_POINTER_ARGUMENT)
143985b7
AF
1286#error "Non multi-arch definition of FETCH_POINTER_ARGUMENT"
1287#endif
1288#if !defined (FETCH_POINTER_ARGUMENT)
1289#define FETCH_POINTER_ARGUMENT(frame, argi, type) (gdbarch_fetch_pointer_argument (current_gdbarch, frame, argi, type))
1290#endif
1291
6ce6d90f
MK
1292/* Return the appropriate register set for a core file section with
1293 name SECT_NAME and size SECT_SIZE. */
1294
1295extern int gdbarch_regset_from_core_section_p (struct gdbarch *gdbarch);
1296
1297typedef const struct regset * (gdbarch_regset_from_core_section_ftype) (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size);
1298extern const struct regset * gdbarch_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size);
1299extern void set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch, gdbarch_regset_from_core_section_ftype *regset_from_core_section);
1300
0d5de010
DJ
1301/* If the elements of C++ vtables are in-place function descriptors rather
1302 than normal function pointers (which may point to code or a descriptor),
1303 set this to one. */
1304
1305extern int gdbarch_vtable_function_descriptors (struct gdbarch *gdbarch);
1306extern void set_gdbarch_vtable_function_descriptors (struct gdbarch *gdbarch, int vtable_function_descriptors);
1307
1308/* Set if the least significant bit of the delta is used instead of the least
1309 significant bit of the pfn for pointers to virtual member functions. */
1310
1311extern int gdbarch_vbit_in_delta (struct gdbarch *gdbarch);
1312extern void set_gdbarch_vbit_in_delta (struct gdbarch *gdbarch, int vbit_in_delta);
1313
6d350bb5
UW
1314/* Advance PC to next instruction in order to skip a permanent breakpoint. */
1315
1316extern int gdbarch_skip_permanent_breakpoint_p (struct gdbarch *gdbarch);
1317
1318typedef void (gdbarch_skip_permanent_breakpoint_ftype) (struct regcache *regcache);
1319extern void gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, struct regcache *regcache);
1320extern void set_gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint);
1321
1c772458
UW
1322/* Refresh overlay mapped state for section OSECT. */
1323
1324extern int gdbarch_overlay_update_p (struct gdbarch *gdbarch);
1325
1326typedef void (gdbarch_overlay_update_ftype) (struct obj_section *osect);
1327extern void gdbarch_overlay_update (struct gdbarch *gdbarch, struct obj_section *osect);
1328extern void set_gdbarch_overlay_update (struct gdbarch *gdbarch, gdbarch_overlay_update_ftype *overlay_update);
1329
104c1213 1330extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);
0f71a2f6
JM
1331
1332
1333/* Mechanism for co-ordinating the selection of a specific
1334 architecture.
1335
1336 GDB targets (*-tdep.c) can register an interest in a specific
1337 architecture. Other GDB components can register a need to maintain
1338 per-architecture data.
1339
1340 The mechanisms below ensures that there is only a loose connection
1341 between the set-architecture command and the various GDB
99e7bb18 1342 components. Each component can independently register their need
0f71a2f6
JM
1343 to maintain architecture specific data with gdbarch.
1344
1345 Pragmatics:
1346
1347 Previously, a single TARGET_ARCHITECTURE_HOOK was provided. It
1348 didn't scale.
1349
1350 The more traditional mega-struct containing architecture specific
1351 data for all the various GDB components was also considered. Since
99e7bb18 1352 GDB is built from a variable number of (fairly independent)
0f71a2f6
JM
1353 components it was determined that the global aproach was not
1354 applicable. */
1355
1356
1357/* Register a new architectural family with GDB.
1358
1359 Register support for the specified ARCHITECTURE with GDB. When
1360 gdbarch determines that the specified architecture has been
1361 selected, the corresponding INIT function is called.
1362
1363 --
1364
1365 The INIT function takes two parameters: INFO which contains the
1366 information available to gdbarch about the (possibly new)
1367 architecture; ARCHES which is a list of the previously created
1368 ``struct gdbarch'' for this architecture.
1369
0f79675b 1370 The INFO parameter is, as far as possible, be pre-initialized with
7a107747 1371 information obtained from INFO.ABFD or the global defaults.
0f79675b
AC
1372
1373 The ARCHES parameter is a linked list (sorted most recently used)
1374 of all the previously created architures for this architecture
1375 family. The (possibly NULL) ARCHES->gdbarch can used to access
1376 values from the previously selected architecture for this
1377 architecture family. The global ``current_gdbarch'' shall not be
1378 used.
0f71a2f6
JM
1379
1380 The INIT function shall return any of: NULL - indicating that it
ec3d358c 1381 doesn't recognize the selected architecture; an existing ``struct
0f71a2f6
JM
1382 gdbarch'' from the ARCHES list - indicating that the new
1383 architecture is just a synonym for an earlier architecture (see
1384 gdbarch_list_lookup_by_info()); a newly created ``struct gdbarch''
4b9b3959
AC
1385 - that describes the selected architecture (see gdbarch_alloc()).
1386
1387 The DUMP_TDEP function shall print out all target specific values.
1388 Care should be taken to ensure that the function works in both the
1389 multi-arch and non- multi-arch cases. */
0f71a2f6 1390
adf40b2e
JM
1391struct gdbarch_list
1392{
1393 struct gdbarch *gdbarch;
1394 struct gdbarch_list *next;
1395};
0f71a2f6 1396
adf40b2e
JM
1397struct gdbarch_info
1398{
adf40b2e
JM
1399 /* Use default: NULL (ZERO). */
1400 const struct bfd_arch_info *bfd_arch_info;
0f71a2f6 1401
428721aa 1402 /* Use default: BFD_ENDIAN_UNKNOWN (NB: is not ZERO). */
adf40b2e 1403 int byte_order;
0f71a2f6 1404
adf40b2e
JM
1405 /* Use default: NULL (ZERO). */
1406 bfd *abfd;
0f71a2f6 1407
adf40b2e
JM
1408 /* Use default: NULL (ZERO). */
1409 struct gdbarch_tdep_info *tdep_info;
4be87837
DJ
1410
1411 /* Use default: GDB_OSABI_UNINITIALIZED (-1). */
1412 enum gdb_osabi osabi;
424163ea
DJ
1413
1414 /* Use default: NULL (ZERO). */
1415 const struct target_desc *target_desc;
adf40b2e 1416};
0f71a2f6 1417
104c1213 1418typedef struct gdbarch *(gdbarch_init_ftype) (struct gdbarch_info info, struct gdbarch_list *arches);
4b9b3959 1419typedef void (gdbarch_dump_tdep_ftype) (struct gdbarch *gdbarch, struct ui_file *file);
0f71a2f6 1420
4b9b3959 1421/* DEPRECATED - use gdbarch_register() */
104c1213 1422extern void register_gdbarch_init (enum bfd_architecture architecture, gdbarch_init_ftype *);
0f71a2f6 1423
4b9b3959
AC
1424extern void gdbarch_register (enum bfd_architecture architecture,
1425 gdbarch_init_ftype *,
1426 gdbarch_dump_tdep_ftype *);
1427
0f71a2f6 1428
b4a20239
AC
1429/* Return a freshly allocated, NULL terminated, array of the valid
1430 architecture names. Since architectures are registered during the
1431 _initialize phase this function only returns useful information
1432 once initialization has been completed. */
1433
1434extern const char **gdbarch_printable_names (void);
1435
1436
0f71a2f6
JM
1437/* Helper function. Search the list of ARCHES for a GDBARCH that
1438 matches the information provided by INFO. */
1439
424163ea 1440extern struct gdbarch_list *gdbarch_list_lookup_by_info (struct gdbarch_list *arches, const struct gdbarch_info *info);
0f71a2f6
JM
1441
1442
1443/* Helper function. Create a preliminary ``struct gdbarch''. Perform
424163ea 1444 basic initialization using values obtained from the INFO and TDEP
0f71a2f6
JM
1445 parameters. set_gdbarch_*() functions are called to complete the
1446 initialization of the object. */
1447
104c1213 1448extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info, struct gdbarch_tdep *tdep);
0f71a2f6
JM
1449
1450
4b9b3959
AC
1451/* Helper function. Free a partially-constructed ``struct gdbarch''.
1452 It is assumed that the caller freeds the ``struct
1453 gdbarch_tdep''. */
1454
058f20d5
JB
1455extern void gdbarch_free (struct gdbarch *);
1456
1457
aebd7893
AC
1458/* Helper function. Allocate memory from the ``struct gdbarch''
1459 obstack. The memory is freed when the corresponding architecture
1460 is also freed. */
1461
1462extern void *gdbarch_obstack_zalloc (struct gdbarch *gdbarch, long size);
1463#define GDBARCH_OBSTACK_CALLOC(GDBARCH, NR, TYPE) ((TYPE *) gdbarch_obstack_zalloc ((GDBARCH), (NR) * sizeof (TYPE)))
1464#define GDBARCH_OBSTACK_ZALLOC(GDBARCH, TYPE) ((TYPE *) gdbarch_obstack_zalloc ((GDBARCH), sizeof (TYPE)))
1465
1466
b732d07d 1467/* Helper function. Force an update of the current architecture.
0f71a2f6 1468
b732d07d
AC
1469 The actual architecture selected is determined by INFO, ``(gdb) set
1470 architecture'' et.al., the existing architecture and BFD's default
1471 architecture. INFO should be initialized to zero and then selected
1472 fields should be updated.
0f71a2f6 1473
16f33e29
AC
1474 Returns non-zero if the update succeeds */
1475
1476extern int gdbarch_update_p (struct gdbarch_info info);
0f71a2f6
JM
1477
1478
ebdba546
AC
1479/* Helper function. Find an architecture matching info.
1480
1481 INFO should be initialized using gdbarch_info_init, relevant fields
1482 set, and then finished using gdbarch_info_fill.
1483
1484 Returns the corresponding architecture, or NULL if no matching
1485 architecture was found. "current_gdbarch" is not updated. */
1486
1487extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info);
1488
1489
1490/* Helper function. Set the global "current_gdbarch" to "gdbarch".
1491
1492 FIXME: kettenis/20031124: Of the functions that follow, only
1493 gdbarch_from_bfd is supposed to survive. The others will
1494 dissappear since in the future GDB will (hopefully) be truly
1495 multi-arch. However, for now we're still stuck with the concept of
1496 a single active architecture. */
1497
1498extern void deprecated_current_gdbarch_select_hack (struct gdbarch *gdbarch);
1499
0f71a2f6
JM
1500
1501/* Register per-architecture data-pointer.
1502
1503 Reserve space for a per-architecture data-pointer. An identifier
1504 for the reserved data-pointer is returned. That identifer should
95160752 1505 be saved in a local static variable.
0f71a2f6 1506
fcc1c85c
AC
1507 Memory for the per-architecture data shall be allocated using
1508 gdbarch_obstack_zalloc. That memory will be deleted when the
1509 corresponding architecture object is deleted.
0f71a2f6 1510
95160752
AC
1511 When a previously created architecture is re-selected, the
1512 per-architecture data-pointer for that previous architecture is
76860b5f 1513 restored. INIT() is not re-called.
0f71a2f6
JM
1514
1515 Multiple registrarants for any architecture are allowed (and
1516 strongly encouraged). */
1517
95160752 1518struct gdbarch_data;
0f71a2f6 1519
030f20e1
AC
1520typedef void *(gdbarch_data_pre_init_ftype) (struct obstack *obstack);
1521extern struct gdbarch_data *gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *init);
1522typedef void *(gdbarch_data_post_init_ftype) (struct gdbarch *gdbarch);
1523extern struct gdbarch_data *gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *init);
1524extern void deprecated_set_gdbarch_data (struct gdbarch *gdbarch,
1525 struct gdbarch_data *data,
1526 void *pointer);
0f71a2f6 1527
451fbdda 1528extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *);
0f71a2f6
JM
1529
1530
a8cf2722 1531
0f71a2f6
JM
1532/* Register per-architecture memory region.
1533
1534 Provide a memory-region swap mechanism. Per-architecture memory
1535 region are created. These memory regions are swapped whenever the
1536 architecture is changed. For a new architecture, the memory region
1537 is initialized with zero (0) and the INIT function is called.
1538
1539 Memory regions are swapped / initialized in the order that they are
1540 registered. NULL DATA and/or INIT values can be specified.
1541
030f20e1 1542 New code should use gdbarch_data_register_*(). */
0f71a2f6 1543
104c1213 1544typedef void (gdbarch_swap_ftype) (void);
046a4708
AC
1545extern void deprecated_register_gdbarch_swap (void *data, unsigned long size, gdbarch_swap_ftype *init);
1546#define DEPRECATED_REGISTER_GDBARCH_SWAP(VAR) deprecated_register_gdbarch_swap (&(VAR), sizeof ((VAR)), NULL)
0f71a2f6
JM
1547
1548
1549
99e7bb18 1550/* Set the dynamic target-system-dependent parameters (architecture,
c906108c
SS
1551 byte-order, ...) using information found in the BFD */
1552
104c1213 1553extern void set_gdbarch_from_file (bfd *);
c906108c
SS
1554
1555
e514a9d6
JM
1556/* Initialize the current architecture to the "first" one we find on
1557 our list. */
1558
1559extern void initialize_current_architecture (void);
1560
c906108c 1561/* gdbarch trace variable */
adf40b2e 1562extern int gdbarch_debug;
c906108c 1563
4b9b3959 1564extern void gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file);
0f71a2f6 1565
c906108c 1566#endif
This page took 0.664841 seconds and 4 git commands to generate.