Skip to content

Commit

Permalink
fix issue with it deleting the call when it was not running the tracer
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfl committed Aug 26, 2016
1 parent c11a7aa commit 6ee2f04
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -717,20 +717,22 @@ void* Manager::fellthrough_branch(void *id, void *ret_addr) {
}
}

if(head->is_traced) {
if(head->tracer) {
// there is a fallthrough without a backwards branch which means that we never
// got to the backwards branch portion of this loop
assert(!head->is_compiled);
assert(head->tracer);
// assert(!head->is_compiled);
// assert(head->tracer);
if(head->frame_id == branchable_frame_id) {
return head->tracer->CheckNotSelfFellthrough();
} else {
// if this is at a different level in the branchable frame then it can't possible be the same instance
// and the check self will only check the id not the branchable depth
return head->tracer->DeleteLastCall();
return head->tracer->DeleteLastCall((void*)&redmagic_fellthrough_branch);
}
}

assert(!head->is_compiled || head->frame_id != branchable_frame_id);

return NULL;

}
Expand Down
6 changes: 5 additions & 1 deletion src/tracer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -928,8 +928,12 @@ mem_loc_t Tracer::merge_close_core() {
assert(0);
}

namespace { void _nonamef() {} }

void* Tracer::DeleteLastCall() {
void* Tracer::DeleteLastCall(void *method) {
if((mem_loc_t)method != current_not_traced_call_addr)
return NULL; // this is some other method so just ignore this action
assert((current_not_traced_call_addr & ~0xffffffffL) == (((mem_loc_t)&_nonamef) & ~0xffffffffL));
assert(icount - last_call_instruction < 2);
buffer->setOffset(last_call_generated_op);
mem_loc_t ret = buffer->getRawBuffer() + buffer->getOffset();
Expand Down
2 changes: 1 addition & 1 deletion src/tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace redmagic {
// end the current merge block
void* EndMergeBlock();

void* DeleteLastCall();
void* DeleteLastCall(void *method);

void set_merge_target(mem_loc_t target) {
assert(merge_resume == 0);
Expand Down

0 comments on commit 6ee2f04

Please sign in to comment.