2009-08-10 Hui Zhu <teawater@gmail.com>

Add AMD64 process record instruction set support.

	* i386-tdep.h (gdbarch_tdep): Add record_regmap for registers
	because the AMD64's registers order in GDB is not same with
	I386 instructions.
	Add i386_syscall_record to be the syscall function handle
	interface.
	(record_i386_regnum): Number for record_regmap.
	* i386-tdep.c (OT_QUAD): For 64 bits.
	(i386_record_s): Add rex_x, rex_b, rip_offset and
	popl_esp_hack for AMD64 instruction set. And regmap for
	record_regmap.
	(i386_record_lea_modrm_addr): Support AMD64 instruction set
	64 bits lea.
	(i386_record_lea_modrm): Ditto.
	(i386_record_push): New function.  Record the execution log
	of push.
	(I386_RECORD_ARCH_LIST_ADD_REG): New macro to record the
	register.
	(i386_process_record): Support AMD64 instruction set.
	* amd64-tdep.c (amd64_record_regmap): For record_regmap.
	(amd64_init_abi): Set amd64_record_regmap to record_regmap.
This commit is contained in:
Hui Zhu 2009-08-10 03:02:39 +00:00
parent b9f7d72d24
commit cf648174b0
4 changed files with 881 additions and 682 deletions

View File

@ -1,3 +1,28 @@
2009-08-10 Hui Zhu <teawater@gmail.com>
Add AMD64 process record instruction set support.
* i386-tdep.h (gdbarch_tdep): Add record_regmap for registers
because the AMD64's registers order in GDB is not same with
I386 instructions.
Add i386_syscall_record to be the syscall function handle
interface.
(record_i386_regnum): Number for record_regmap.
* i386-tdep.c (OT_QUAD): For 64 bits.
(i386_record_s): Add rex_x, rex_b, rip_offset and
popl_esp_hack for AMD64 instruction set. And regmap for
record_regmap.
(i386_record_lea_modrm_addr): Support AMD64 instruction set
64 bits lea.
(i386_record_lea_modrm): Ditto.
(i386_record_push): New function. Record the execution log
of push.
(I386_RECORD_ARCH_LIST_ADD_REG): New macro to record the
register.
(i386_process_record): Support AMD64 instruction set.
* amd64-tdep.c (amd64_record_regmap): For record_regmap.
(amd64_init_abi): Set amd64_record_regmap to record_regmap.
2009-08-08 Pedro Alves <pedro@codesourcery.com>
* bfd-target.c (struct target_bfd_data): New.

View File

@ -1989,6 +1989,16 @@ amd64_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
return 1;
}
static const int amd64_record_regmap[] =
{
AMD64_RAX_REGNUM, AMD64_RCX_REGNUM, AMD64_RDX_REGNUM, AMD64_RBX_REGNUM,
AMD64_RSP_REGNUM, AMD64_RBP_REGNUM, AMD64_RSI_REGNUM, AMD64_RDI_REGNUM,
AMD64_R8_REGNUM, AMD64_R9_REGNUM, AMD64_R10_REGNUM, AMD64_R11_REGNUM,
AMD64_R12_REGNUM, AMD64_R13_REGNUM, AMD64_R14_REGNUM, AMD64_R15_REGNUM,
AMD64_RIP_REGNUM, AMD64_EFLAGS_REGNUM, AMD64_CS_REGNUM, AMD64_SS_REGNUM,
AMD64_DS_REGNUM, AMD64_ES_REGNUM, AMD64_FS_REGNUM, AMD64_GS_REGNUM
};
void
amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
@ -2051,6 +2061,8 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_num_pseudo_regs (gdbarch, 0);
tdep->mm0_regnum = -1;
tdep->record_regmap = amd64_record_regmap;
set_gdbarch_dummy_id (gdbarch, amd64_dummy_id);
frame_unwind_append_unwinder (gdbarch, &amd64_sigtramp_frame_unwind);

File diff suppressed because it is too large Load Diff

View File

@ -111,10 +111,15 @@ struct gdbarch_tdep
struct type *i387_ext_type;
/* Process record/replay target. */
/* The map for registers because the AMD64's registers order
in GDB is not same as I386 instructions. */
const int *record_regmap;
/* Parse intx80 args. */
int (*i386_intx80_record) (struct regcache *regcache);
/* Parse sysenter args. */
int (*i386_sysenter_record) (struct regcache *regcache);
/* Parse syscall args. */
int (*i386_syscall_record) (struct regcache *regcache);
};
/* Floating-point registers. */
@ -151,6 +156,36 @@ enum i386_regnum
I386_ST0_REGNUM /* %st(0) */
};
/* Register numbers of RECORD_REGMAP. */
enum record_i386_regnum
{
X86_RECORD_REAX_REGNUM,
X86_RECORD_RECX_REGNUM,
X86_RECORD_REDX_REGNUM,
X86_RECORD_REBX_REGNUM,
X86_RECORD_RESP_REGNUM,
X86_RECORD_REBP_REGNUM,
X86_RECORD_RESI_REGNUM,
X86_RECORD_REDI_REGNUM,
X86_RECORD_R8_REGNUM,
X86_RECORD_R9_REGNUM,
X86_RECORD_R10_REGNUM,
X86_RECORD_R11_REGNUM,
X86_RECORD_R12_REGNUM,
X86_RECORD_R13_REGNUM,
X86_RECORD_R14_REGNUM,
X86_RECORD_R15_REGNUM,
X86_RECORD_REIP_REGNUM,
X86_RECORD_EFLAGS_REGNUM,
X86_RECORD_CS_REGNUM,
X86_RECORD_SS_REGNUM,
X86_RECORD_DS_REGNUM,
X86_RECORD_ES_REGNUM,
X86_RECORD_FS_REGNUM,
X86_RECORD_GS_REGNUM,
};
#define I386_NUM_GREGS 16
#define I386_NUM_FREGS 16
#define I386_NUM_XREGS 9