1
0

debug regressions: some whitespace and null ptr cleanup

This commit is contained in:
Megan Wachs 2017-12-19 14:57:31 -08:00
parent 96dd5d8c38
commit b643f3dca6
3 changed files with 20 additions and 17 deletions

View File

@ -24,9 +24,9 @@ extern "C" int jtag_tick
// TODO: Pass in real port number // TODO: Pass in real port number
jtag = new remote_bitbang_t(0); jtag = new remote_bitbang_t(0);
} }
jtag->tick(jtag_TCK, jtag_TMS, jtag_TDI, jtag_TRSTn, jtag_TDO); jtag->tick(jtag_TCK, jtag_TMS, jtag_TDI, jtag_TRSTn, jtag_TDO);
return jtag->done() ? (jtag->exit_code() << 1 | 1) : 0; return jtag->done() ? (jtag->exit_code() << 1 | 1) : 0;
} }

View File

@ -220,6 +220,9 @@ done_processing:
jtag = new remote_bitbang_t(0); jtag = new remote_bitbang_t(0);
dtm = new dtm_t(htif_argc, htif_argv); dtm = new dtm_t(htif_argc, htif_argv);
jtag = new remote_bitbang_t(0);
dtm = new dtm_t(to_dtm);
signal(SIGTERM, handle_sigterm); signal(SIGTERM, handle_sigterm);
bool dump; bool dump;
@ -232,13 +235,13 @@ done_processing:
dump = tfp && trace_count >= start; dump = tfp && trace_count >= start;
if (dump) if (dump)
tfp->dump(static_cast<vluint64_t>(trace_count * 2)); tfp->dump(static_cast<vluint64_t>(trace_count * 2));
#endif #endif
tile->clock = 1; tile->clock = 1;
tile->eval(); tile->eval();
#if VM_TRACE #if VM_TRACE
if (dump) if (dump)
tfp->dump(static_cast<vluint64_t>(trace_count * 2 + 1)); tfp->dump(static_cast<vluint64_t>(trace_count * 2 + 1));
#endif #endif
trace_count ++; trace_count ++;
} }
tile->reset = 0; tile->reset = 0;

View File

@ -28,7 +28,7 @@ remote_bitbang_t::remote_bitbang_t(uint16_t port) :
strerror(errno), errno); strerror(errno), errno);
abort(); abort();
} }
fcntl(socket_fd, F_SETFL, O_NONBLOCK); fcntl(socket_fd, F_SETFL, O_NONBLOCK);
int reuseaddr = 1; int reuseaddr = 1;
if (setsockopt(socket_fd, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, if (setsockopt(socket_fd, SOL_SOCKET, SO_REUSEADDR, &reuseaddr,
@ -37,25 +37,25 @@ remote_bitbang_t::remote_bitbang_t(uint16_t port) :
strerror(errno), errno); strerror(errno), errno);
abort(); abort();
} }
struct sockaddr_in addr; struct sockaddr_in addr;
memset(&addr, 0, sizeof(addr)); memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
addr.sin_addr.s_addr = INADDR_ANY; addr.sin_addr.s_addr = INADDR_ANY;
addr.sin_port = htons(port); addr.sin_port = htons(port);
if (bind(socket_fd, (struct sockaddr *) &addr, sizeof(addr)) == -1) { if (bind(socket_fd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {
fprintf(stderr, "remote_bitbang failed to bind socket: %s (%d)\n", fprintf(stderr, "remote_bitbang failed to bind socket: %s (%d)\n",
strerror(errno), errno); strerror(errno), errno);
abort(); abort();
} }
if (listen(socket_fd, 1) == -1) { if (listen(socket_fd, 1) == -1) {
fprintf(stderr, "remote_bitbang failed to listen on socket: %s (%d)\n", fprintf(stderr, "remote_bitbang failed to listen on socket: %s (%d)\n",
strerror(errno), errno); strerror(errno), errno);
abort(); abort();
} }
socklen_t addrlen = sizeof(addr); socklen_t addrlen = sizeof(addr);
if (getsockname(socket_fd, (struct sockaddr *) &addr, &addrlen) == -1) { if (getsockname(socket_fd, (struct sockaddr *) &addr, &addrlen) == -1) {
fprintf(stderr, "remote_bitbang getsockname failed: %s (%d)\n", fprintf(stderr, "remote_bitbang getsockname failed: %s (%d)\n",
@ -68,7 +68,7 @@ remote_bitbang_t::remote_bitbang_t(uint16_t port) :
tdi = 1; tdi = 1;
trstn = 1; trstn = 1;
quit = 0; quit = 0;
printf("Listening on port %d\n", printf("Listening on port %d\n",
ntohs(addr.sin_port)); ntohs(addr.sin_port));
fflush(stdout); fflush(stdout);
@ -112,11 +112,11 @@ void remote_bitbang_t::tick(
} else { } else {
this->accept(); this->accept();
} }
* jtag_tck = tck; * jtag_tck = tck;
* jtag_tms = tms; * jtag_tms = tms;
* jtag_tdi = tdi; * jtag_tdi = tdi;
* jtag_trstn = trstn; * jtag_trstn = trstn;
} }
@ -153,13 +153,13 @@ void remote_bitbang_t::execute_command()
again = 0; again = 0;
} }
} }
fprintf(stderr, "Received a command %c\n", command); fprintf(stderr, "Received a command %c\n", command);
int dosend = 0; int dosend = 0;
char tosend = '?'; char tosend = '?';
switch (command) { switch (command) {
case 'B': /* fprintf(stderr, "*BLINK*\n"); */ break; case 'B': /* fprintf(stderr, "*BLINK*\n"); */ break;
case 'b': /* fprintf(stderr, "_______\n"); */ break; case 'b': /* fprintf(stderr, "_______\n"); */ break;
@ -191,7 +191,7 @@ void remote_bitbang_t::execute_command()
} }
} }
} }
if (quit) { if (quit) {
// The remote disconnected. // The remote disconnected.
fprintf(stderr, "Remote end disconnected\n"); fprintf(stderr, "Remote end disconnected\n");