aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/amd64-tdep.c40
-rw-r--r--gdb/amd64-tdep.h2
-rw-r--r--gdb/i386-tdep.c2
-rw-r--r--gdb/i386-tdep.h2
5 files changed, 54 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fc59c2a..3d4c8ea 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+2012-06-13 Mark Kettenis <kettenis@gnu.org>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ * i386-tdep.h (i386_pseudo_register_name): New prototype.
+ * i386-tdep.c (i386_pseudo_register_name): Make public.
+ * amd64-tdep.h (amd64_x32_init_abi): New prototype.
+ * amd64-tdep.c (amd64_dword_names): Add "eip".
+ (amd64_x32_pseudo_register_type): New function
+ (amd64_x32_init_abi): New function.
+
2012-06-13 Jan Kratochvil <jan.kratochvil@redhat.com>
PR build/14003
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index df91a51..2db5cf0 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -258,7 +258,8 @@ static const char *amd64_word_names[] =
static const char *amd64_dword_names[] =
{
"eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp",
- "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d"
+ "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d",
+ "eip"
};
/* Return the name of register REGNUM. */
@@ -2729,6 +2730,43 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_stap_parse_special_token (gdbarch,
i386_stap_parse_special_token);
}
+
+
+static struct type *
+amd64_x32_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ switch (regnum - tdep->eax_regnum)
+ {
+ case AMD64_RBP_REGNUM: /* %ebp */
+ case AMD64_RSP_REGNUM: /* %esp */
+ return builtin_type (gdbarch)->builtin_data_ptr;
+ case AMD64_RIP_REGNUM: /* %eip */
+ return builtin_type (gdbarch)->builtin_func_ptr;
+ }
+
+ return i386_pseudo_register_type (gdbarch, regnum);
+}
+
+void
+amd64_x32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ const struct target_desc *tdesc = info.target_desc;
+
+ amd64_init_abi (info, gdbarch);
+
+ if (! tdesc_has_registers (tdesc))
+ tdesc = tdesc_x32;
+ tdep->tdesc = tdesc;
+
+ tdep->num_dword_regs = 17;
+ set_tdesc_pseudo_register_type (gdbarch, amd64_x32_pseudo_register_type);
+
+ set_gdbarch_long_bit (gdbarch, 32);
+ set_gdbarch_ptr_bit (gdbarch, 32);
+}
/* Provide a prototype to silence -Wmissing-prototypes. */
void _initialize_amd64_tdep (void);
diff --git a/gdb/amd64-tdep.h b/gdb/amd64-tdep.h
index 1ed109c..cb901cc 100644
--- a/gdb/amd64-tdep.h
+++ b/gdb/amd64-tdep.h
@@ -80,6 +80,8 @@ extern void amd64_displaced_step_fixup (struct gdbarch *gdbarch,
struct regcache *regs);
extern void amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
+extern void amd64_x32_init_abi (struct gdbarch_info info,
+ struct gdbarch *gdbarch);
/* Fill register REGNUM in REGCACHE with the appropriate
floating-point or SSE register value from *FXSAVE. If REGNUM is
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 5b04505..6333556 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -2780,7 +2780,7 @@ i386_mmx_type (struct gdbarch *gdbarch)
/* Return the GDB type object for the "standard" data type of data in
register REGNUM. */
-static struct type *
+struct type *
i386_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
{
if (i386_mmx_regnum_p (gdbarch, regnum))
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index f297ae7..5f233f5 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -309,6 +309,8 @@ extern int i386_ymm_regnum_p (struct gdbarch *gdbarch, int regnum);
extern const char *i386_pseudo_register_name (struct gdbarch *gdbarch,
int regnum);
+extern struct type *i386_pseudo_register_type (struct gdbarch *gdbarch,
+ int regnum);
extern void i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
struct regcache *regcache,