Skip to content

Commit

Permalink
Fix NetBSD 10 build (#4524)
Browse files Browse the repository at this point in the history
* Fix NetBSD 10 build
* It's TRAP_BRKPT, not TRAP_BKPT
  • Loading branch information
kazarmy authored Jun 1, 2024
1 parent 6e4ea01 commit 5129fdb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions librz/debug/p/native/bsd/bsd_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ static void addr_to_string(struct sockaddr_storage *ss, char *buffer, int buflen

int bsd_handle_signals(RzDebug *dbg) {
#if __KFBSD__ || __NetBSD__
siginfo_t siginfo;
#if __KFBSD__
// Trying to figure out a bit by the signal
struct ptrace_lwpinfo linfo = { 0 };
siginfo_t siginfo;
int ret = ptrace(PT_LWPINFO, dbg->pid, (char *)&linfo, sizeof(linfo));
if (ret == -1) {
if (errno == ESRCH) {
Expand All @@ -83,7 +84,6 @@ int bsd_handle_signals(RzDebug *dbg) {
return 0;
}

#if __KFBSD__
siginfo = linfo.pl_siginfo;
#else
struct ptrace_siginfo sinfo = { 0 };
Expand All @@ -108,6 +108,13 @@ int bsd_handle_signals(RzDebug *dbg) {
case SIGSEGV:
dbg->reason.type = RZ_DEBUG_REASON_SEGFAULT;
break;
#if __NetBSD__
case SIGTRAP:
if (siginfo.si_code == TRAP_BRKPT) {
dbg->reason.type = RZ_DEBUG_REASON_BREAKPOINT;
}
break;
#endif
}

return 0;
Expand Down

0 comments on commit 5129fdb

Please sign in to comment.