Skip to content

Commit

Permalink
Fix debugger build on Mac OS X 10.5/ppc
Browse files Browse the repository at this point in the history
Debugging itself is still not working, but now it does not prevent a successful
build for static analysis.
  • Loading branch information
thestr4ng3r committed Apr 9, 2024
1 parent c23fdd9 commit 505893b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 4 additions & 0 deletions librz/debug/p/native/xnu/xnu_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,11 @@ RzList *xnu_thread_list(RzDebug *dbg, int pid, RzList *list) {
#if __arm__ || __arm64__ || __aarch_64__
#define CPU_PC (dbg->bits == RZ_SYS_BITS_64) ? state.arm64.__pc : state.arm32.__pc
#elif __POWERPC__
#if __DARWIN_UNIX03
#define CPU_PC state.__srr0
#else
#define CPU_PC state.srr0
#endif
#elif __x86_64__ || __i386__
#define CPU_PC (dbg->bits == RZ_SYS_BITS_64) ? state.uts.ts64.__rip : state.uts.ts32.__eip
#endif
Expand Down
3 changes: 0 additions & 3 deletions librz/debug/p/native/xnu/xnu_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,10 @@ int ptrace(int _request, pid_t _pid, caddr_t _addr, int _data);
#include <sys/fcntl.h>
#include <sys/proc.h>

// G3
#if __POWERPC__
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <mach/ppc/_types.h>
#include <mach/ppc/thread_status.h>
// iPhone5
#elif __aarch64
Expand All @@ -88,7 +86,6 @@ int ptrace(int _request, pid_t _pid, caddr_t _addr, int _data);
#elif __arm64
#include <mach/arm/thread_status.h>
#else
// iMac
/* x86 32/64 */
#include <mach/i386/thread_status.h>
#include <sys/ucontext.h>
Expand Down
5 changes: 2 additions & 3 deletions librz/debug/p/native/xnu/xnu_excthreads.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ RZ_IPI bool xnu_modify_trace_bit(RzDebug *dbg, xnu_thread_t *th, int enable) {
}

#elif __POWERPC__ // ppc processor
// XXX poor support at this stage i don't care so much. Once intel and arm done it could be done
// TODO add better support for ppc
RZ_IPI bool xnu_modify_trace_bit(RzDebug *dbg, void *th, int enable) {
// TODO: Implement and test this for ppc too. Below is an old example for reference.
RZ_IPI bool xnu_modify_trace_bit(RzDebug *dbg, xnu_thread_t *th, int enable) {
return false;
}
#if 0
Expand Down
2 changes: 1 addition & 1 deletion librz/debug/p/native/xnu/xnu_threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ RZ_IPI bool rz_xnu_thread_set_drx(RzXnuDebug *ctx, xnu_thread_t *thread) {
#ifndef PPC_DEBUG_STATE32
#define PPC_DEBUG_STATE32 1
#endif
ppc_debug_state_t *regs;
// ppc_debug_state_t *regs;
// thread->flavor = PPC_DEBUG_STATE32;
// thread->count = RZ_MIN (thread->count, sizeof (regs->uds.ds32));
return false;
Expand Down

0 comments on commit 505893b

Please sign in to comment.