Skip to content

Commit 832ff71

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 3bdec3c commit 832ff71

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ handle_general_query(WASMGDBServer *server, char *payload)
204204
if (!strcmp(name, "Supported")) {
205205
os_mutex_lock(&tmpbuf_lock);
206206
snprintf(tmpbuf, MAX_PACKET_SIZE,
207-
"qXfer:libraries:read+;PacketSize=%" PRIx32 ";",
208-
MAX_PACKET_SIZE);
207+
"qXfer:libraries:read+;PacketSize=%x;", MAX_PACKET_SIZE);
209208
write_packet(server, tmpbuf);
210209
os_mutex_unlock(&tmpbuf_lock);
211210
}
@@ -384,7 +383,7 @@ send_thread_stop_status(WASMGDBServer *server, uint32 status, korp_tid tid)
384383

385384
if (status == 0) {
386385
os_mutex_lock(&tmpbuf_lock);
387-
snprintf(tmpbuf, MAX_PACKET_SIZE, "W%02x", status);
386+
snprintf(tmpbuf, MAX_PACKET_SIZE, "W%02" PRIx32, status);
388387
write_packet(server, tmpbuf);
389388
os_mutex_unlock(&tmpbuf_lock);
390389
return;
@@ -400,8 +399,9 @@ send_thread_stop_status(WASMGDBServer *server, uint32 status, korp_tid tid)
400399

401400
os_mutex_lock(&tmpbuf_lock);
402401
// 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");
402+
len += snprintf(tmpbuf, MAX_PACKET_SIZE,
403+
"T%02" PRIx32 "thread:%" PRIx64 ";name:%s;", gdb_status,
404+
(uint64)(uintptr_t)tid, "nobody");
405405
if (tids_count > 0) {
406406
len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, "threads:");
407407
while (i < tids_count) {
@@ -624,7 +624,8 @@ void
624624
handle_get_write_memory(WASMGDBServer *server, char *payload)
625625
{
626626
size_t hex_len;
627-
int32 offset, act_len;
627+
int offset;
628+
int32 act_len;
628629
uint64 maddr, mlen;
629630
char *buff;
630631
bool ret;

0 commit comments

Comments
 (0)