Skip to content

Commit d2e79eb

Browse files
committed
Also send checkpoints when stepping or pausing in trace mode
This works better for debuggers such as MIO which expect information about the current program counter/program state while stepping.
1 parent 7e84681 commit d2e79eb

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

src/Debug/debugger.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,16 @@ void Debugger::handleSnapshotPolicy(Module *m) {
10241024
this->channel->write("\n");
10251025
} else if (snapshotPolicy == SnapshotPolicy::checkpointing) {
10261026
if (instructions_executed >= checkpointInterval || fidx_called) {
1027-
checkpoint(m);
1027+
if (min_return_values == 0) {
1028+
checkpoint(m);
1029+
} else {
1030+
if (fidx_called) {
1031+
const Type* type = m->functions[*fidx_called].type;
1032+
if (type->result_count >= min_return_values) {
1033+
checkpoint(m);
1034+
}
1035+
}
1036+
}
10281037
}
10291038
instructions_executed++;
10301039

@@ -1046,19 +1055,6 @@ void Debugger::checkpoint(Module *m, const bool force) {
10461055
return;
10471056
}
10481057

1049-
if (min_return_values != 0) {
1050-
if (!fidx_called) {
1051-
// Tracing mode is on, but no primitive was called.
1052-
return;
1053-
}
1054-
1055-
const Type *type = m->functions[*fidx_called].type;
1056-
if (type->result_count < min_return_values) {
1057-
// Primitive was called but did not have the required return values.
1058-
return;
1059-
}
1060-
}
1061-
10621058
this->channel->write(R"(CHECKPOINT {"instructions_executed": %d, )",
10631059
instructions_executed);
10641060
if (fidx_called) {

0 commit comments

Comments
 (0)