if (gotoStmt.getType() == RTLGoto.Type.RETURN) {
postStack = new LinkedList<Location>(callStack);
if (postStack.isEmpty()) {
logger.warn("Return instruction on empty call stack!");
} else {
Location target = postStack.pop();
logger.debug("Call stack: Return to " + target + ". Remaining stack " + postStack);
}
}
// Prologue Call
else if (Program.getProgram().getHarness().contains(stmt.getAddress())) {
postStack = new LinkedList<Location>(callStack);
postStack.push(new Location(Program.getProgram().getHarness().getFallthroughAddress(stmt.getAddress())));
}
// Call
else if (gotoStmt.getType() == RTLGoto.Type.CALL) {
Location returnLabel;
if (instr == null) {
// Happens in import stubs containing a call
logger.info("No instruction at address " + stmt.getLabel());
returnLabel = gotoStmt.getNextLabel();
} else {
returnLabel = new Location(new AbsoluteAddress(addressValue + instr.getSize()));
}
postStack = new LinkedList<Location>();
for (Iterator<Location> iter = callStack.descendingIterator(); iter.hasNext();) {
Location exRetLoc = iter.next();
if (exRetLoc.equals(returnLabel)) {
logger.verbose("Recursion detected in call at " + stmt.getAddress());
break;
} else {
postStack.push(exRetLoc);
}