[RFA 1/5] Prec: x86 segment register support: interface
Hui Zhu
teawater@gmail.com
Tue Mar 16 16:55:00 GMT 2010
This patch add the interface i386_segment_base to get the segment base
from the OS.
Thanks,
Hui
2010-03-16 Hui Zhu <teawater@gmail.com>
* i386-tdep.c (i386_record_s): Add tdep.
(i386_record_addseg): New function.
(i386_record_lea_modrm_addr): Change addr from uint64_t
to ULONGEST.
Call i386_record_addseg.
(i386_record_lea_modrm): Remove irp->override check.
Change addr from uint64_t to ULONGEST.
(i386_record_floats): Change tdep to irp->tdep.
(i386_process_record): Call i386_record_addseg.
* i386-tdep.h (gdbarch_tdep): Add i386_segment_base.
-------------- next part --------------
---
i386-tdep.c | 416 +++++++++++++++++++++++++++++++-----------------------------
i386-tdep.h | 3
2 files changed, 224 insertions(+), 195 deletions(-)
--- a/i386-tdep.c
+++ b/i386-tdep.c
@@ -2901,6 +2901,7 @@ struct i386_record_s
{
struct gdbarch *gdbarch;
struct regcache *regcache;
+ struct gdbarch_tdep *tdep;
CORE_ADDR orig_addr;
CORE_ADDR addr;
int aflag;
@@ -2940,22 +2941,55 @@ i386_record_modrm (struct i386_record_s
return 0;
}
+/* Add the base of segment register to *ADDR.
+ Return -1 if something wrong. */
+
+static int
+i386_record_addseg (struct i386_record_s *irp, int override, ULONGEST *addr)
+{
+ if (override >= 0)
+ {
+ ULONGEST segment;
+
+ if (irp->tdep->i386_segment_base
+ && irp->tdep->i386_segment_base (irp->regcache,
+ irp->regmap[override],
+ &segment) == 0)
+ {
+ if (irp->aflag == 2)
+ *addr += segment;
+ else
+ *addr = (uint32_t)(*addr + segment);
+ }
+ else
+ {
+ if (record_debug)
+ printf_unfiltered (_("Process record: stop because "
+ "it can't get the value of the "
+ "segment register.\n"));
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
/* Get the memory address that current instruction write to and set it to
the argument "addr".
Return -1 if something wrong. */
static int
-i386_record_lea_modrm_addr (struct i386_record_s *irp, uint64_t *addr)
+i386_record_lea_modrm_addr (struct i386_record_s *irp, ULONGEST *addr)
{
- struct gdbarch *gdbarch = irp->gdbarch;
- enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (irp->gdbarch);
gdb_byte buf[4];
ULONGEST offset64;
+ int override = irp->override;
*addr = 0;
if (irp->aflag)
{
- /* 32 bits */
+ /* 32 bits and 64 bits */
int havesib = 0;
uint8_t scale = 0;
uint8_t byte;
@@ -2970,7 +3004,7 @@ i386_record_lea_modrm_addr (struct i386_
if (record_debug)
printf_unfiltered (_("Process record: error reading memory "
"at addr %s len = 1.\n"),
- paddress (gdbarch, irp->addr));
+ paddress (irp->gdbarch, irp->addr));
return -1;
}
irp->addr++;
@@ -2991,7 +3025,7 @@ i386_record_lea_modrm_addr (struct i386_
if (record_debug)
printf_unfiltered (_("Process record: error reading "
"memory at addr %s len = 4.\n"),
- paddress (gdbarch, irp->addr));
+ paddress (irp->gdbarch, irp->addr));
return -1;
}
irp->addr += 4;
@@ -3010,7 +3044,7 @@ i386_record_lea_modrm_addr (struct i386_
if (record_debug)
printf_unfiltered (_("Process record: error reading memory "
"at addr %s len = 1.\n"),
- paddress (gdbarch, irp->addr));
+ paddress (irp->gdbarch, irp->addr));
return -1;
}
irp->addr++;
@@ -3022,7 +3056,7 @@ i386_record_lea_modrm_addr (struct i386_
if (record_debug)
printf_unfiltered (_("Process record: error reading memory "
"at addr %s len = 4.\n"),
- paddress (gdbarch, irp->addr));
+ paddress (irp->gdbarch, irp->addr));
return -1;
}
*addr = extract_signed_integer (buf, 4, byte_order);
@@ -3054,6 +3088,16 @@ i386_record_lea_modrm_addr (struct i386_
else
*addr = (uint32_t) (*addr + (offset64 << scale));
}
+
+ if (override < 0 && irp->tdep->i386_segment_base)
+ {
+ if (irp->regmap[base] == X86_RECORD_REBP_REGNUM
+ || irp->regmap[base] == X86_RECORD_RESP_REGNUM)
+ override = X86_RECORD_SS_REGNUM;
+ else
+ override = X86_RECORD_DS_REGNUM;
+ }
+ i386_record_addseg (irp, override, addr);
}
else
{
@@ -3068,7 +3112,7 @@ i386_record_lea_modrm_addr (struct i386_
if (record_debug)
printf_unfiltered (_("Process record: error reading "
"memory at addr %s len = 2.\n"),
- paddress (gdbarch, irp->addr));
+ paddress (irp->gdbarch, irp->addr));
return -1;
}
irp->addr += 2;
@@ -3077,9 +3121,7 @@ i386_record_lea_modrm_addr (struct i386_
goto no_rm;
}
else
- {
- *addr = 0;
- }
+ *addr = 0;
break;
case 1:
if (target_read_memory (irp->addr, buf, 1))
@@ -3087,7 +3129,7 @@ i386_record_lea_modrm_addr (struct i386_
if (record_debug)
printf_unfiltered (_("Process record: error reading memory "
"at addr %s len = 1.\n"),
- paddress (gdbarch, irp->addr));
+ paddress (irp->gdbarch, irp->addr));
return -1;
}
irp->addr++;
@@ -3099,7 +3141,7 @@ i386_record_lea_modrm_addr (struct i386_
if (record_debug)
printf_unfiltered (_("Process record: error reading memory "
"at addr %s len = 2.\n"),
- paddress (gdbarch, irp->addr));
+ paddress (irp->gdbarch, irp->addr));
return -1;
}
irp->addr += 2;
@@ -3175,9 +3217,18 @@ i386_record_lea_modrm_addr (struct i386_
break;
}
*addr &= 0xffff;
- }
no_rm:
+ if (override < 0 && irp->tdep->i386_segment_base)
+ {
+ if (irp->rm == 2 || irp->rm == 3 || irp->rm == 6)
+ override = X86_RECORD_SS_REGNUM;
+ else
+ override = X86_RECORD_DS_REGNUM;
+ }
+ i386_record_addseg (irp, override, addr);
+ }
+
return 0;
}
@@ -3188,17 +3239,7 @@ i386_record_lea_modrm_addr (struct i386_
static int
i386_record_lea_modrm (struct i386_record_s *irp)
{
- struct gdbarch *gdbarch = irp->gdbarch;
- uint64_t addr;
-
- if (irp->override >= 0)
- {
- warning (_("Process record ignores the memory change "
- "of instruction at address %s because it "
- "can't get the value of the segment register."),
- paddress (gdbarch, irp->orig_addr));
- return 0;
- }
+ ULONGEST addr;
if (i386_record_lea_modrm_addr (irp, &addr))
return -1;
@@ -3229,7 +3270,6 @@ i386_record_push (struct i386_record_s *
return 0;
}
-
/* Defines contents to record. */
#define I386_SAVE_FPU_REGS 0xfffd
#define I386_SAVE_FPU_ENV 0xfffe
@@ -3240,10 +3280,9 @@ i386_record_push (struct i386_record_s *
*/
static int i386_record_floats (struct gdbarch *gdbarch,
- struct i386_record_s *ir,
+ struct i386_record_s *irp,
uint32_t iregnum)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int i;
/* Oza: Because of floating point insn push/pop of fpu stack is going to
@@ -3253,32 +3292,35 @@ static int i386_record_floats (struct gd
if (I386_SAVE_FPU_REGS == iregnum)
{
- for (i = I387_ST0_REGNUM (tdep); i <= I387_ST0_REGNUM (tdep) + 7; i++)
+ for (i = I387_ST0_REGNUM (irp->tdep);
+ i <= I387_ST0_REGNUM (irp->tdep) + 7; i++)
{
- if (record_arch_list_add_reg (ir->regcache, i))
+ if (record_arch_list_add_reg (irp->regcache, i))
return -1;
}
}
else if (I386_SAVE_FPU_ENV == iregnum)
{
- for (i = I387_FCTRL_REGNUM (tdep); i <= I387_FOP_REGNUM (tdep); i++)
- {
- if (record_arch_list_add_reg (ir->regcache, i))
- return -1;
- }
+ for (i = I387_FCTRL_REGNUM (irp->tdep);
+ i <= I387_FOP_REGNUM (irp->tdep); i++)
+ {
+ if (record_arch_list_add_reg (irp->regcache, i))
+ return -1;
+ }
}
else if (I386_SAVE_FPU_ENV_REG_STACK == iregnum)
{
- for (i = I387_ST0_REGNUM (tdep); i <= I387_FOP_REGNUM (tdep); i++)
- {
- if (record_arch_list_add_reg (ir->regcache, i))
- return -1;
- }
+ for (i = I387_ST0_REGNUM (irp->tdep);
+ i <= I387_FOP_REGNUM (irp->tdep); i++)
+ {
+ if (record_arch_list_add_reg (irp->regcache, i))
+ return -1;
+ }
}
- else if ((iregnum >= I387_ST0_REGNUM (tdep)) &&
- (iregnum <= I387_FOP_REGNUM (tdep)))
+ else if ((iregnum >= I387_ST0_REGNUM (irp->tdep))
+ && (iregnum <= I387_FOP_REGNUM (irp->tdep)))
{
- if (record_arch_list_add_reg (ir->regcache,iregnum))
+ if (record_arch_list_add_reg (irp->regcache,iregnum))
return -1;
}
else
@@ -3288,12 +3330,14 @@ static int i386_record_floats (struct gd
}
if(I386_SAVE_FPU_ENV != iregnum)
{
- for (i = I387_FCTRL_REGNUM (tdep); i <= I387_FOP_REGNUM (tdep); i++)
- {
- if (record_arch_list_add_reg (ir->regcache, i))
- return -1;
- }
+ for (i = I387_FCTRL_REGNUM (irp->tdep);
+ i <= I387_FOP_REGNUM (irp->tdep); i++)
+ {
+ if (record_arch_list_add_reg (irp->regcache, i))
+ return -1;
+ }
}
+
return 0;
}
@@ -3316,7 +3360,6 @@ i386_process_record (struct gdbarch *gdb
ULONGEST addr;
gdb_byte buf[MAX_REGISTER_SIZE];
struct i386_record_s ir;
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int rex = 0;
uint8_t rex_w = -1;
uint8_t rex_r = 0;
@@ -3331,6 +3374,7 @@ i386_process_record (struct gdbarch *gdb
ir.popl_esp_hack = 0;
ir.regmap = gdbarch_tdep (gdbarch)->record_regmap;
ir.gdbarch = gdbarch;
+ ir.tdep = gdbarch_tdep (gdbarch);
if (record_debug > 1)
fprintf_unfiltered (gdb_stdlog, "Process record: i386_process_record "
@@ -4085,62 +4129,56 @@ i386_process_record (struct gdbarch *gdb
case 0xa2: /* mov EAX */
case 0xa3:
- if (ir.override >= 0)
- {
- warning (_("Process record ignores the memory change "
- "of instruction at address %s because "
- "it can't get the value of the segment "
- "register."),
- paddress (gdbarch, ir.orig_addr));
- }
- else
- {
- if ((opcode & 1) == 0)
- ir.ot = OT_BYTE;
- else
- ir.ot = ir.dflag + OT_WORD;
- if (ir.aflag == 2)
- {
- if (target_read_memory (ir.addr, buf, 8))
- {
- if (record_debug)
- printf_unfiltered (_("Process record: error reading "
- "memory at addr 0x%s len = 8.\n"),
- paddress (gdbarch, ir.addr));
- return -1;
- }
- ir.addr += 8;
- addr = extract_unsigned_integer (buf, 8, byte_order);
- }
- else if (ir.aflag)
- {
- if (target_read_memory (ir.addr, buf, 4))
- {
- if (record_debug)
- printf_unfiltered (_("Process record: error reading "
- "memory at addr 0x%s len = 4.\n"),
- paddress (gdbarch, ir.addr));
- return -1;
- }
- ir.addr += 4;
- addr = extract_unsigned_integer (buf, 4, byte_order);
- }
- else
- {
- if (target_read_memory (ir.addr, buf, 2))
- {
- if (record_debug)
- printf_unfiltered (_("Process record: error reading "
- "memory at addr 0x%s len = 2.\n"),
- paddress (gdbarch, ir.addr));
- return -1;
- }
- ir.addr += 2;
- addr = extract_unsigned_integer (buf, 2, byte_order);
- }
- if (record_arch_list_add_mem (addr, 1 << ir.ot))
- return -1;
- }
+ if ((opcode & 1) == 0)
+ ir.ot = OT_BYTE;
+ else
+ ir.ot = ir.dflag + OT_WORD;
+ if (ir.aflag == 2)
+ {
+ if (target_read_memory (ir.addr, buf, 8))
+ {
+ if (record_debug)
+ printf_unfiltered (_("Process record: error reading "
+ "memory at addr 0x%s len = 8.\n"),
+ paddress (gdbarch, ir.addr));
+ return -1;
+ }
+ ir.addr += 8;
+ addr = extract_unsigned_integer (buf, 8, byte_order);
+ }
+ else if (ir.aflag)
+ {
+ if (target_read_memory (ir.addr, buf, 4))
+ {
+ if (record_debug)
+ printf_unfiltered (_("Process record: error reading "
+ "memory at addr 0x%s len = 4.\n"),
+ paddress (gdbarch, ir.addr));
+ return -1;
+ }
+ ir.addr += 4;
+ addr = extract_unsigned_integer (buf, 4, byte_order);
+ }
+ else
+ {
+ if (target_read_memory (ir.addr, buf, 2))
+ {
+ if (record_debug)
+ printf_unfiltered (_("Process record: error reading "
+ "memory at addr 0x%s len = 2.\n"),
+ paddress (gdbarch, ir.addr));
+ return -1;
+ }
+ ir.addr += 2;
+ addr = extract_unsigned_integer (buf, 2, byte_order);
+ }
+
+ if (ir.override < 0 && ir.tdep->i386_segment_base)
+ ir.override = X86_RECORD_DS_REGNUM;
+ i386_record_addseg (&ir, ir.override, &addr);
+
+ if (record_arch_list_add_mem (addr, 1 << ir.ot))
+ return -1;
break;
case 0xb0: /* mov R, Ib */
@@ -4354,7 +4392,7 @@ i386_process_record (struct gdbarch *gdb
/* For fadd, fmul, fsub, fsubr, fdiv, fdivr, fiadd, fimul,
fisub, fisubr, fidiv, fidivr, modR/M.reg is an extension
of code, always affects st(0) register. */
- if (i386_record_floats (gdbarch, &ir, I387_ST0_REGNUM (tdep)))
+ if (i386_record_floats (gdbarch, &ir, I387_ST0_REGNUM (ir.tdep)))
return -1;
break;
case 0x08:
@@ -4464,7 +4502,7 @@ i386_process_record (struct gdbarch *gdb
break;
case 0x0d:
/* Insn fldcw. */
- if (i386_record_floats (gdbarch, &ir, I387_FCTRL_REGNUM (tdep)))
+ if (i386_record_floats (gdbarch, &ir, I387_FCTRL_REGNUM (ir.tdep)))
return -1;
break;
case 0x2c:
@@ -4538,7 +4576,7 @@ i386_process_record (struct gdbarch *gdb
switch (opcode)
{
case 0xd8:
- if (i386_record_floats (gdbarch, &ir, I387_ST0_REGNUM (tdep)))
+ if (i386_record_floats (gdbarch, &ir, I387_ST0_REGNUM (ir.tdep)))
return -1;
break;
case 0xd9:
@@ -4553,14 +4591,14 @@ i386_process_record (struct gdbarch *gdb
else
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep)))
+ I387_ST0_REGNUM (ir.tdep)))
return -1;
/* If only st(0) is changing, then we have already
recorded. */
if ((ir.modrm & 0x0f) - 0x08)
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep) +
+ I387_ST0_REGNUM (ir.tdep) +
((ir.modrm & 0x0f) - 0x08)))
return -1;
}
@@ -4580,7 +4618,7 @@ i386_process_record (struct gdbarch *gdb
case 0xfe:
case 0xff:
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep)))
+ I387_ST0_REGNUM (ir.tdep)))
return -1;
break;
case 0xf1:
@@ -4604,10 +4642,10 @@ i386_process_record (struct gdbarch *gdb
break;
case 0xfd:
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep)))
+ I387_ST0_REGNUM (ir.tdep)))
return -1;
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep) + 1))
+ I387_ST0_REGNUM (ir.tdep) + 1))
return -1;
break;
}
@@ -4622,19 +4660,19 @@ i386_process_record (struct gdbarch *gdb
else if ((0x0c == ir.modrm >> 4) || (0x0d == ir.modrm >> 4))
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep)))
+ I387_ST0_REGNUM (ir.tdep)))
return -1;
if (((ir.modrm & 0x0f) > 0) && ((ir.modrm & 0x0f) <= 7))
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep) +
+ I387_ST0_REGNUM (ir.tdep) +
(ir.modrm & 0x0f)))
return -1;
}
else if ((ir.modrm & 0x0f) - 0x08)
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep) +
+ I387_ST0_REGNUM (ir.tdep) +
((ir.modrm & 0x0f) - 0x08)))
return -1;
}
@@ -4649,19 +4687,19 @@ i386_process_record (struct gdbarch *gdb
else if ((0x0c == ir.modrm >> 4) || (0x0d == ir.modrm >> 4))
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep)))
+ I387_ST0_REGNUM (ir.tdep)))
return -1;
if (((ir.modrm & 0x0f) > 0) && ((ir.modrm & 0x0f) <= 7))
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep) +
+ I387_ST0_REGNUM (ir.tdep) +
(ir.modrm & 0x0f)))
return -1;
}
else if ((ir.modrm & 0x0f) - 0x08)
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep) +
+ I387_ST0_REGNUM (ir.tdep) +
((ir.modrm & 0x0f) - 0x08)))
return -1;
}
@@ -4675,14 +4713,14 @@ i386_process_record (struct gdbarch *gdb
if ((ir.modrm & 0x0f) <= 7)
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep) +
+ I387_ST0_REGNUM (ir.tdep) +
(ir.modrm & 0x0f)))
return -1;
}
else
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep) +
+ I387_ST0_REGNUM (ir.tdep) +
((ir.modrm & 0x0f) - 0x08)))
return -1;
}
@@ -4692,7 +4730,7 @@ i386_process_record (struct gdbarch *gdb
if (0x0c == ir.modrm >> 4)
{
if (i386_record_floats (gdbarch, &ir,
- I387_FTAG_REGNUM (tdep)))
+ I387_FTAG_REGNUM (ir.tdep)))
return -1;
}
else if ((0x0d == ir.modrm >> 4) || (0x0e == ir.modrm >> 4))
@@ -4700,7 +4738,7 @@ i386_process_record (struct gdbarch *gdb
if ((ir.modrm & 0x0f) <= 7)
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep) +
+ I387_ST0_REGNUM (ir.tdep) +
(ir.modrm & 0x0f)))
return -1;
}
@@ -4744,42 +4782,54 @@ i386_process_record (struct gdbarch *gdb
case 0xab:
case 0x6c: /* insS */
case 0x6d:
+ /* Get the count. */
regcache_raw_read_unsigned (ir.regcache,
ir.regmap[X86_RECORD_RECX_REGNUM],
&addr);
if (addr)
{
- ULONGEST es, ds;
-
if ((opcode & 1) == 0)
ir.ot = OT_BYTE;
else
ir.ot = ir.dflag + OT_WORD;
+
regcache_raw_read_unsigned (ir.regcache,
ir.regmap[X86_RECORD_REDI_REGNUM],
&addr);
- regcache_raw_read_unsigned (ir.regcache,
- ir.regmap[X86_RECORD_ES_REGNUM],
- &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; */
- warning (_("Process record ignores the memory "
- "change of instruction at address %s "
- "because it can't get the value of the "
- "ES segment register."),
- paddress (gdbarch, ir.orig_addr));
- }
- else
+ if (ir.aflag != 2)
{
- if (record_arch_list_add_mem (addr, 1 << ir.ot))
- return -1;
+ if (ir.aflag == 0)
+ addr &= 0xffff;
+ if (ir.tdep->i386_segment_base)
+ {
+ i386_record_addseg (&ir, X86_RECORD_ES_REGNUM, &addr);
+ }
+ else
+ {
+ ULONGEST es, ds;
+
+ regcache_raw_read_unsigned (ir.regcache,
+ ir.regmap[X86_RECORD_ES_REGNUM],
+ &es);
+ regcache_raw_read_unsigned (ir.regcache,
+ ir.regmap[X86_RECORD_DS_REGNUM],
+ &ds);
+ if (es != ds)
+ {
+ warning (_("Process record ignores the memory "
+ "change of instruction at address %s "
+ "because it can't get the value of the "
+ "ES segment register."),
+ paddress (gdbarch, ir.orig_addr));
+ goto record_reg;
+ }
+ }
}
+ if (record_arch_list_add_mem (addr, 1 << ir.ot))
+ return -1;
+ record_reg:
if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ))
I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM);
if (opcode == 0xa4 || opcode == 0xa5)
@@ -5325,33 +5375,21 @@ i386_process_record (struct gdbarch *gdb
opcode = opcode << 8 | ir.modrm;
goto no_support;
}
- if (ir.override >= 0)
- {
- warning (_("Process record ignores the memory "
- "change of instruction at "
- "address %s because it can't get "
- "the value of the segment "
- "register."),
- paddress (gdbarch, ir.orig_addr));
- }
- else
- {
- if (i386_record_lea_modrm_addr (&ir, &addr64))
+ if (i386_record_lea_modrm_addr (&ir, &addr64))
+ return -1;
+ if (record_arch_list_add_mem (addr64, 2))
+ return -1;
+ addr64 += 2;
+ if (ir.regmap[X86_RECORD_R8_REGNUM])
+ {
+ if (record_arch_list_add_mem (addr64, 8))
return -1;
- if (record_arch_list_add_mem (addr64, 2))
+ }
+ else
+ {
+ if (record_arch_list_add_mem (addr64, 4))
return -1;
- addr64 += 2;
- if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
- if (record_arch_list_add_mem (addr64, 8))
- return -1;
- }
- else
- {
- if (record_arch_list_add_mem (addr64, 4))
- return -1;
- }
- }
+ }
}
break;
case 1:
@@ -5374,35 +5412,23 @@ i386_process_record (struct gdbarch *gdb
else
{
/* sidt */
- if (ir.override >= 0)
- {
- warning (_("Process record ignores the memory "
- "change of instruction at "
- "address %s because it can't get "
- "the value of the segment "
- "register."),
- paddress (gdbarch, ir.orig_addr));
- }
- else
- {
- uint64_t addr64;
+ uint64_t addr64;
- if (i386_record_lea_modrm_addr (&ir, &addr64))
+ if (i386_record_lea_modrm_addr (&ir, &addr64))
+ return -1;
+ if (record_arch_list_add_mem (addr64, 2))
+ return -1;
+ addr64 += 2;
+ if (ir.regmap[X86_RECORD_R8_REGNUM])
+ {
+ if (record_arch_list_add_mem (addr64, 8))
return -1;
- if (record_arch_list_add_mem (addr64, 2))
+ }
+ else
+ {
+ if (record_arch_list_add_mem (addr64, 4))
return -1;
- addr64 += 2;
- if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
- if (record_arch_list_add_mem (addr64, 8))
- return -1;
- }
- else
- {
- if (record_arch_list_add_mem (addr64, 4))
- return -1;
- }
- }
+ }
}
break;
case 2: /* lgdt */
--- a/i386-tdep.h
+++ b/i386-tdep.h
@@ -194,6 +194,9 @@ struct gdbarch_tdep
int (*i386_sysenter_record) (struct regcache *regcache);
/* Parse syscall args. */
int (*i386_syscall_record) (struct regcache *regcache);
+ /* Get the segment register's base. */
+ int (*i386_segment_base) (struct regcache *regcache, int regnum,
+ ULONGEST *base);
};
/* Floating-point registers. */
More information about the Gdb-patches
mailing list