需求: @rpath 动态注入的库,无法读取到,请问有什么方法可以查看
fseek(fp, top, SEEK_SET);
struct mach_header_64 mach;
fread(&mach, sizeof(struct mach_header_64), 1, fp);
struct load_command exist_cmd;
struct dylib_command orig_dyld;
char orig_dyld_name[1024];
for (int i=0; i<mach.ncmds; i++) {
fread(&exist_cmd, sizeof(struct load_command), 1, fp);
if (exist_cmd.cmd == LC_LOAD_DYLIB) {
fseek(fp, -sizeof(struct load_command), SEEK_CUR);
fread(&orig_dyld, sizeof(struct dylib_command), 1, fp);
fseek(fp, orig_dyld.dylib.name.offset - sizeof(struct dylib_command), SEEK_CUR);
fread(orig_dyld_name, 1024, 1, fp);
printf("%s\n",orig_dyld_name);
fseek(fp,-1024, SEEK_CUR);
fseek(fp, orig_dyld.cmdsize-sizeof(struct dylib_command), SEEK_CUR);
continue;
// }
fseek(fp, exist_cmd.cmdsize-sizeof(struct load_command), SEEK_CUR);
}