Skip to content

Commit

Permalink
Clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
MaartenS11 committed Oct 30, 2024
1 parent 16d3e97 commit b95b266
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
26 changes: 14 additions & 12 deletions src/Debug/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ bool Debugger::checkDebugMessages(Module *m, RunningState *program_state) {
case interruptPAUSE:
this->pauseRuntime(m);
// Make a checkpoint so the debugger knows the current state and
// knows how many instructions were executed since the last checkpoint.
// knows how many instructions were executed since the last
// checkpoint.
if (snapshotPolicy == SnapshotPolicy::checkpointing) {
checkpoint(m, true);
}
Expand All @@ -219,7 +220,7 @@ bool Debugger::checkDebugMessages(Module *m, RunningState *program_state) {
uint8_t *data = interruptData + 1;
uint32_t amount = read_B32(&data);
printf("Continue for %d instruction(s)\n", amount);
remaining_instructions = (int32_t) amount;
remaining_instructions = (int32_t)amount;
*program_state = WARDUINOrun;
free(interruptData);
break;
Expand Down Expand Up @@ -954,8 +955,7 @@ void Debugger::handleSnapshotPolicy(Module *m) {
this->channel->write("SNAPSHOT ");
snapshot(m);
this->channel->write("\n");
}
else if (snapshotPolicy == SnapshotPolicy::checkpointing) {
} else if (snapshotPolicy == SnapshotPolicy::checkpointing) {
if (instructions_executed >= checkpointInterval || fidx_called) {
checkpoint(m);
}
Expand All @@ -965,11 +965,11 @@ void Debugger::handleSnapshotPolicy(Module *m) {
if ((fidx_called = isPrimitiveBeingCalled(m, m->pc_ptr))) {
const Type *type = m->functions[*fidx_called].type;
for (uint32_t i = 0; i < type->param_count; i++) {
prim_args[type->param_count - i - 1] = m->stack[m->sp - i].value.uint32;
prim_args[type->param_count - i - 1] =
m->stack[m->sp - i].value.uint32;
}
}
}
else if (snapshotPolicy != SnapshotPolicy::none) {
} else if (snapshotPolicy != SnapshotPolicy::none) {
this->channel->write("WARNING: Invalid snapshot policy.");
}
}
Expand All @@ -979,7 +979,8 @@ void Debugger::checkpoint(Module *m, bool force) {
return;
}

this->channel->write(R"(CHECKPOINT {"instructions_executed": %d, )", instructions_executed);
this->channel->write(R"(CHECKPOINT {"instructions_executed": %d, )",
instructions_executed);
if (fidx_called) {
this->channel->write("\"fidx_called\": %d, \"args\": [", *fidx_called);
const Block &func_block = m->functions[*fidx_called];
Expand Down Expand Up @@ -1582,7 +1583,8 @@ Debugger::~Debugger() {
delete this->supervisor;
}

std::optional<uint32_t> Debugger::isPrimitiveBeingCalled(Module *m, uint8_t *pc_ptr) {
std::optional<uint32_t> Debugger::isPrimitiveBeingCalled(Module *m,
uint8_t *pc_ptr) {
if (!pc_ptr) {
return {};
}
Expand All @@ -1598,8 +1600,7 @@ std::optional<uint32_t> Debugger::isPrimitiveBeingCalled(Module *m, uint8_t *pc_
}

bool Debugger::handleContinueFor(Module *m) {
if (remaining_instructions < 0)
return false;
if (remaining_instructions < 0) return false;

if (remaining_instructions == 0) {
remaining_instructions = -1;
Expand All @@ -1616,7 +1617,8 @@ bool Debugger::handleContinueFor(Module *m) {

void Debugger::notifyCompleteStep(Module *m) const {
// Upon completing a step in checkpointing mode, make a checkpoint.
if (m->warduino->debugger->getSnapshotPolicy() == SnapshotPolicy::checkpointing) {
if (m->warduino->debugger->getSnapshotPolicy() ==
SnapshotPolicy::checkpointing) {
m->warduino->debugger->checkpoint(m);
}
this->channel->write("STEP!\n");
Expand Down
3 changes: 1 addition & 2 deletions src/Edward/proxy_supervisor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ bool ProxySupervisor::send(
}

nlohmann::basic_json<> ProxySupervisor::readReply() {
while (!this->hasReplied)
;
while (!this->hasReplied);
WARDuino::instance()->debugger->channel->write("read reply: succeeded\n");
this->hasReplied = false;
return this->proxyResult;
Expand Down
4 changes: 2 additions & 2 deletions src/Interpreter/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@ bool Interpreter::interpret(Module *m, bool waiting) {
}

// Resolve all unhandled callback events
while (CallbackHandler::resolving_event && CallbackHandler::resolve_event())
;
while (CallbackHandler::resolving_event &&
CallbackHandler::resolve_event());

dbg_trace("Interpretation ended %s with status %s\n",
program_done ? "expectedly" : "unexpectedly",
Expand Down

0 comments on commit b95b266

Please sign in to comment.