Skip to content

Commit

Permalink
i#2144: setting exit reason the same way
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe Antoine committed May 10, 2017
1 parent 892513a commit 9a1826e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion core/arch/arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ mangle_interrupt(dcontext_t *dcontext, instrlist_t *ilist, instr_t *instr,
void
mangle_possible_single_step(dcontext_t *dcontext, instrlist_t *ilist, instr_t *instr);
void
mangle_single_step(dcontext_t *dcontext, instrlist_t *ilist, instr_t *instr);
mangle_single_step(dcontext_t *dcontext, instrlist_t *ilist, uint flags, instr_t *instr);

#endif
instr_t *
Expand Down
2 changes: 1 addition & 1 deletion core/arch/mangle_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ mangle(dcontext_t *dcontext, instrlist_t *ilist, uint *flags INOUT,
}
else if (dcontext->single_step_addr != NULL &&
dcontext->single_step_addr == instr->translation) {
mangle_single_step(dcontext, ilist, instr);
mangle_single_step(dcontext, ilist, *flags, instr);
/* Resets to generate single step exception only once. */
dcontext->single_step_addr = NULL;
}
Expand Down
24 changes: 16 additions & 8 deletions core/arch/x86/mangle.c
Original file line number Diff line number Diff line change
Expand Up @@ -2415,16 +2415,24 @@ mangle_possible_single_step(dcontext_t *dcontext, instrlist_t *ilist,
* Single step exceptions generation
*/
void
mangle_single_step(dcontext_t *dcontext, instrlist_t *ilist, instr_t *instr)
mangle_single_step(dcontext_t *dcontext, instrlist_t *ilist, uint flags,
instr_t *instr)
{
/* Sets exit reason dynamically. */
insert_shared_get_dcontext(dcontext, ilist, instr, true/*save_xdi*/);
PRE(ilist, instr, INSTR_CREATE_mov_st
(dcontext,
opnd_create_dcontext_field_via_reg_sz(dcontext, REG_NULL/*default*/,
EXIT_REASON_OFFSET, OPSZ_2),
OPND_CREATE_INT16(EXIT_REASON_SINGLE_STEP)));
insert_shared_restore_dcontext_reg(dcontext, ilist, instr);
if (DYNAMO_OPTION(private_ib_in_tls) || TEST(FRAG_SHARED, flags)) {
insert_shared_get_dcontext(dcontext, ilist, instr, true/*save_xdi*/);
PRE(ilist, instr, INSTR_CREATE_mov_st
(dcontext,
opnd_create_dcontext_field_via_reg_sz(dcontext, REG_NULL/*default*/,
EXIT_REASON_OFFSET, OPSZ_2),
OPND_CREATE_INT16(EXIT_REASON_SINGLE_STEP)));
insert_shared_restore_dcontext_reg(dcontext, ilist, instr);
} else {
PRE(ilist, instr,
instr_create_save_immed16_to_dcontext(dcontext,
EXIT_REASON_SINGLE_STEP,
EXIT_REASON_OFFSET));
}
}

/***************************************************************************
Expand Down

0 comments on commit 9a1826e

Please sign in to comment.