GT-3511 corrected infinite loop is disassembler caused by branch to self

with nested delay slot failure
This commit is contained in:
ghidra1 2020-01-29 11:30:30 -05:00
parent 0c30c72274
commit e3e56fa29c

View file

@ -79,8 +79,8 @@ class DisassemblerQueue {
currentBranchQueue = new TreeSet<InstructionBlockFlow>(ORDERED_FLOW_COMPARATOR); currentBranchQueue = new TreeSet<InstructionBlockFlow>(ORDERED_FLOW_COMPARATOR);
processedBranchFlows = new HashSet<InstructionBlockFlow>(48); processedBranchFlows = new HashSet<InstructionBlockFlow>(48);
orderedSeedQueue.add(new InstructionBlockFlow(startAddr, null, orderedSeedQueue.add(
InstructionBlockFlow.Type.PRIORITY)); new InstructionBlockFlow(startAddr, null, InstructionBlockFlow.Type.PRIORITY));
} }
/** /**
@ -174,6 +174,9 @@ class DisassemblerQueue {
branchFlow = currentBranchQueue.first(); branchFlow = currentBranchQueue.first();
currentBranchQueue.remove(branchFlow); currentBranchQueue.remove(branchFlow);
} }
if (processedBranchFlows.contains(branchFlow)) {
continue;
}
processedBranchFlows.add(branchFlow); processedBranchFlows.add(branchFlow);
Address blockAddr = branchFlow.getDestinationAddress(); Address blockAddr = branchFlow.getDestinationAddress();
@ -232,8 +235,8 @@ class DisassemblerQueue {
if (flowType != Type.CALL && processedBranchFlows.contains(blockFlow)) { if (flowType != Type.CALL && processedBranchFlows.contains(blockFlow)) {
continue; continue;
} }
if (conflict == null || if (conflict == null || conflict.getInstructionAddress().compareTo(
conflict.getInstructionAddress().compareTo(blockFlow.getFlowFromAddress()) > 0) { blockFlow.getFlowFromAddress()) > 0) {
// Add good flows to priorityBranchSet to ensure that future context is // Add good flows to priorityBranchSet to ensure that future context is
// properly consumed with a guaranteed block start. We don't // properly consumed with a guaranteed block start. We don't
// want block to be dependent upon a parent block // want block to be dependent upon a parent block