diff options
author | Mark Kettenis <kettenis@gnu.org> | 2012-06-13 20:29:15 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2012-06-13 20:29:15 +0000 |
commit | fff4548bff0958dd77ee051e6b322f1c884896c9 (patch) | |
tree | d2bbbbb15c3295c6e10fd76d0dd84f95393b9784 /gdb/amd64-tdep.c | |
parent | dd80ea3c315b22e0751f62d7049969903d9c95ec (diff) | |
download | gdb-fff4548bff0958dd77ee051e6b322f1c884896c9.zip gdb-fff4548bff0958dd77ee051e6b322f1c884896c9.tar.gz gdb-fff4548bff0958dd77ee051e6b322f1c884896c9.tar.bz2 |
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.
Diffstat (limited to 'gdb/amd64-tdep.c')
-rw-r--r-- | gdb/amd64-tdep.c | 40 |
1 files changed, 39 insertions, 1 deletions
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); |