Skip to content

Commit

Permalink
Add instructions_executed into a json object
Browse files Browse the repository at this point in the history
  • Loading branch information
MaartenS11 committed Aug 26, 2024
1 parent aa1fe13 commit 3237c15
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Debug/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ bool Debugger::checkDebugMessages(Module *m, RunningState *program_state) {
this->pauseRuntime(m);
free(interruptData);
snapshot(m);
this->channel->write("\n");
break;
case interruptSetSnapshotPolicy:
setSnapshotPolicy(interruptData + 1);
Expand All @@ -273,6 +274,7 @@ bool Debugger::checkDebugMessages(Module *m, RunningState *program_state) {
uint16_t numberBytes = read_B16(&data);
uint8_t *state = interruptData + 3;
inspect(m, numberBytes, state);
this->channel->write("\n");
free(interruptData);
break;
}
Expand Down Expand Up @@ -883,7 +885,7 @@ void Debugger::inspect(Module *m, uint16_t sizeStateArray, uint8_t *state) {
}
}
}
this->channel->write("}\n");
this->channel->write("}");
}

void Debugger::setSnapshotPolicy(const uint8_t *interruptData) {
Expand All @@ -907,8 +909,9 @@ void Debugger::handleSnapshotPolicy(Module *m) {
}

void Debugger::checkpoint(Module *m) {
this->channel->write("CHECKPOINT, {\"instructions_executed\" = %d}, ", instructions_executed);
this->channel->write("CHECKPOINT {\"instructions_executed\": %d, \"snapshot\": ", instructions_executed);
snapshot(m);
this->channel->write("}\n");
instructions_executed = 0;
}

Expand Down

0 comments on commit 3237c15

Please sign in to comment.