diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c index 059df5be1..e2bd63b66 100644 --- a/cachegrind/cg_main.c +++ b/cachegrind/cg_main.c @@ -45,7 +45,6 @@ typedef struct { /*--- Constants ---*/ /*------------------------------------------------------------*/ -#define MAX_x86_INSTR_SIZE 16 // According to ia32 sw dev manual vol 2 #define MIN_LINE_SIZE 16 #define FILE_LEN 256 #define FN_LEN 256 @@ -431,8 +430,8 @@ void end_of_x86_instr(UCodeBlock* cb, instr_info* i_node, Bool bb_seen_before, t_data_addr1 = INVALID_TEMPREG, t_data_addr2 = INVALID_TEMPREG; - sk_assert(instr_size >= 1 && - instr_size <= MAX_x86_INSTR_SIZE); + sk_assert(instr_size >= MIN_INSTR_SIZE && + instr_size <= MAX_INSTR_SIZE); #define IS_(X) (INVALID_TEMPREG != t_##X##_addr) #define INV(qqt) (INVALID_TEMPREG == (qqt)) diff --git a/coregrind/vg_errcontext.c b/coregrind/vg_errcontext.c index f61668b7f..ae1c2927d 100644 --- a/coregrind/vg_errcontext.c +++ b/coregrind/vg_errcontext.c @@ -361,7 +361,8 @@ static void gen_suppression(Error* err) i = 0; do { Addr eip = ec->eips[i]; - if (i > 0) eip--; /* point to calling line */ + if (i > 0) + eip -= MIN_INSTR_SIZE; // point to calling line if ( VG_(get_fnname_nodemangle) (eip, buf, M_VG_ERRTXT) ) { // Stop after "main"; if main() is recursive, stop after last main(). diff --git a/coregrind/vg_symtab2.c b/coregrind/vg_symtab2.c index a250d4abb..9df9f8364 100644 --- a/coregrind/vg_symtab2.c +++ b/coregrind/vg_symtab2.c @@ -2226,7 +2226,8 @@ void VG_(mini_stack_dump) ( Addr eips[], UInt n_eips ) i = 0; do { Addr eip = eips[i]; - if (i > 0) eip--; /* point to calling line */ + if (i > 0) + eip -= MIN_INSTR_SIZE; // point to calling line VG_(describe_eip)(eip, buf, M_VG_ERRTXT); if ( ! VG_(clo_show_below_main)) { diff --git a/include/x86/tool_arch.h b/include/x86/tool_arch.h index 2e10c75c3..272e2fa39 100644 --- a/include/x86/tool_arch.h +++ b/include/x86/tool_arch.h @@ -35,7 +35,10 @@ #define FIRST_ARCH_REG R_EAX #define LAST_ARCH_REG R_EDI -#define N_ARCH_REGS 8 +#define N_ARCH_REGS 8 + +#define MIN_INSTR_SIZE 1 +#define MAX_INSTR_SIZE 16 #endif // __X86_TOOL_ARCH_H