aboutsummaryrefslogtreecommitdiff
path: root/gdb/target-descriptions.c
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2018-04-18 11:28:51 +0100
committerAlan Hayward <alan.hayward@arm.com>2018-04-18 14:00:30 +0100
commitea3e7d717982e3c467edc7886b1d6cc2807195af (patch)
treea50ee7f7b3986c136909b29040ff67bb493fb37f /gdb/target-descriptions.c
parenta7504f87d41694d441fabb3308631df4d2750c24 (diff)
downloadgdb-ea3e7d717982e3c467edc7886b1d6cc2807195af.zip
gdb-ea3e7d717982e3c467edc7886b1d6cc2807195af.tar.gz
gdb-ea3e7d717982e3c467edc7886b1d6cc2807195af.tar.bz2
Commonise tdesc_reg and makes use of it in gdbserver tdesc
gdb/ * Makefile.in: Add arch/tdesc.c * common/tdesc.c: New file. * common/tdesc.h (tdesc_element_visitor): Move to here. (tdesc_element): Likewise. (tdesc_reg): Likewise. (tdesc_reg_up): Likewise. * regformats/regdef.h (reg): Add offset to constructors. * target-descriptions.c (tdesc_element_visitor): Move from here. (tdesc_element): Likewise. (tdesc_reg): Likewise. (tdesc_reg_up): Likewise. gdbserver/ * Makefile.in: Add common/tdesc.c * tdesc.c (init_target_desc): init all reg_defs from register vector. (tdesc_create_reg): Create tdesc_reg. * tdesc.h (tdesc_feature): Add register vector.
Diffstat (limited to 'gdb/target-descriptions.c')
-rw-r--r--gdb/target-descriptions.c116
1 files changed, 0 insertions, 116 deletions
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 5d34e29..3186bf8 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -38,44 +38,6 @@
#include "completer.h"
#include "readline/tilde.h" /* tilde_expand */
-static type *make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype);
-
-/* The interface to visit different elements of target description. */
-
-class tdesc_element_visitor
-{
-public:
- virtual void visit_pre (const target_desc *e)
- {}
-
- virtual void visit_post (const target_desc *e)
- {}
-
- virtual void visit_pre (const tdesc_feature *e)
- {}
-
- virtual void visit_post (const tdesc_feature *e)
- {}
-
- virtual void visit (const tdesc_type_builtin *e)
- {}
-
- virtual void visit (const tdesc_type_vector *e)
- {}
-
- virtual void visit (const tdesc_type_with_fields *e)
- {}
-
- virtual void visit (const tdesc_reg *e)
- {}
-};
-
-class tdesc_element
-{
-public:
- virtual void accept (tdesc_element_visitor &v) const = 0;
-};
-
/* Types. */
struct property
@@ -88,84 +50,6 @@ struct property
std::string value;
};
-/* An individual register from a target description. */
-
-struct tdesc_reg : tdesc_element
-{
- tdesc_reg (struct tdesc_feature *feature, const std::string &name_,
- int regnum, int save_restore_, const char *group_,
- int bitsize_, const char *type_)
- : name (name_), target_regnum (regnum),
- save_restore (save_restore_),
- group (group_ != NULL ? group_ : ""),
- bitsize (bitsize_),
- type (type_ != NULL ? type_ : "<unknown>")
- {
- /* If the register's type is target-defined, look it up now. We may not
- have easy access to the containing feature when we want it later. */
- tdesc_type = tdesc_named_type (feature, type.c_str ());
- }
-
- virtual ~tdesc_reg () = default;
-
- DISABLE_COPY_AND_ASSIGN (tdesc_reg);
-
- /* The name of this register. In standard features, it may be
- recognized by the architecture support code, or it may be purely
- for the user. */
- std::string name;
-
- /* The register number used by this target to refer to this
- register. This is used for remote p/P packets and to determine
- the ordering of registers in the remote g/G packets. */
- long target_regnum;
-
- /* If this flag is set, GDB should save and restore this register
- around calls to an inferior function. */
- int save_restore;
-
- /* The name of the register group containing this register, or empty
- if the group should be automatically determined from the register's
- type. This is traditionally "general", "float", "vector" but can
- also be an arbitrary string. If defined the corresponding "info"
- command should display this register's value. The string should be
- limited to alphanumeric characters and internal hyphens. */
- std::string group;
-
- /* The size of the register, in bits. */
- int bitsize;
-
- /* The type of the register. This string corresponds to either
- a named type from the target description or a predefined
- type from GDB. */
- std::string type;
-
- /* The target-described type corresponding to TYPE, if found. */
- struct tdesc_type *tdesc_type;
-
- void accept (tdesc_element_visitor &v) const override
- {
- v.visit (this);
- }
-
- bool operator== (const tdesc_reg &other) const
- {
- return (name == other.name
- && target_regnum == other.target_regnum
- && save_restore == other.save_restore
- && bitsize == other.bitsize
- && group == other.group
- && type == other.type);
- }
-
- bool operator!= (const tdesc_reg &other) const
- {
- return !(*this == other);
- }
-};
-
-typedef std::unique_ptr<tdesc_reg> tdesc_reg_up;
-
/* A named type from a target description. */
struct tdesc_type_field