]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/target-descriptions.h
Switch the license of all .c files to GPLv3.
[thirdparty/binutils-gdb.git] / gdb / target-descriptions.h
CommitLineData
424163ea
DJ
1/* Target description support for GDB.
2
6aba47ca 3 Copyright (C) 2006, 2007 Free Software Foundation, Inc.
424163ea
DJ
4
5 Contributed by CodeSourcery.
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
a9762ec7 11 the Free Software Foundation; either version 3 of the License, or
424163ea
DJ
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
a9762ec7 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
424163ea
DJ
21
22#ifndef TARGET_DESCRIPTIONS_H
23#define TARGET_DESCRIPTIONS_H 1
24
123dc839
DJ
25struct tdesc_feature;
26struct tdesc_arch_data;
27struct tdesc_reg;
424163ea 28struct target_desc;
123dc839
DJ
29struct target_ops;
30struct type;
424163ea
DJ
31
32/* Fetch the current target's description, and switch the current
33 architecture to one which incorporates that description. */
34
35void target_find_description (void);
36
37/* Discard any description fetched from the current target, and switch
38 the current architecture to one with no target description. */
39
40void target_clear_description (void);
41
42/* Return the global current target description. This should only be
43 used by gdbarch initialization code; most access should be through
44 an existing gdbarch. */
45
46const struct target_desc *target_current_description (void);
47
123dc839 48/* Record architecture-specific functions to call for pseudo-register
f57d151a 49 support. If tdesc_use_registers is called and gdbarch_num_pseudo_regs
123dc839
DJ
50 is greater than zero, then these should be called as well.
51 They are equivalent to the gdbarch methods with similar names,
52 except that they will only be called for pseudo registers. */
53
54void set_tdesc_pseudo_register_name
55 (struct gdbarch *gdbarch, gdbarch_register_name_ftype *pseudo_name);
56
57void set_tdesc_pseudo_register_type
58 (struct gdbarch *gdbarch, gdbarch_register_type_ftype *pseudo_type);
59
60void set_tdesc_pseudo_register_reggroup_p
61 (struct gdbarch *gdbarch,
62 gdbarch_register_reggroup_p_ftype *pseudo_reggroup_p);
63
64/* Update GDBARCH to use the target description for registers. Fixed
65 register assignments are taken from EARLY_DATA, which is freed.
66 All registers which have not been assigned fixed numbers are given
f57d151a
UW
67 numbers above the current value of gdbarch_num_regs.
68 gdbarch_num_regs and various register-related predicates are updated to
69 refer to the target description. This function should only be called from
70 the architecture's gdbarch initialization routine, and only after
123dc839
DJ
71 successfully validating the required registers. */
72
73void tdesc_use_registers (struct gdbarch *gdbarch,
74 struct tdesc_arch_data *early_data);
75
76/* Allocate initial data for validation of a target description during
77 gdbarch initialization. */
78
79struct tdesc_arch_data *tdesc_data_alloc (void);
80
81/* Clean up data allocated by tdesc_data_alloc. This should only
82 be called to discard the data; tdesc_use_registers takes ownership
83 of its EARLY_DATA argument. */
84
85void tdesc_data_cleanup (void *data_untyped);
86
87/* Search FEATURE for a register named NAME. Record REGNO and the
88 register in DATA; when tdesc_use_registers is called, REGNO will be
89 assigned to the register. 1 is returned if the register was found,
90 0 if it was not. */
91
92int tdesc_numbered_register (const struct tdesc_feature *feature,
93 struct tdesc_arch_data *data,
94 int regno, const char *name);
95
96/* Search FEATURE for a register with any of the names from NAMES
97 (NULL-terminated). Record REGNO and the register in DATA; when
98 tdesc_use_registers is called, REGNO will be assigned to the
99 register. 1 is returned if the register was found, 0 if it was
100 not. */
101
102int tdesc_numbered_register_choices (const struct tdesc_feature *feature,
103 struct tdesc_arch_data *data,
104 int regno, const char *const names[]);
105
106
424163ea
DJ
107/* Accessors for target descriptions. */
108
23181151
DJ
109/* Return the BFD architecture associated with this target
110 description, or NULL if no architecture was specified. */
111
112const struct bfd_arch_info *tdesc_architecture
113 (const struct target_desc *);
114
29709017
DJ
115/* Return the string value of a property named KEY, or NULL if the
116 property was not specified. */
117
118const char *tdesc_property (const struct target_desc *,
119 const char *key);
120
123dc839
DJ
121/* Return 1 if this target description describes any registers. */
122
123int tdesc_has_registers (const struct target_desc *);
124
125/* Return the feature with the given name, if present, or NULL if
126 the named feature is not found. */
127
128const struct tdesc_feature *tdesc_find_feature (const struct target_desc *,
129 const char *name);
130
131/* Return the name of FEATURE. */
132
133const char *tdesc_feature_name (const struct tdesc_feature *feature);
134
135/* Return the type associated with ID in the context of FEATURE, or
136 NULL if none. */
137
138struct type *tdesc_named_type (const struct tdesc_feature *feature,
139 const char *id);
140
f8b73d13
DJ
141/* Return the name of register REGNO, from the target description or
142 from an architecture-provided pseudo_register_name method. */
143
144const char *tdesc_register_name (int regno);
145
146/* Check whether REGNUM is a member of REGGROUP using the target
147 description. Return -1 if the target description does not
148 specify a group. */
149
150int tdesc_register_in_reggroup_p (struct gdbarch *gdbarch, int regno,
151 struct reggroup *reggroup);
152
424163ea
DJ
153/* Methods for constructing a target description. */
154
155struct target_desc *allocate_target_description (void);
23181151
DJ
156struct cleanup *make_cleanup_free_target_description (struct target_desc *);
157void set_tdesc_architecture (struct target_desc *,
158 const struct bfd_arch_info *);
29709017
DJ
159void set_tdesc_property (struct target_desc *,
160 const char *key, const char *value);
161
123dc839
DJ
162struct tdesc_feature *tdesc_create_feature (struct target_desc *tdesc,
163 const char *name);
164void tdesc_record_type (struct tdesc_feature *feature, struct type *type);
165
166void tdesc_create_reg (struct tdesc_feature *feature, const char *name,
167 int regnum, int save_restore, const char *group,
168 int bitsize, const char *type);
169
424163ea 170#endif /* TARGET_DESCRIPTIONS_H */