Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions platforms/CLI-Emulator/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,18 @@ WARDuino *wac = WARDuino::instance();
Module *m;

struct debugger_options {
const char *socket;
int socket;
bool no_socket;
};

void *setupDebuggerCommunication(debugger_options *options) {
void setupDebuggerCommunication(debugger_options &options) {
dbg_info("\n=== STARTED DEBUGGER (in separate thread) ===\n");
// Start debugger
Channel *duplex;
if (options->no_socket) {
if (options.no_socket) {
duplex = new Duplex(stdin, stdout);
} else {
int port = std::stoi(options->socket);
duplex = new WebSocket(port);
duplex = new WebSocket(options.socket);
}

wac->debugger->setChannel(duplex);
Expand Down Expand Up @@ -391,12 +390,10 @@ int main(int argc, const char *argv[]) {
// Start debugger (new thread)
std::thread communication;
if (!no_debug) {
auto *options =
(debugger_options *)malloc(sizeof(struct debugger_options));
options->no_socket = no_socket;
options->socket = socket;
debugger_options options = debugger_options();
options.no_socket = no_socket;
options.socket = std::stoi(socket);
setupDebuggerCommunication(options);
free(options);

communication = std::thread(startDebuggerCommunication);
}
Expand Down
Loading