[debugger enhance] don't block gdbserver thread while executing (#989)

Allow to set break point again when all break points are removed and
wasm app starts running.
This commit is contained in:
Xu Jun
2022-02-16 17:35:35 +08:00
committed by GitHub
parent 985dea9493
commit 3fe191b0df
14 changed files with 424 additions and 221 deletions

View File

@ -71,6 +71,22 @@ fail:
return BHT_ERROR;
}
int
os_socket_settimeout(bh_socket_t socket, uint64 timeout_us)
{
struct timeval tv;
tv.tv_sec = timeout_us / 1000000UL;
tv.tv_usec = timeout_us % 1000000UL;
if (setsockopt(socket, SOL_SOCKET, SO_RCVTIMEO, (const char *)&tv,
sizeof(tv))
!= 0) {
return BHT_ERROR;
}
return BHT_OK;
}
int
os_socket_listen(bh_socket_t socket, int max_client)
{

View File

@ -226,6 +226,17 @@ os_socket_create(bh_socket_t *sock, int tcp_or_udp);
int
os_socket_bind(bh_socket_t socket, const char *addr, int *port);
/**
* Set timeout for the given socket
*
* @param socket the socket to set timeout
* @param timeout_us timeout in microseconds
*
* @return 0 if success, -1 otherwise
*/
int
os_socket_settimeout(bh_socket_t socket, uint64 timeout_us);
/**
* Make the socket as a passive socket to accept incoming connection requests
*

View File

@ -85,6 +85,20 @@ fail:
return BHT_ERROR;
}
int
os_socket_settimeout(bh_socket_t socket, uint64 timeout_us)
{
DWORD tv = (DWORD)(timeout_us / 1000UL);
if (setsockopt(socket, SOL_SOCKET, SO_RCVTIMEO, (const char *)&tv,
sizeof(tv))
!= 0) {
return BHT_ERROR;
}
return BHT_OK;
}
int
os_socket_listen(bh_socket_t socket, int max_client)
{