2009-09-05 Hui Zhu <teawater@gmail.com>

* i386-tdep.c (i386_record_s): Add orig_addr.
	(i386_record_check_override): New function.
	(i386_record_lea_modrm): Call i386_record_check_override.
	(i386_process_record): Ditto.
This commit is contained in:
Hui Zhu 2009-09-05 15:37:02 +00:00
parent f8739b83b9
commit df61f520ce
2 changed files with 66 additions and 44 deletions

View File

@ -1,3 +1,10 @@
2009-09-05 Hui Zhu <teawater@gmail.com>
* i386-tdep.c (i386_record_s): Add orig_addr.
(i386_record_check_override): New function.
(i386_record_lea_modrm): Call i386_record_check_override.
(i386_process_record): Ditto.
2009-09-03 Nathan Froyd <froydnj@codesourcery.com> 2009-09-03 Nathan Froyd <froydnj@codesourcery.com>
* dwarf2loc.c (struct piece_closure): New. * dwarf2loc.c (struct piece_closure): New.

View File

@ -2867,6 +2867,7 @@ struct i386_record_s
{ {
struct gdbarch *gdbarch; struct gdbarch *gdbarch;
struct regcache *regcache; struct regcache *regcache;
CORE_ADDR orig_addr;
CORE_ADDR addr; CORE_ADDR addr;
int aflag; int aflag;
int dflag; int dflag;
@ -3147,6 +3148,26 @@ no_rm:
return 0; return 0;
} }
static int
i386_record_check_override (struct i386_record_s *irp)
{
if (irp->override >= 0 && irp->override != X86_RECORD_DS_REGNUM)
{
ULONGEST orv, ds;
regcache_raw_read_unsigned (irp->regcache,
irp->regmap[irp->override],
&orv);
regcache_raw_read_unsigned (irp->regcache,
irp->regmap[X86_RECORD_DS_REGNUM],
&ds);
if (orv != ds)
return 1;
}
return 0;
}
/* Record the value of the memory that willbe changed in current instruction /* Record the value of the memory that willbe changed in current instruction
to "record_arch_list". to "record_arch_list".
Return -1 if something wrong. */ Return -1 if something wrong. */
@ -3157,13 +3178,12 @@ i386_record_lea_modrm (struct i386_record_s *irp)
struct gdbarch *gdbarch = irp->gdbarch; struct gdbarch *gdbarch = irp->gdbarch;
uint64_t addr; uint64_t addr;
if (irp->override >= 0) if (i386_record_check_override (irp))
{ {
if (record_debug) warning (_("Process record ignores the memory change "
printf_unfiltered (_("Process record ignores the memory change " "of instruction at address %s because it "
"of instruction at address %s because it " "can't get the value of the segment register."),
"can't get the value of the segment register.\n"), paddress (gdbarch, irp->orig_addr));
paddress (gdbarch, irp->addr));
return 0; return 0;
} }
@ -3221,6 +3241,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
memset (&ir, 0, sizeof (struct i386_record_s)); memset (&ir, 0, sizeof (struct i386_record_s));
ir.regcache = regcache; ir.regcache = regcache;
ir.addr = addr; ir.addr = addr;
ir.orig_addr = addr;
ir.aflag = 1; ir.aflag = 1;
ir.dflag = 1; ir.dflag = 1;
ir.override = -1; ir.override = -1;
@ -4039,14 +4060,13 @@ reswitch:
/* mov EAX */ /* mov EAX */
case 0xa2: case 0xa2:
case 0xa3: case 0xa3:
if (ir.override >= 0) if (i386_record_check_override (&ir))
{ {
if (record_debug) warning (_("Process record ignores the memory change "
printf_unfiltered (_("Process record ignores the memory change " "of instruction at address 0x%s because "
"of instruction at address 0x%s because " "it can't get the value of the segment "
"it can't get the value of the segment " "register."),
"register.\n"), paddress (gdbarch, ir.orig_addr));
paddress (gdbarch, ir.addr));
} }
else else
{ {
@ -4458,27 +4478,24 @@ reswitch:
ir.regmap[X86_RECORD_REDI_REGNUM], ir.regmap[X86_RECORD_REDI_REGNUM],
&tmpulongest); &tmpulongest);
regcache_raw_read_unsigned (ir.regcache, ir.override = X86_RECORD_ES_REGNUM;
ir.regmap[X86_RECORD_ES_REGNUM], if (ir.aflag && i386_record_check_override (&ir))
&es);
regcache_raw_read_unsigned (ir.regcache,
ir.regmap[X86_RECORD_DS_REGNUM],
&ds);
if (ir.aflag && (es != ds))
{ {
/* addr += ((uint32_t) read_register (I386_ES_REGNUM)) << 4; */ /* addr += ((uint32_t) read_register (I386_ES_REGNUM)) << 4; */
if (record_debug) warning (_("Process record ignores the memory "
printf_unfiltered (_("Process record ignores the memory " "change of instruction at address 0x%s "
"change of instruction at address 0x%s " "because it can't get the value of the "
"because it can't get the value of the " "ES segment register."),
"ES segment register.\n"), paddress (gdbarch, ir.orig_addr));
paddress (gdbarch, ir.addr)); }
else
{
if (record_arch_list_add_mem (tmpulongest, 1 << ir.ot))
return -1;
} }
if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ)) if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ))
I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM); I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM);
if (record_arch_list_add_mem (tmpulongest, 1 << ir.ot))
return -1;
if (opcode == 0xa4 || opcode == 0xa5) if (opcode == 0xa4 || opcode == 0xa5)
I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_RESI_REGNUM); I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_RESI_REGNUM);
I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_REDI_REGNUM); I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_REDI_REGNUM);
@ -5086,15 +5103,14 @@ reswitch:
opcode = opcode << 8 | ir.modrm; opcode = opcode << 8 | ir.modrm;
goto no_support; goto no_support;
} }
if (ir.override >= 0) if (i386_record_check_override (&ir))
{ {
if (record_debug) warning (_("Process record ignores the memory "
printf_unfiltered (_("Process record ignores the memory " "change of instruction at "
"change of instruction at " "address %s because it can't get "
"address %s because it can't get " "the value of the segment "
"the value of the segment " "register."),
"register.\n"), paddress (gdbarch, ir.orig_addr));
paddress (gdbarch, ir.addr));
} }
else else
{ {
@ -5138,15 +5154,14 @@ reswitch:
else else
{ {
/* sidt */ /* sidt */
if (ir.override >= 0) if (i386_record_check_override (&ir))
{ {
if (record_debug) warning (_("Process record ignores the memory "
printf_unfiltered (_("Process record ignores the memory " "change of instruction at "
"change of instruction at " "address %s because it can't get "
"address %s because it can't get " "the value of the segment "
"the value of the segment " "register."),
"register.\n"), paddress (gdbarch, ir.orig_addr));
paddress (gdbarch, ir.addr));
} }
else else
{ {