mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-07 12:16:24 +00:00

- 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. - https://github.com/apache/nuttx/issues/15755#issuecomment-2635652808 - https://github.com/apache/nuttx/pull/16022 - https://docs.espressif.com/projects/esp-idf/en/stable/esp32/migration-guides/release-5.x/5.0/gcc.html#espressif-toolchain-changes
71 lines
1.5 KiB
C
71 lines
1.5 KiB
C
/*
|
|
* Copyright (C) 2021 Ant Group. All rights reserved.
|
|
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
*/
|
|
|
|
#ifndef _GDB_SERVER_H
|
|
#define _GDB_SERVER_H
|
|
|
|
#include "bh_platform.h"
|
|
|
|
#define PACKET_BUF_SIZE 0x8000
|
|
|
|
enum GDBStoppointType {
|
|
eStoppointInvalid = -1,
|
|
eBreakpointSoftware = 0,
|
|
eBreakpointHardware,
|
|
eWatchpointWrite,
|
|
eWatchpointRead,
|
|
eWatchpointReadWrite
|
|
};
|
|
|
|
typedef enum rsp_recv_phase_t {
|
|
Phase_Idle,
|
|
Phase_Payload,
|
|
Phase_Checksum
|
|
} rsp_recv_phase_t;
|
|
|
|
/* Remote Serial Protocol Receive Context */
|
|
typedef struct rsp_recv_context_t {
|
|
rsp_recv_phase_t phase;
|
|
uint16 receive_index;
|
|
uint16 size_in_phase;
|
|
uint8 check_sum;
|
|
/* RSP packet should not be too long */
|
|
char receive_buffer[1024];
|
|
} rsp_recv_context_t;
|
|
|
|
typedef struct WasmDebugPacket {
|
|
unsigned char buf[PACKET_BUF_SIZE];
|
|
uint32 size;
|
|
} WasmDebugPacket;
|
|
|
|
struct WASMDebugControlThread;
|
|
typedef struct WASMGDBServer {
|
|
bh_socket_t listen_fd;
|
|
bh_socket_t socket_fd;
|
|
WasmDebugPacket pkt;
|
|
bool noack;
|
|
struct WASMDebugControlThread *thread;
|
|
rsp_recv_context_t *receive_ctx;
|
|
} WASMGDBServer;
|
|
|
|
WASMGDBServer *
|
|
wasm_create_gdbserver(const char *host, int *port);
|
|
|
|
bool
|
|
wasm_gdbserver_listen(WASMGDBServer *server);
|
|
|
|
bool
|
|
wasm_gdbserver_accept(WASMGDBServer *server);
|
|
|
|
void
|
|
wasm_gdbserver_detach(WASMGDBServer *server);
|
|
|
|
void
|
|
wasm_close_gdbserver(WASMGDBServer *server);
|
|
|
|
bool
|
|
wasm_gdbserver_handle_packet(WASMGDBServer *server);
|
|
#endif
|