H.J. Lu <hongjiu.lu@intel.com>
authorMark Kettenis <kettenis@gnu.org>
Wed, 13 Jun 2012 20:29:15 +0000 (20:29 +0000)
committerMark Kettenis <kettenis@gnu.org>
Wed, 13 Jun 2012 20:29:15 +0000 (20:29 +0000)
* 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.

gdb/ChangeLog
gdb/amd64-tdep.c
gdb/amd64-tdep.h
gdb/i386-tdep.c
gdb/i386-tdep.h

index fc59c2a..3d4c8ea 100644 (file)
@@ -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
index df91a51..2db5cf0 100644 (file)
@@ -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);
 }
+\f
+
+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);
index 1ed109c..cb901cc 100644 (file)
@@ -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
index 5b04505..6333556 100644 (file)
@@ -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))
index f297ae7..5f233f5 100644 (file)
@@ -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,