Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

something

  • Loading branch information...
commit b0d35b9b292227990fc1e9061e946342a7670120 1 parent 5649981
comex authored
2  Makefile.common
View
@@ -14,7 +14,7 @@ ifneq "$(NDEBUG)" "1"
override CFLAGS += -g3
endif
-SDK_GCC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/ -miphoneos-version-min=4.0 -mapcs-frame -fomit-frame-pointer -mthumb
+SDK_GCC = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 -isysroot $(lastword $(wildcard /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk)) -miphoneos-version-min=4.0 -mapcs-frame -fomit-frame-pointer -mthumb
GCC_native = gcc
GCC_mp = gcc-mp-4.6
8 binary.c
View
@@ -37,7 +37,7 @@ inline prange_t rangeconv(range_t range, int flags) {
}
return rangeconv_off((range_t) {range.binary, offset, range.size}, flags);
} else if(flags & MUST_FIND) {
- die("range (%08x, %zx) not valid", range.start, range.size);
+ die("range (%08llx, %zx) not valid", (uint64_t) range.start, range.size);
} else {
return (prange_t) {NULL, 0};
}
@@ -53,7 +53,7 @@ inline prange_t rangeconv_off(range_t range, int flags) {
pr.size = range.size;
if(!prange_check(range.binary, pr)) {
if(flags & MUST_FIND) {
- die("offset range (%08x, %zx) not valid", range.start, range.size);
+ die("offset range (%08llx, %zx) not valid", (uint64_t) range.start, range.size);
} else {
return (prange_t) {NULL, 0};
}
@@ -70,7 +70,7 @@ range_t range_to_off_range(range_t range, int flags) {
return (range_t) {range.binary, offset, range.size};
}
if(flags & MUST_FIND) {
- die("range (%08x, %zx) not valid", range.start, range.size);
+ die("range (%08llx, %zx) not valid", (uint64_t) range.start, range.size);
} else {
return (range_t) {NULL, 0, 0};
}
@@ -82,7 +82,7 @@ range_t off_range_to_range(range_t range, int flags) {
return (range_t) {range.binary, address, range.size};
}
if(flags & MUST_FIND) {
- die("offset range (%08x, %zx) not valid", range.start, range.size);
+ die("offset range (%08llx, %zx) not valid", (uint64_t) range.start, range.size);
} else {
return (range_t) {NULL, 0, 0};
}
1  binary.h
View
@@ -12,6 +12,7 @@
#define EXTEND_RANGE 16
// for find_string
#define PRECEDING_ZERO 32
+#define TRAILING_ZERO 64
struct dyld_cache_header;
struct shared_file_mapping_np;
2  common.c
View
@@ -70,7 +70,7 @@ addr_t parse_hex_addr(const char *string) {
char *end;
addr_t result = (addr_t) strtoll(string, &end, 16);
if(!*string || *end) {
- die("invalid hex value %x", string);
+ die("invalid hex value %s", string);
}
return result;
}
3  common.h
View
@@ -67,7 +67,8 @@ void store_file(prange_t range, const char *filename, mode_t mode);
addr_t parse_hex_addr(const char *string);
-__attribute__((noreturn)) void _die(const char *fmt, ...);
+__attribute__((noreturn, format(printf, 1, 2)))
+void _die(const char *fmt, ...);
#if defined(__APPLE__) && __DARWIN_C_LEVEL < 200809L
static inline size_t strnlen(const char *s, size_t n) {
19 find.c
View
@@ -66,7 +66,7 @@ static addr_t find_data_raw(range_t range, int16_t *buf, ssize_t pattern_size, s
goto keep_going; \
} \
if(foundit) { \
- die("found [%s] multiple times in range: first at %08x then at %08x", name, foundit, new_match); \
+ die("found [%s] multiple times in range: first at %08llx then at %08llx", name, (uint64_t) foundit, (uint64_t) new_match); \
} \
foundit = new_match; \
if(align) { \
@@ -105,7 +105,7 @@ static addr_t find_data_raw(range_t range, int16_t *buf, ssize_t pattern_size, s
if(foundit) {
return foundit + offset;
} else if(options & MUST_FIND) {
- die("didn't find [%s] in range (%x, %zx)", name, range.start, range.size);
+ die("didn't find [%s] in range (%08llx, %zx)", name, (uint64_t) range.start, range.size);
} else {
return 0;
}
@@ -153,7 +153,8 @@ addr_t find_string(range_t range, const char *string, int align, int options) {
buf[i+1] = (uint8_t) string[i];
}
bool pz = options & PRECEDING_ZERO;
- addr_t result = find_data_raw(range, pz ? buf : buf + 1, pz ? len + 2 : len + 1, pz ? 1 : 0, align, options, string);
+ bool tz = options & TRAILING_ZERO;
+ addr_t result = find_data_raw(range, pz ? buf : buf + 1, len + tz + pz, pz ? 1 : 0, align, options, string);
return result;
}
@@ -186,7 +187,7 @@ addr_t find_int32(range_t range, uint32_t number, int options) {
addr_t find_bof(range_t range, addr_t eof, int is_thumb) {
addr_t start = eof & ~1;
if(start - range.start >= range.size) {
- die("out of range: %x", eof);
+ die("out of range: %llx", (uint64_t) eof);
}
uint8_t *p = rangeconv(range, MUST_FIND).start + (start - range.start);
@@ -202,7 +203,7 @@ addr_t find_bof(range_t range, addr_t eof, int is_thumb) {
}
}
- die("couldn't find the beginning of %08x", eof);
+ die("couldn't find the beginning of %08llx", (uint64_t) eof);
}
uint32_t resolve_ldr(const struct binary *binary, addr_t addr) {
@@ -215,14 +216,14 @@ uint32_t resolve_ldr(const struct binary *binary, addr_t addr) {
} else if((val & 0xffff) == 0xf8df) { // thumb-2
target = base + ((val & 0x0fff0000) >> 16);
} else {
- die("weird thumb instruction %08x at %08x", val, addr);
+ die("weird thumb instruction %08x at %08llx", val, (uint64_t) addr);
}
} else {
addr_t base = addr + 8;
if((val & 0x0fff0000) == 0x59f0000) { // arm
target = base + (val & 0xfff);
} else {
- die("weird ARM instruction %08x at %08x", val, addr);
+ die("weird ARM instruction %08x at %08llx", val, (uint64_t) addr);
}
}
return b_read32(binary, target);
@@ -454,7 +455,7 @@ void findmany_go(struct findmany *fm) {
struct pattern *pat = &fm->patterns[p];
addr_t result = ptr - pat->pattern_size - start + fm->range.start + 1;
if(*pat->result) {
- die("found [%s] multiple times in range: first at %08x then at %08x", pat->name, *pat->result, result);
+ die("found [%s] multiple times in range: first at %08llx then at %08llx", pat->name, (uint64_t) *pat->result, (uint64_t) result);
}
*pat->result = result + pat->offset;
}
@@ -470,7 +471,7 @@ void findmany_go(struct findmany *fm) {
for(int p = 0; p < fm->num_patterns; p++) {
struct pattern *pat = &fm->patterns[p];
if(!*pat->result) {
- die("didn't find [%s] in range(%x, %zx)", pat->name, fm->range.start, fm->range.size);
+ die("didn't find [%s] in range(%llx, %zx)", pat->name, (uint64_t) fm->range.start, fm->range.size);
}
}
2  ios-classify.h
View
@@ -18,7 +18,7 @@ static unsigned int _50 = 3;
static unsigned int classify(const struct binary *binary) {
if(!is_armv7(binary)) return _armv6;
- else if(b_sym(binary, "_buf_attr", 0)) return _50;
+ else if(b_sym(binary, "_mach_gss_hold_cred", 0)) return _50;
else if(b_sym(binary, "_vfs_getattr", 0)) return _43;
else return _armv7;
}
2  mach-o/binary.c
View
@@ -229,7 +229,7 @@ void *b_macho_nth_symbol(const struct binary *binary, uint32_t n) {
die("no symbol table");
}
if(n >= binary->mach->nsyms) {
- die("sym too high: %u", sym);
+ die("sym too high: %u", n);
}
MACHO_SPECIALIZE_POINTER_SIZE(binary,
nlist_x *nl = binary->mach->symtab + n * sizeof(*nl);
2  mach-o/inject.c
View
@@ -566,7 +566,7 @@ void b_inject_macho_binary(struct binary *target, const struct binary *binary, a
uint32_t stub_size = (uint32_t) ((sizeof(part1) + 4) * num_init_ptrs + sizeof(part2) + bytes_to_move + sizeof(part3) + 4);
if(!(hack_func & 1)) {
- die("hack func 0x%x is not thumb", hack_func);
+ die("hack func 0x%llx is not thumb", (uint64_t) hack_func);
}
struct segment_command *newseg = ADD_COMMAND(sizeof(struct segment_command));
2  mach-o/link.c
View
@@ -440,7 +440,7 @@ void b_relocate(struct binary *load, const struct binary *target, enum reloc_mod
struct data_segment *b = &target->segments[j];
addr_t diff = b->vm_range.start - (a->vm_range.start + slide);
if(diff < a->vm_range.size || -diff < b->vm_range.size) {
- die("segments of load and target overlap; load:%x+%zu target:%x+%zu", a->vm_range.start, a->vm_range.size, b->vm_range.start, b->vm_range.size);
+ die("segments of load and target overlap; load:%llx+%zu target:%llx+%zu", (uint64_t) a->vm_range.start, a->vm_range.size, (uint64_t) b->vm_range.start, b->vm_range.size);
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.