Skip to content

Commit

Permalink
Fix disconnect request on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxiaomao committed Apr 19, 2024
1 parent 5f1c4e7 commit d23c1d4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
Binary file modified hldebug-wrapper/lib/linux/hldebug.node
Binary file not shown.
3 changes: 1 addition & 2 deletions hldebug-wrapper/src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ HL_API bool hl_debug_stop( int pid ) {
# elif defined(MAC_DEBUG)
return mdbg_session_detach(pid);
# elif defined(USE_PTRACE)
kill(pid, SIGTRAP); // DETACH needs ptrace-stop
return ptrace(PTRACE_DETACH,pid,0,0) >= 0;
# else
return false;
Expand Down Expand Up @@ -255,7 +256,6 @@ HL_API int hl_debug_wait( int pid, int *thread, int timeout ) {
// With it, and more we wait, less we miss stop event.
usleep(100 * 1000);
int ret = waitpid(pid, &status, WNOHANG);
//printf("WAITPID=%X %X\n",ret,status);
*thread = ret;
if( ret == -1 && errno != EINTR )
return 3;
Expand All @@ -265,7 +265,6 @@ HL_API int hl_debug_wait( int pid, int *thread, int timeout ) {
return 0;
if( WIFSTOPPED(status) ) {
int sig = WSTOPSIG(status);
//printf(" STOPSIG=%d\n",sig);
if( sig == SIGSTOP || sig == SIGTRAP )
return 1;
return 3;
Expand Down

0 comments on commit d23c1d4

Please sign in to comment.