From 59374ca419fdfdb0b4d92291b5d2b32babbce304 Mon Sep 17 00:00:00 2001 From: Jeremy Penner Date: Wed, 9 Sep 2020 22:26:08 -0400 Subject: [PATCH 1/2] Fix socket debugger * fix compilation error * fix off-by-one bug when writing to memory --- src/debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/debug.c b/src/debug.c index 06e6b00..8791350 100644 --- a/src/debug.c +++ b/src/debug.c @@ -527,8 +527,8 @@ void handle_set_bytes(int address, char *bytes_data) { while (sscanf(bytes_data, "%02x", &byte) == 1) { printf("$%02x <---- BYTE @ $%06X\n", byte, address ); bytes_data += 2; - address++; set_byte_at_address(address, byte & 0xFF); + address++; } } @@ -1313,7 +1313,7 @@ int do_dis_json(char *buf, word32 kpc, int accsize, int xsize, int op_provided, sprintf(buf_disasm,"%s [$%0*x],Y",out,args*2,val); break; - case IMMED: + case IMMEDIATE: sprintf(buf_disasm,"%s #$%0*x",out, args*2, val); break; From 15def9d30e28d4ab6593d0a8e6219cae9f9152f4 Mon Sep 17 00:00:00 2001 From: Jeremy Penner Date: Wed, 9 Sep 2020 22:26:38 -0400 Subject: [PATCH 2/2] Fix infinite socket blocking on Linux --- src/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/debug.c b/src/debug.c index 8791350..b2645ab 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1027,7 +1027,7 @@ void debug_server_poll() { /* failure occurs, we will close the */ /* connection. */ /*****************************************************/ - rc = recv(fds[i].fd, buffer, sizeof(buffer), 0); + rc = recv(fds[i].fd, buffer, sizeof(buffer), MSG_DONTWAIT); if (rc < 0) { if (errno != EWOULDBLOCK) { perror("recv() failed");