Skip to content

Commit 34b89fd

Browse files
committed
πŸ› Check debug messages during blokcing RFC call
Adds `module *m` to RFC
1 parent 07dd95c commit 34b89fd

File tree

6 files changed

+15
-11
lines changed

6 files changed

+15
-11
lines changed

β€Žsrc/Debug/debugger.cppβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ void Debugger::handleProxyCall(Module *m, RunningState *program_state,
12161216
StackValue *args = Proxy::readRFCArgs(func, data);
12171217
dbg_trace("Enqueuing callee %" PRIu32 "\n", func->fidx);
12181218

1219-
auto *rfc = new RFC(fidx, func->type, args);
1219+
auto *rfc = new RFC(m, fidx, func->type, args);
12201220
this->proxy->pushRFC(m, rfc);
12211221
}
12221222

β€Žsrc/Edward/RFC.cppβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#include "RFC.h"
22

3-
RFC::RFC(uint32_t id, Type *t_type, StackValue *t_args)
4-
: fidx(id), args(t_args), type(t_type) {}
3+
RFC::RFC(Module *m, uint32_t id, Type *t_type, StackValue *t_args)
4+
: m(m), fidx(id), args(t_args), type(t_type) {}

β€Žsrc/Edward/RFC.hβ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#pragma once
22

33
#include <cstdint>
4+
5+
#include "../WARDuino/internals.h"
46
struct StackValue;
57
struct Type;
68

@@ -11,6 +13,7 @@ struct SerializeData {
1113

1214
class RFC {
1315
public:
16+
Module *m;
1417
const uint32_t fidx;
1518
StackValue *args;
1619
const Type *type;
@@ -20,5 +23,5 @@ class RFC {
2023
char *exception;
2124
uint16_t exception_size;
2225

23-
RFC(uint32_t id, Type *t_type, StackValue *t_args = nullptr);
26+
RFC(Module *m, uint32_t id, Type *t_type, StackValue *t_args = nullptr);
2427
};

β€Žsrc/Edward/proxy_supervisor.cppβ€Ž

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,10 @@ bool ProxySupervisor::send(
111111
return n == size;
112112
}
113113

114-
nlohmann::basic_json<> ProxySupervisor::readReply() {
115-
while (!this->hasReplied)
116-
;
114+
nlohmann::basic_json<> ProxySupervisor::readReply(RFC *rfc) {
115+
while (!this->hasReplied) {
116+
WARDuino::instance()->debugger->checkDebugMessages(rfc->m, &WARDuino::instance()->program_state);
117+
}
117118
WARDuino::instance()->debugger->channel->write("read reply: succeeded\n");
118119
this->hasReplied = false;
119120
return this->proxyResult;
@@ -197,7 +198,7 @@ struct SerializeData *ProxySupervisor::serializeRFC(RFC *callee) {
197198
}
198199

199200
void ProxySupervisor::deserializeRFCResult(RFC *rfc) {
200-
nlohmann::basic_json<> call_result = this->readReply(); // blocking
201+
nlohmann::basic_json<> call_result = this->readReply(rfc); // blocking
201202
rfc->success = *call_result.find("success");
202203

203204
if (rfc->type->result_count == 0) {

β€Žsrc/Edward/proxy_supervisor.hβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ProxySupervisor : public Debugger {
3535
void listenToSocket();
3636

3737
bool send(void *t_buffer, int t_size);
38-
nlohmann::basic_json<> readReply();
38+
nlohmann::basic_json<> readReply(RFC *rfc);
3939

4040
bool call(RFC *callee);
4141

β€Žsrc/Interpreter/instructions.cppβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ bool proxy_call(Module *m, uint32_t fidx) {
1717
if (type->param_count > 0) {
1818
m->sp -= type->param_count;
1919
StackValue *args = &m->stack[m->sp + 1];
20-
rfc = new RFC(fidx, type, args);
20+
rfc = new RFC(m, fidx, type, args);
2121
} else {
22-
rfc = new RFC(fidx, type);
22+
rfc = new RFC(m, fidx, type);
2323
}
2424

2525
if (!supervisor->call(rfc)) {

0 commit comments

Comments
Β (0)