File tree 1 file changed +7
-10
lines changed
1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -146,19 +146,18 @@ WARDuino *wac = WARDuino::instance();
146
146
Module *m;
147
147
148
148
struct debugger_options {
149
- const char * socket;
149
+ int socket;
150
150
bool no_socket;
151
151
};
152
152
153
- void * setupDebuggerCommunication (debugger_options * options) {
153
+ void setupDebuggerCommunication (debugger_options & options) {
154
154
dbg_info (" \n === STARTED DEBUGGER (in separate thread) ===\n " );
155
155
// Start debugger
156
156
Channel *duplex;
157
- if (options-> no_socket ) {
157
+ if (options. no_socket ) {
158
158
duplex = new Duplex (stdin, stdout);
159
159
} else {
160
- int port = std::stoi (options->socket );
161
- duplex = new WebSocket (port);
160
+ duplex = new WebSocket (options.socket );
162
161
}
163
162
164
163
wac->debugger ->setChannel (duplex);
@@ -391,12 +390,10 @@ int main(int argc, const char *argv[]) {
391
390
// Start debugger (new thread)
392
391
std::thread communication;
393
392
if (!no_debug) {
394
- auto *options =
395
- (debugger_options *)malloc (sizeof (struct debugger_options ));
396
- options->no_socket = no_socket;
397
- options->socket = socket;
393
+ debugger_options options = debugger_options ();
394
+ options.no_socket = no_socket;
395
+ options.socket = std::stoi (socket);
398
396
setupDebuggerCommunication (options);
399
- free (options);
400
397
401
398
communication = std::thread (startDebuggerCommunication);
402
399
}
You can’t perform that action at this time.
0 commit comments