Skip to content

Commit 9f7a0bb

Browse files
committed
Check debug messages during blocking RFC call
Adds `module *m` to RFC
1 parent b57d480 commit 9f7a0bb

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

src/Debug/debugger.cpp

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

1414-
auto *rfc = new RFC(fidx, func->type, args);
1414+
auto *rfc = new RFC(m, fidx, func->type, args);
14151415
this->proxy->pushRFC(m, rfc);
14161416
}
14171417

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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ bool ProxySupervisor::send(
110110
return n == size;
111111
}
112112

113-
nlohmann::basic_json<> ProxySupervisor::readReply() {
114-
while (!this->hasReplied);
113+
nlohmann::basic_json<> ProxySupervisor::readReply(RFC *rfc) {
114+
while (!this->hasReplied) {
115+
WARDuino::instance()->debugger->checkDebugMessages(rfc->m, &WARDuino::instance()->program_state);
116+
}
115117
WARDuino::instance()->debugger->channel->write("read reply: succeeded\n");
116118
this->hasReplied = false;
117119
return this->proxyResult;

src/Edward/proxy_supervisor.h

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

3838
bool send(void *t_buffer, int t_size);
39-
nlohmann::basic_json<> readReply();
39+
nlohmann::basic_json<> readReply(RFC *rfc);
4040

4141
bool call(RFC *callee);
4242

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)