mirror of
https://github.com/radareorg/radare2.git
synced 2025-03-01 10:48:05 +00:00
Add support for iOS Simulator dyld caches ##bin
This commit is contained in:
parent
e167df4fda
commit
f1ee89e611
@ -981,11 +981,13 @@ static objc_cache_opt_info *get_objc_opt_info(RBinFile *bf, RDyldCache *cache) {
|
||||
|
||||
ut64 scoffs_offset = 0;
|
||||
ut64 scoffs_size = 0;
|
||||
ut64 optro_offset = 0;
|
||||
ut64 optro_size = 0;
|
||||
ut64 selrefs_offset = 0;
|
||||
ut64 selrefs_size = 0;
|
||||
ut64 const_selrefs_offset = 0;
|
||||
ut64 const_selrefs_size = 0;
|
||||
ut8 remaining = 3;
|
||||
ut8 remaining = 4;
|
||||
ut64 slide = rebase_infos_get_slide (cache);
|
||||
|
||||
struct section_t *section;
|
||||
@ -993,6 +995,14 @@ static objc_cache_opt_info *get_objc_opt_info(RBinFile *bf, RDyldCache *cache) {
|
||||
if (section->size == 0) {
|
||||
continue;
|
||||
}
|
||||
if (strstr (section->name, "__objc_opt_ro")) {
|
||||
optro_offset = va2pa (section->vaddr, cache->n_maps, cache->maps, cache->buf, slide, NULL, NULL);
|
||||
optro_size = section->size;
|
||||
remaining--;
|
||||
if (remaining == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (strstr (section->name, "__objc_scoffs")) {
|
||||
scoffs_offset = va2pa (section->vaddr, cache->n_maps, cache->maps, cache->buf, slide, NULL, NULL);
|
||||
scoffs_size = section->size;
|
||||
@ -1026,9 +1036,17 @@ static objc_cache_opt_info *get_objc_opt_info(RBinFile *bf, RDyldCache *cache) {
|
||||
selrefs_size = const_selrefs_size;
|
||||
}
|
||||
|
||||
ut32 opt_version = 0;
|
||||
if (optro_offset && optro_size > 4) {
|
||||
opt_version = r_buf_read_le32_at (cache->buf, optro_offset);
|
||||
if (opt_version == UT32_MAX) {
|
||||
opt_version = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ut64 sel_string_base = 0;
|
||||
if (!scoffs_offset || scoffs_size < 40) {
|
||||
if (!selrefs_offset || !selrefs_size || cache->n_hdr == 1) {
|
||||
if (!selrefs_offset || !selrefs_size || opt_version < 16) {
|
||||
break;
|
||||
}
|
||||
ut64 cursor = selrefs_offset;
|
||||
@ -1457,7 +1475,8 @@ static RList *classes(RBinFile *bf) {
|
||||
|
||||
if (!klass->name) {
|
||||
if (bf->rbin->verbose) {
|
||||
R_LOG_ERROR ("KLASS failed at 0x%"PFMT64x", is_classlist %d", pointer_to_class, is_classlist);
|
||||
R_LOG_ERROR ("KLASS failed at 0x%"PFMT64x" [pa 0x%"PFMT64x" va 0x%"PFMT64x"], is_classlist %d",
|
||||
pointer_to_class, cursor - pointers + offset, cursor - pointers + section->vaddr, is_classlist);
|
||||
}
|
||||
char *kname = r_str_newf ("UnnamedClass%u", num_of_unnamed_class);
|
||||
klass->name = r_bin_name_new (kname);
|
||||
|
@ -305,8 +305,12 @@ static bool r_io_dsc_object_dig_slices(RIODscObject * dsc) {
|
||||
ut8 sym_uuid[16];
|
||||
bool has_symbols_file = dsc_header_get_field (header, "symbolFileUUID", sym_uuid, 16) && !is_null_uuid (sym_uuid);
|
||||
if (subCacheArrayCount == 0 && !has_symbols_file) {
|
||||
R_LOG_ERROR ("Please open the first file of the cache");
|
||||
goto error;
|
||||
const char * slash = strrchr (dsc->filename, '/');
|
||||
const char * dot = strrchr (dsc->filename, '.');
|
||||
if (dot && slash && dot > slash) {
|
||||
R_LOG_WARN ("Please open the first file of the cache");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
if (lseek (fd, next_or_end, SEEK_SET) >= 0) {
|
||||
@ -323,13 +327,17 @@ static bool r_io_dsc_object_dig_slices(RIODscObject * dsc) {
|
||||
ut64 sc_entry_size;
|
||||
RDscSubcacheFormat sc_format = SUBCACHE_FORMAT_UNDEFINED;
|
||||
|
||||
if (!r_io_dsc_detect_subcache_format(fd, subCacheArrayOffset, subCacheArrayCount, next_or_end, &sc_entry_size, &sc_format)) {
|
||||
R_LOG_ERROR ("Could not detect subcache entry format");
|
||||
goto error;
|
||||
}
|
||||
if (sc_format == SUBCACHE_FORMAT_UNDEFINED) {
|
||||
R_LOG_ERROR ("Ambiguous or unsupported subcache entry format");
|
||||
goto error;
|
||||
if (subCacheArrayCount) {
|
||||
if (!r_io_dsc_detect_subcache_format(fd, subCacheArrayOffset, subCacheArrayCount, next_or_end, &sc_entry_size, &sc_format)) {
|
||||
R_LOG_ERROR ("Could not detect subcache entry format");
|
||||
goto error;
|
||||
}
|
||||
if (sc_format == SUBCACHE_FORMAT_UNDEFINED) {
|
||||
R_LOG_ERROR ("Ambiguous or unsupported subcache entry format");
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
sc_entry_size = 0;
|
||||
}
|
||||
|
||||
ut64 cursor = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user