Skip to content

Commit

Permalink
Fix Posix build
Browse files Browse the repository at this point in the history
  • Loading branch information
dd86k committed Sep 18, 2024
1 parent 08e7179 commit 477433f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
8 changes: 8 additions & 0 deletions debugger/shell.d
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,18 @@ void shell_event_exception(adbg_process_t *proc, int event, void *edata, void *u
adbg_exception_t *ex = adbg_debugger_event_exception(edata);
assert(ex);

// HACK: Currently have no way to determine remote associated thread
version (Windows)
printf("* Process %d (thread %d) stopped\n"~
" Reason : %s ("~ADBG_OS_ERROR_FORMAT~")\n",
proc.pid, proc.tid,
adbg_exception_name(ex), ex.oscode);
else
printf("* Process %d stopped\n"~
" Reason : %s ("~ADBG_OS_ERROR_FORMAT~")\n",
proc.pid,
adbg_exception_name(ex), ex.oscode);


// No fault address available
if (ex.faultz == 0)
Expand Down
2 changes: 1 addition & 1 deletion src/adbg/debugger.d
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ Lwait:
event.type = AdbgEvent.exception;
tracee.status = AdbgProcStatus.paused;
int sig = WSTOPSIG(wstatus);
adbg_exception_translate(&exception, &tracee.pid, &sig);
adbg_exception_translate(&event.exception, &tracee.pid, &sig);
/*
} else if (WIFCONTINUED(wstatus)) { // Process continues, ignore these
goto Lwait;
Expand Down
7 changes: 4 additions & 3 deletions src/adbg/process/exception.d
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ version (Windows) {
}
} else version (Posix) {
import core.sys.posix.signal;
import adbg.include.posix.ptrace;

private enum SEGV_BNDERR = 3;
}
Expand Down Expand Up @@ -286,13 +287,13 @@ version (Windows) {
exception.fault_address = 0;
break;
}
event.exception.fault_address = cast(size_t)siginfo._sifields._sigfault.si_addr;
exception.fault_address = cast(size_t)siginfo._sifields._sigfault.si_addr;
break;
default:
event.exception.fault_address = 0;
exception.fault_address = 0;
}
} else {
event.exception.fault_address = 0;
exception.fault_address = 0;
}

exception.oscode = signo;
Expand Down

0 comments on commit 477433f

Please sign in to comment.