Skip to content

Commit 0ce026b

Browse files
committed
debug-engine: fix a few type mismatches
Note: on some targets, int32_t is a long. for example, GCC shipped with the recent ESP-IDF has such a configuration. [1] [1] apache/nuttx#15755 (comment) cf. apache/nuttx#16022 https://docs.espressif.com/projects/esp-idf/en/stable/esp32/migration-guides/release-5.x/5.0/gcc.html#espressif-toolchain-changes
1 parent 9aaf359 commit 0ce026b

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

core/iwasm/libraries/debug-engine/gdbserver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static const struct packet_handler_elem packet_handler_table[255] = {
3838
};
3939

4040
WASMGDBServer *
41-
wasm_create_gdbserver(const char *host, int32 *port)
41+
wasm_create_gdbserver(const char *host, int *port)
4242
{
4343
bh_socket_t listen_fd = (bh_socket_t)-1;
4444
WASMGDBServer *server;

core/iwasm/libraries/debug-engine/gdbserver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ typedef struct WASMGDBServer {
5151
} WASMGDBServer;
5252

5353
WASMGDBServer *
54-
wasm_create_gdbserver(const char *host, int32 *port);
54+
wasm_create_gdbserver(const char *host, int *port);
5555

5656
bool
5757
wasm_gdbserver_listen(WASMGDBServer *server);

core/iwasm/libraries/debug-engine/handler.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ handle_general_query(WASMGDBServer *server, char *payload)
205205
os_mutex_lock(&tmpbuf_lock);
206206
snprintf(tmpbuf, MAX_PACKET_SIZE,
207207
"qXfer:libraries:read+;PacketSize=%" PRIx32 ";",
208-
MAX_PACKET_SIZE);
208+
(uint32)MAX_PACKET_SIZE);
209209
write_packet(server, tmpbuf);
210210
os_mutex_unlock(&tmpbuf_lock);
211211
}
@@ -384,7 +384,7 @@ send_thread_stop_status(WASMGDBServer *server, uint32 status, korp_tid tid)
384384

385385
if (status == 0) {
386386
os_mutex_lock(&tmpbuf_lock);
387-
snprintf(tmpbuf, MAX_PACKET_SIZE, "W%02x", status);
387+
snprintf(tmpbuf, MAX_PACKET_SIZE, "W%02" PRIx32, status);
388388
write_packet(server, tmpbuf);
389389
os_mutex_unlock(&tmpbuf_lock);
390390
return;
@@ -400,8 +400,9 @@ send_thread_stop_status(WASMGDBServer *server, uint32 status, korp_tid tid)
400400

401401
os_mutex_lock(&tmpbuf_lock);
402402
// TODO: how name a wasm thread?
403-
len += snprintf(tmpbuf, MAX_PACKET_SIZE, "T%02xthread:%" PRIx64 ";name:%s;",
404-
gdb_status, (uint64)(uintptr_t)tid, "nobody");
403+
len += snprintf(tmpbuf, MAX_PACKET_SIZE,
404+
"T%02" PRIx32 "thread:%" PRIx64 ";name:%s;", gdb_status,
405+
(uint64)(uintptr_t)tid, "nobody");
405406
if (tids_count > 0) {
406407
len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, "threads:");
407408
while (i < tids_count) {
@@ -624,7 +625,8 @@ void
624625
handle_get_write_memory(WASMGDBServer *server, char *payload)
625626
{
626627
size_t hex_len;
627-
int32 offset, act_len;
628+
int offset;
629+
int32 act_len;
628630
uint64 maddr, mlen;
629631
char *buff;
630632
bool ret;

0 commit comments

Comments
 (0)