gdbserver.h 894 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (C) 2021 Ant Group. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef _GDB_SERVER_H
  6. #define _GDB_SERVER_H
  7. #include <stdbool.h>
  8. #define PACKET_BUF_SIZE 0x8000
  9. enum GDBStoppointType {
  10. eStoppointInvalid = -1,
  11. eBreakpointSoftware = 0,
  12. eBreakpointHardware,
  13. eWatchpointWrite,
  14. eWatchpointRead,
  15. eWatchpointReadWrite
  16. };
  17. typedef struct WasmDebugPacket {
  18. unsigned char buf[PACKET_BUF_SIZE];
  19. unsigned int size;
  20. } WasmDebugPacket;
  21. struct WASMDebugControlThread;
  22. typedef struct WASMGDBServer {
  23. int listen_fd;
  24. int socket_fd;
  25. WasmDebugPacket pkt;
  26. bool noack;
  27. struct WASMDebugControlThread *thread;
  28. } WASMGDBServer;
  29. WASMGDBServer *
  30. wasm_launch_gdbserver(char *addr, int port);
  31. void
  32. wasm_close_gdbserver(WASMGDBServer *server);
  33. bool
  34. wasm_gdbserver_handle_packet(WASMGDBServer *server);
  35. #endif