Fix iOS build regression

This commit is contained in:
pancake 2021-06-21 01:18:57 +02:00
parent 0d9322eb09
commit 57a9bfd9da
6 changed files with 25 additions and 13 deletions

View File

@ -47,7 +47,7 @@ endif
endif
all: plugins.cfg libr/include/r_version.h
libr/count.sh reset
@libr/count.sh reset
${MAKE} -C shlr sdbs
${MAKE} -C shlr/zip
${MAKE} -C libr/util

View File

@ -1427,20 +1427,24 @@ static bool arm64_hwbp_del (RDebug *dbg, RBreakpoint *bp, RBreakpointItem *b) {
* we let the caller handle the work.
*/
static int r_debug_native_bp(RBreakpoint *bp, RBreakpointItem *b, bool set) {
RDebug *dbg = bp->user;
if (b && b->hw) {
#if __i386__ || __x86_64__
RDebug *dbg = bp->user;
return set
? drx_add (dbg, bp, b)
: drx_del (dbg, bp, b);
#elif (__arm64__ || __aarch64__) && __linux__
RDebug *dbg = bp->user;
return set
? arm64_hwbp_add (dbg, bp, b)
: arm64_hwbp_del (dbg, bp, b);
#elif __arm__ && __linux__
RDebug *dbg = bp->user;
return set
? arm32_hwbp_add (dbg, bp, b)
: arm32_hwbp_del (dbg, bp, b);
#else
#warning r_debug_native_bp not implemented for this platform
#endif
}
return false;
@ -1448,6 +1452,9 @@ static int r_debug_native_bp(RBreakpoint *bp, RBreakpointItem *b, bool set) {
#if __APPLE__
#if TARGET_OS_IPHONE || __POWERPC__
// nothing to do
#else
static int getMaxFiles(void) {
struct rlimit limit;
if (getrlimit (RLIMIT_NOFILE, &limit) != 0) {
@ -1455,6 +1462,7 @@ static int getMaxFiles(void) {
}
return limit.rlim_cur;
}
#endif
static RList *xnu_desc_list (int pid) {
#if TARGET_OS_IPHONE || __POWERPC__

View File

@ -667,8 +667,9 @@ static void get_mach_header_sizes(size_t *mach_header_sz,
// XXX: What about arm?
}
#if __ppc64__ || __x86_64__|| __i386__ || __ppc__ || __POWERPC__
// XXX: This function could use less function calls, but works.
static cpu_type_t xnu_get_cpu_type (pid_t pid) {
static cpu_type_t xnu_get_cpu_type(pid_t pid) {
int mib[CTL_MAXNAME];
size_t len = CTL_MAXNAME;
cpu_type_t cpu_type;
@ -696,9 +697,9 @@ static cpu_subtype_t xnu_get_cpu_subtype (void) {
return subtype;
}
#endif
static void xnu_build_corefile_header (vm_offset_t header,
int segment_count, int thread_count, int command_size, pid_t pid) {
static void xnu_build_corefile_header(vm_offset_t header, int segment_count, int thread_count, int command_size, pid_t pid) {
#if __ppc64__ || __x86_64__
struct mach_header_64 *mh64;
mh64 = (struct mach_header_64 *)header;
@ -718,6 +719,8 @@ static void xnu_build_corefile_header (vm_offset_t header,
mh->filetype = MH_CORE;
mh->ncmds = segment_count + thread_count;
mh->sizeofcmds = command_size;
#else
#warning xnu_build_corefile_header not implemented for this platform
#endif
}

View File

@ -112,7 +112,6 @@ static bool is_thumb_32(ut16 op) {
#endif
static int modify_trace_bit(RDebug *dbg, xnu_thread_t *th, int enable) {
int i = 0;
int ret = xnu_thread_get_drx (dbg, th);
if (!ret) {
eprintf ("error to get drx registers modificy_trace_bit arm\n");
@ -135,6 +134,7 @@ static int modify_trace_bit(RDebug *dbg, xnu_thread_t *th, int enable) {
}
} else
#elif __arm || __arm__ || __armv7 || __armv7__
int i = 0;
if (th->flavor == ARM_DEBUG_STATE) {
arm_debug_state_t *state = &th->debug.drx;
R_REG_T *regs;
@ -164,10 +164,11 @@ static int modify_trace_bit(RDebug *dbg, xnu_thread_t *th, int enable) {
if (regs->ts_32.__cpsr & 0x20) {
ut16 op;
// Thumb breakpoint
if (regs->ts_32.__pc & 2)
if (regs->ts_32.__pc & 2) {
state->__bcr[i] |= BAS_IMVA_2_3;
else
} else {
state->__bcr[i] |= BAS_IMVA_0_1;
}
if (bio->read_at (bio->io, regs->ts_32.__pc, (void *)&op, 2) < 1) {
eprintf ("Failed to read opcode modify_trace_bit\n");
return false;
@ -224,8 +225,9 @@ static bool xnu_restore_exception_ports (int pid) {
kern_return_t kr;
int i;
task_t task = pid_to_task (pid);
if (!task)
if (!task) {
return false;
}
for (i = 0; i < ex.count; i++) {
kr = task_set_exception_ports (task, ex.masks[i], ex.ports[i],
ex.behaviors[i], ex.flavors[i]);

View File

@ -377,8 +377,7 @@ static void r_print_format_char(const RPrint* p, int endian, int mode,
}
}
static void r_print_format_decchar(const RPrint* p, int endian, int mode,
const char *setval, ut64 seeki, ut8* buf, int i, int size) {
static void r_print_format_decchar(const RPrint* p, int endian, int mode, const char *setval, ut64 seeki, ut8* buf, int i, int size) {
int elem = -1;
if (size >= ARRAYINDEX_COEF) {
elem = size/ARRAYINDEX_COEF-1;

View File

@ -114,10 +114,10 @@ $(SDB_HOST):
$(MAKE) sdb-host HOST_CC=$(HOST_CC) CC=$(HOST_CC)
$(SDB_LIBA):
$(MAKE) sdb-target RANLIB=$(RANLIB)
$(MAKE) sdb-target RANLIB="$(RANLIB)"
sdbs: $(SDB_HOST)
$(MAKE) $(SDB_LIBA) RANLIB=$(RANLIB)
$(MAKE) $(SDB_LIBA) RANLIB="$(RANLIB)"
sdb-host:
@echo