Skip to content

Commit c2f6575

Browse files
committed
More responsive cancellation when processing the entire binary
1 parent c117093 commit c2f6575

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

library.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ extern "C"
9797
size_t instructionCount = mlil->GetInstructionCount();
9898

9999
for (size_t i = 0; i < instructionCount; ++i) {
100+
if (i % 100 == 0 && task->IsCancelled()) {
101+
break;
102+
}
103+
100104
auto instr = mlil->GetInstruction(i);
101105
if (instr.operation != MLIL_IF)
102106
continue;
@@ -185,6 +189,10 @@ extern "C"
185189
std::vector<PatchInfo> pendingPatches;
186190

187191
for (size_t i = 0; i < mlil->GetInstructionCount(); ++i) {
192+
if (i % 100 == 0 && shouldCancel.load()) {
193+
break;
194+
}
195+
188196
auto instr = mlil->GetInstruction(i);
189197
if (instr.operation != MLIL_IF)
190198
continue;
@@ -204,6 +212,10 @@ extern "C"
204212
}
205213
}
206214

215+
if (shouldCancel.load()) {
216+
break;
217+
}
218+
207219
if (pendingPatches.empty())
208220
break;
209221

0 commit comments

Comments
 (0)