Fix #3759 - ood on OSX

This commit is contained in:
pancake 2015-11-25 11:52:29 +01:00
parent 513200a7fa
commit 2b51bf1acd
3 changed files with 5 additions and 4 deletions

View File

@ -131,8 +131,10 @@ static int r_debug_native_step (RDebug *dbg) {
// return thread id
static int r_debug_native_attach (RDebug *dbg, int pid) {
#if 0
if (!dbg || pid == dbg->pid)
return dbg->tid;
#endif
#if __linux__
return linux_attach (dbg, pid);
#elif __WINDOWS__ && !__CYGWIN__

View File

@ -205,12 +205,11 @@ bool xnu_step(RDebug *dbg) {
}
int xnu_attach(RDebug *dbg, int pid) {
//this should be necessary
#if XNU_USE_PTRACE
//XXX it seems that PT_ATTACH will be deprecated
//but using PT_ATTACHEXC throw errors
if (pid != dbg->pid && ptrace (PT_ATTACH, pid, 0, 0) == -1) {
if (ptrace (PT_ATTACH, pid, 0, 0) == -1) {
perror ("ptrace (PT_ATTACH)");
return -1;
}

View File

@ -13,7 +13,7 @@ static void xnu_thread_free(xnu_thread_t *thread) {
static int xnu_thread_set_drx(RDebug *dbg, xnu_thread_t *thread) {
R_DEBUG_REG_T *regs;
kern_return_t rc;
if (!dbg || !thread) return false;
if (!dbg || !thread) return false;
regs = (R_DEBUG_REG_T*)&thread->drx;
if (!regs) return false;
#if __i386__ || __x86_64__
@ -128,7 +128,7 @@ static bool xnu_thread_get_gpr(RDebug *dbg, xnu_thread_t *thread) {
static bool xnu_thread_get_drx(RDebug *dbg, xnu_thread_t *thread) {
kern_return_t rc;
R_DEBUG_REG_T *regs;
if (!dbg || !thread) return false;
if (!dbg || !thread) return false;
regs = (R_DEBUG_REG_T*)&thread->drx;
#if __x86_64__ || __i386__
thread->flavor = x86_DEBUG_STATE;