Fixing GdbStub Code to make it compiled with Clang (#2292)

- Fix the switch scoping preventing declaration
- Adding stdint.h as inclusion to make uint*_t works
This commit is contained in:
Didiet
2022-04-16 13:12:38 +07:00
committed by GitHub
parent b840ca618e
commit 100eaf70ee
2 changed files with 9 additions and 1 deletions

View File

@@ -27,6 +27,7 @@
#else #else
# include <arpa/inet.h> # include <arpa/inet.h>
# include <sys/socket.h> # include <sys/socket.h>
# include <errno.h>
#endif #endif
#define HAVE_STDARG_H #define HAVE_STDARG_H
#include <86box/86box.h> #include <86box/86box.h>
@@ -954,7 +955,7 @@ e14:
/* Add our supported features to the end. */ /* Add our supported features to the end. */
if (client->response_pos < (sizeof(client->response) - 1)) if (client->response_pos < (sizeof(client->response) - 1))
client->response_pos += snprintf(&client->response[client->response_pos], sizeof(client->response) - client->response_pos, client->response_pos += snprintf(&client->response[client->response_pos], sizeof(client->response) - client->response_pos,
"PacketSize=%X;swbreak+;hwbreak+;qXfer:features:read+", sizeof(client->packet) - 1); "PacketSize=%lX;swbreak+;hwbreak+;qXfer:features:read+", sizeof(client->packet) - 1);
break; break;
} else if (!strcmp(client->response, "Xfer")) { } else if (!strcmp(client->response, "Xfer")) {
/* Read the transfer object. */ /* Read the transfer object. */
@@ -1101,6 +1102,7 @@ unknown:
case 'z': /* remove break/watchpoint */ case 'z': /* remove break/watchpoint */
case 'Z': /* insert break/watchpoint */ case 'Z': /* insert break/watchpoint */
{
gdbstub_breakpoint_t *breakpoint, *prev_breakpoint = NULL, **first_breakpoint; gdbstub_breakpoint_t *breakpoint, *prev_breakpoint = NULL, **first_breakpoint;
/* Parse breakpoint type. */ /* Parse breakpoint type. */
@@ -1222,6 +1224,7 @@ unknown:
/* Respond positively. */ /* Respond positively. */
goto ok; goto ok;
}
} }
end: end:
/* Send response. */ /* Send response. */
@@ -1655,7 +1658,11 @@ gdbstub_init()
.sin_port = htons(port) .sin_port = htons(port)
}; };
if (bind(gdbstub_socket, (struct sockaddr *) &bind_addr, sizeof(bind_addr)) == -1) { if (bind(gdbstub_socket, (struct sockaddr *) &bind_addr, sizeof(bind_addr)) == -1) {
#ifdef _WIN32
pclog("GDB Stub: Failed to bind on port %d (%d)\n", port, WSAGetLastError()); pclog("GDB Stub: Failed to bind on port %d (%d)\n", port, WSAGetLastError());
#else
pclog("GDB Stup: Failed to bind on port %d (%d)\n", port, errno);
#endif
gdbstub_socket = -1; gdbstub_socket = -1;
return; return;
} }

View File

@@ -16,6 +16,7 @@
*/ */
#ifndef EMU_GDBSTUB_H #ifndef EMU_GDBSTUB_H
#define EMU_GDBSTUB_H #define EMU_GDBSTUB_H
#include <stdint.h>
#include <86box/mem.h> #include <86box/mem.h>
#define GDBSTUB_MEM_READ 0 #define GDBSTUB_MEM_READ 0