Skip to content

Commit 0ba6532

Browse files
authored
debug-engine: fix a few type mismatches (#4189)
- use strict prototypes complained by GCC `-Wstrict-prototypes` - use `int*` instead of `int32*` Note: on some targets, int32_t is a long. for example, GCC shipped with the recent ESP-IDF has such a configuration. - apache/nuttx#15755 (comment) - 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 fc78d67 commit 0ba6532

File tree

6 files changed

+17
-16
lines changed

6 files changed

+17
-16
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static WASMDebugEngine *g_debug_engine;
5858
static uint32 current_instance_id = 1;
5959

6060
static uint32
61-
allocate_instance_id()
61+
allocate_instance_id(void)
6262
{
6363
uint32 id;
6464

@@ -302,7 +302,7 @@ wasm_debug_control_thread_destroy(WASMDebugInstance *debug_instance)
302302
}
303303

304304
static WASMDebugEngine *
305-
wasm_debug_engine_create()
305+
wasm_debug_engine_create(void)
306306
{
307307
WASMDebugEngine *engine;
308308

@@ -326,7 +326,7 @@ wasm_debug_engine_create()
326326
}
327327

328328
void
329-
wasm_debug_engine_destroy()
329+
wasm_debug_engine_destroy(void)
330330
{
331331
if (g_debug_engine) {
332332
wasm_debug_handler_deinit();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ bool
133133
wasm_debug_engine_init(char *ip_addr, int32 process_port);
134134

135135
void
136-
wasm_debug_engine_destroy();
136+
wasm_debug_engine_destroy(void);
137137

138138
WASMExecEnv *
139139
wasm_debug_instance_get_current_env(WASMDebugInstance *instance);

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: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static char *tmpbuf;
3434
static korp_mutex tmpbuf_lock;
3535

3636
int
37-
wasm_debug_handler_init()
37+
wasm_debug_handler_init(void)
3838
{
3939
int ret;
4040
tmpbuf = wasm_runtime_malloc(MAX_PACKET_SIZE);
@@ -51,7 +51,7 @@ wasm_debug_handler_init()
5151
}
5252

5353
void
54-
wasm_debug_handler_deinit()
54+
wasm_debug_handler_deinit(void)
5555
{
5656
wasm_runtime_free(tmpbuf);
5757
tmpbuf = NULL;
@@ -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;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
#include "gdbserver.h"
1010

1111
int
12-
wasm_debug_handler_init();
12+
wasm_debug_handler_init(void);
1313

1414
void
15-
wasm_debug_handler_deinit();
15+
wasm_debug_handler_deinit(void);
1616

1717
void
1818
handle_interrupt(WASMGDBServer *server);

0 commit comments

Comments
 (0)