aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2010-02-10 18:45:03 +0000
committerH.J. Lu <hjl.tools@gmail.com>2010-02-10 18:45:03 +0000
commit9fd3625f79a17480dd4017136edf4f9a21e834df (patch)
treea27963bf369cf3f9765ddc59a949717f93972914 /gdb
parent2fe842e549b8ded430efbbea11f10e85ad27cced (diff)
downloadgdb-9fd3625f79a17480dd4017136edf4f9a21e834df.zip
gdb-9fd3625f79a17480dd4017136edf4f9a21e834df.tar.gz
gdb-9fd3625f79a17480dd4017136edf4f9a21e834df.tar.bz2
Add i387_ext, i386_eflags and i386_mxcsr.
2010-02-10 H.J. Lu <hongjiu.lu@intel.com> * target-descriptions.c (tdesc_type): Add TDESC_TYPE_I387_EXT, TDESC_TYPE_I386_EFLAGS and TDESC_TYPE_I386_MXCSR. (tdesc_predefined_types): Add i387_ext, i386_eflags and i386_mxcsr. (tdesc_find_type): New. (tdesc_gdb_type): Use tdesc_find_type. Handle TDESC_TYPE_I387_EXT, TDESC_TYPE_I386_EFLAGS and TDESC_TYPE_I386_MXCSR. * target-descriptions.h (tdesc_find_type): New.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/target-descriptions.c99
-rw-r--r--gdb/target-descriptions.h4
3 files changed, 114 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4c3ff5c..431ba1c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+2010-02-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ * target-descriptions.c (tdesc_type): Add TDESC_TYPE_I387_EXT,
+ TDESC_TYPE_I386_EFLAGS and TDESC_TYPE_I386_MXCSR.
+ (tdesc_predefined_types): Add i387_ext, i386_eflags and
+ i386_mxcsr.
+ (tdesc_find_type): New.
+ (tdesc_gdb_type): Use tdesc_find_type. Handle TDESC_TYPE_I387_EXT,
+ TDESC_TYPE_I386_EFLAGS and TDESC_TYPE_I386_MXCSR.
+
+ * target-descriptions.h (tdesc_find_type): New.
+
2010-02-10 Michael Snyder <msnyder@vmware.com>
* gdb-gdb.py: Comment fix.
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 4fbc72c..9856d6f 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -117,6 +117,9 @@ typedef struct tdesc_type
TDESC_TYPE_IEEE_SINGLE,
TDESC_TYPE_IEEE_DOUBLE,
TDESC_TYPE_ARM_FPA_EXT,
+ TDESC_TYPE_I387_EXT,
+ TDESC_TYPE_I386_EFLAGS,
+ TDESC_TYPE_I386_MXCSR,
/* Types defined by a target feature. */
TDESC_TYPE_VECTOR,
@@ -461,7 +464,10 @@ static struct tdesc_type tdesc_predefined_types[] =
{ "data_ptr", TDESC_TYPE_DATA_PTR },
{ "ieee_single", TDESC_TYPE_IEEE_SINGLE },
{ "ieee_double", TDESC_TYPE_IEEE_DOUBLE },
- { "arm_fpa_ext", TDESC_TYPE_ARM_FPA_EXT }
+ { "arm_fpa_ext", TDESC_TYPE_ARM_FPA_EXT },
+ { "i387_ext", TDESC_TYPE_I387_EXT },
+ { "i386_eflags", TDESC_TYPE_I386_EFLAGS },
+ { "i386_mxcsr", TDESC_TYPE_I386_MXCSR }
};
/* Return the type associated with ID in the context of FEATURE, or
@@ -486,12 +492,38 @@ tdesc_named_type (const struct tdesc_feature *feature, const char *id)
return NULL;
}
+/* Lookup type associated with ID. */
+
+struct type *
+tdesc_find_type (struct gdbarch *gdbarch, const char *id)
+{
+ struct tdesc_arch_reg *reg;
+ struct tdesc_arch_data *data;
+ int i, num_regs;
+
+ data = gdbarch_data (gdbarch, tdesc_data);
+ num_regs = VEC_length (tdesc_arch_reg, data->arch_regs);
+ for (i = 0; i < num_regs; i++)
+ {
+ reg = VEC_index (tdesc_arch_reg, data->arch_regs, i);
+ if (reg->reg
+ && reg->reg->tdesc_type
+ && reg->type
+ && strcmp (id, reg->reg->tdesc_type->name) == 0)
+ return reg->type;
+ }
+
+ return NULL;
+}
+
/* Construct, if necessary, and return the GDB type implementing target
type TDESC_TYPE for architecture GDBARCH. */
static struct type *
tdesc_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *tdesc_type)
{
+ struct type *type;
+
switch (tdesc_type->kind)
{
/* Predefined types. */
@@ -531,6 +563,16 @@ tdesc_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *tdesc_type)
case TDESC_TYPE_DATA_PTR:
return builtin_type (gdbarch)->builtin_data_ptr;
+ default:
+ break;
+ }
+
+ type = tdesc_find_type (gdbarch, tdesc_type->name);
+ if (type)
+ return type;
+
+ switch (tdesc_type->kind)
+ {
case TDESC_TYPE_IEEE_SINGLE:
return arch_float_type (gdbarch, -1, "builtin_type_ieee_single",
floatformats_ieee_single);
@@ -543,6 +585,61 @@ tdesc_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *tdesc_type)
return arch_float_type (gdbarch, -1, "builtin_type_arm_ext",
floatformats_arm_ext);
+ case TDESC_TYPE_I387_EXT:
+ return arch_float_type (gdbarch, -1, "builtin_type_i387_ext",
+ floatformats_i387_ext);
+
+ case TDESC_TYPE_I386_EFLAGS:
+ {
+ struct type *type;
+
+ type = arch_flags_type (gdbarch, "builtin_type_i386_eflags", 4);
+ append_flags_type_flag (type, 0, "CF");
+ append_flags_type_flag (type, 1, NULL);
+ append_flags_type_flag (type, 2, "PF");
+ append_flags_type_flag (type, 4, "AF");
+ append_flags_type_flag (type, 6, "ZF");
+ append_flags_type_flag (type, 7, "SF");
+ append_flags_type_flag (type, 8, "TF");
+ append_flags_type_flag (type, 9, "IF");
+ append_flags_type_flag (type, 10, "DF");
+ append_flags_type_flag (type, 11, "OF");
+ append_flags_type_flag (type, 14, "NT");
+ append_flags_type_flag (type, 16, "RF");
+ append_flags_type_flag (type, 17, "VM");
+ append_flags_type_flag (type, 18, "AC");
+ append_flags_type_flag (type, 19, "VIF");
+ append_flags_type_flag (type, 20, "VIP");
+ append_flags_type_flag (type, 21, "ID");
+
+ return type;
+ }
+ break;
+
+ case TDESC_TYPE_I386_MXCSR:
+ {
+ struct type *type;
+
+ type = arch_flags_type (gdbarch, "builtin_type_i386_mxcsr", 4);
+ append_flags_type_flag (type, 0, "IE");
+ append_flags_type_flag (type, 1, "DE");
+ append_flags_type_flag (type, 2, "ZE");
+ append_flags_type_flag (type, 3, "OE");
+ append_flags_type_flag (type, 4, "UE");
+ append_flags_type_flag (type, 5, "PE");
+ append_flags_type_flag (type, 6, "DAZ");
+ append_flags_type_flag (type, 7, "IM");
+ append_flags_type_flag (type, 8, "DM");
+ append_flags_type_flag (type, 9, "ZM");
+ append_flags_type_flag (type, 10, "OM");
+ append_flags_type_flag (type, 11, "UM");
+ append_flags_type_flag (type, 12, "PM");
+ append_flags_type_flag (type, 15, "FZ");
+
+ return type;
+ }
+ break;
+
/* Types defined by a target feature. */
case TDESC_TYPE_VECTOR:
{
diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h
index 17f52eb..da0564b 100644
--- a/gdb/target-descriptions.h
+++ b/gdb/target-descriptions.h
@@ -176,6 +176,10 @@ const char *tdesc_register_name (struct gdbarch *gdbarch, int regno);
struct type *tdesc_register_type (struct gdbarch *gdbarch, int regno);
+/* Return the type associated with ID, from the target description. */
+
+struct type *tdesc_find_type (struct gdbarch *gdbarch, const char *id);
+
/* Check whether REGNUM is a member of REGGROUP using the target
description. Return -1 if the target description does not
specify a group. */