GDB stub progress

This commit is contained in:
momo5502
2025-01-12 16:03:41 +01:00
parent 8adc73de71
commit 9e268ea4dc
9 changed files with 159 additions and 50 deletions

View File

@@ -10,7 +10,7 @@
using send_size = int;
#define GET_SOCKET_ERROR() (WSAGetLastError())
#define poll WSAPoll
#define SOCK_WOULDBLOCK WSAEWOULDBLOCK
#define SERR(x) (WSA##x)
#define SHUT_RDWR SD_BOTH
#else
using SOCKET = int;
@@ -19,7 +19,7 @@ using send_size = size_t;
#define SOCKET_ERROR (-1)
#define GET_SOCKET_ERROR() (errno)
#define closesocket close
#define SOCK_WOULDBLOCK EWOULDBLOCK
#define SERR(x) (x)
#endif
namespace network
@@ -42,14 +42,16 @@ namespace network
operator bool() const;
bool is_valid() const;
bool bind(const address& target);
bool set_blocking(bool blocking);
static bool set_blocking(SOCKET s, bool blocking);
static constexpr bool socket_is_ready = true;
bool sleep(std::chrono::milliseconds timeout) const;
bool sleep_until(std::chrono::high_resolution_clock::time_point time_point) const;
bool sleep(std::chrono::milliseconds timeout, bool in_poll = true) const;
bool sleep_until(std::chrono::high_resolution_clock::time_point time_point, bool in_poll = true) const;
SOCKET get_socket() const;
uint16_t get_port() const;
@@ -57,15 +59,18 @@ namespace network
int get_address_family() const;
static bool sleep_sockets(const std::span<const socket*>& sockets, std::chrono::milliseconds timeout);
bool is_ready(bool in_poll) const;
static bool sleep_sockets(const std::span<const socket*>& sockets, std::chrono::milliseconds timeout,
bool in_poll);
static bool sleep_sockets_until(const std::span<const socket*>& sockets,
std::chrono::high_resolution_clock::time_point time_point);
std::chrono::high_resolution_clock::time_point time_point, bool in_poll);
static bool is_socket_ready(SOCKET s, bool in_poll);
void close();
private:
SOCKET socket_ = INVALID_SOCKET;
void release();
};
}