|
@@ -33,10 +33,12 @@ HL_API hl_socket *hl_socket_accept( hl_socket *s );
|
|
|
HL_API int hl_socket_send( hl_socket *s, vbyte *buf, int pos, int len );
|
|
|
HL_API int hl_socket_recv( hl_socket *s, vbyte *buf, int pos, int len );
|
|
|
HL_API void hl_sys_sleep( double t );
|
|
|
+HL_API int hl_thread_id();
|
|
|
|
|
|
static hl_socket *debug_socket = NULL;
|
|
|
static hl_socket *client_socket = NULL;
|
|
|
static bool debugger_connected = false;
|
|
|
+static int main_thread_id = 0;
|
|
|
|
|
|
#define send hl_send_data
|
|
|
static void send( void *ptr, int size ) {
|
|
@@ -57,6 +59,7 @@ static void hl_debug_loop( hl_module *m ) {
|
|
|
client_socket = s;
|
|
|
send("HLD0",4);
|
|
|
send(&flags,4);
|
|
|
+ send(&main_thread_id,4);
|
|
|
send(&stack_top,sizeof(void*));
|
|
|
send(&m->jit_code,sizeof(void*));
|
|
|
send(&m->codesize,4);
|
|
@@ -96,6 +99,7 @@ bool hl_module_debug( hl_module *m, int port, bool wait ) {
|
|
|
}
|
|
|
hl_add_root(&debug_socket);
|
|
|
hl_add_root(&client_socket);
|
|
|
+ main_thread_id = hl_thread_id();
|
|
|
debug_socket = s;
|
|
|
if( !hl_thread_start(hl_debug_loop, m, false) ) {
|
|
|
hl_socket_close(s);
|