Lines Matching refs:info

93 cl::opt<bool> Rebase("rebase", cl::desc("Display mach-o rebasing info"),
96 cl::opt<bool> Bind("bind", cl::desc("Display mach-o binding info"),
100 cl::desc("Display mach-o lazy binding info"),
104 cl::desc("Display mach-o weak binding info"),
109 cl::desc("Print line information from debug info if available"),
113 cl::desc("Use .dSYM file for debug info"),
152 cl::opt<bool> InfoPlist("info-plist",
153 cl::desc("Print the info plist section as strings for "
170 cl::desc("Print the info for Mach-O objects in "
574 case MachO::GENERIC_RELOC_PAIR: // prints no info
1911 // the file name and header info and then processes it according to the
1917 // info. And don't print it otherwise like in the case of printing the
2565 // The block of info used by the Symbolizer call backs.
2602 struct DisassembleInfo *info = (struct DisassembleInfo *)DisInfo;
2613 if (TagType != 1 || !info->verbose)
2616 unsigned int Arch = info->O->getArch();
2620 if (info->O->getHeader().filetype != MachO::MH_OBJECT) {
2629 uint32_t sect_addr = info->S.getAddress();
2638 for (const RelocationRef &Reloc : info->S.relocations()) {
2642 RE = info->O->getRelocation(Rel);
2643 r_type = info->O->getAnyRelocationType(RE);
2644 r_scattered = info->O->isRelocationScattered(RE);
2646 r_value = info->O->getScatteredRelocationValue(RE);
2650 info->O->moveRelocationNext(RelNext);
2652 RENext = info->O->getRelocation(RelNext);
2653 if (info->O->isRelocationScattered(RENext))
2654 pair_r_value = info->O->getScatteredRelocationValue(RENext);
2659 isExtern = info->O->getPlainRelocationExternal(RE);
2672 unwrapOrError(Symbol.getName(), info->O->getFileName()).data();
2679 const char *add = GuessSymbolName(r_value, info->AddrMap);
2680 const char *sub = GuessSymbolName(pair_r_value, info->AddrMap);
2703 if (info->O->getHeader().filetype != MachO::MH_OBJECT) {
2710 for (const RelocationRef &Reloc : info->O->external_relocations()) {
2714 RE = info->O->getRelocation(Rel);
2716 isExtern = info->O->getPlainRelocationExternal(RE);
2729 if (info->O->getAnyRelocationPCRel(RE))
2732 unwrapOrError(Symbol.getName(), info->O->getFileName()).data();
2741 uint64_t sect_addr = info->S.getAddress();
2748 for (const RelocationRef &Reloc : info->S.relocations()) {
2752 RE = info->O->getRelocation(Rel);
2754 isExtern = info->O->getPlainRelocationExternal(RE);
2767 if (info->O->getAnyRelocationPCRel(RE))
2770 unwrapOrError(Symbol.getName(), info->O->getFileName()).data();
2771 unsigned Type = info->O->getAnyRelocationType(RE);
2774 info->O->moveRelocationNext(RelNext);
2775 MachO::any_relocation_info RENext = info->O->getRelocation(RelNext);
2776 unsigned TypeNext = info->O->getAnyRelocationType(RENext);
2777 bool isExternNext = info->O->getPlainRelocationExternal(RENext);
2778 unsigned SymbolNum = info->O->getPlainRelocationSymbolNum(RENext);
2782 symbol_iterator RelocSymNext = info->O->getSymbolByIndex(SymbolNum);
2784 name = unwrapOrError(Symbol.getName(), info->O->getFileName()).data();
2798 if (info->O->getHeader().filetype != MachO::MH_OBJECT) {
2807 uint32_t sect_addr = info->S.getAddress();
2816 find_if(info->S.relocations(), [&](const RelocationRef &Reloc) {
2821 if (Reloc == info->S.relocations().end())
2825 RE = info->O->getRelocation(Rel);
2826 r_length = info->O->getAnyRelocationLength(RE);
2827 r_scattered = info->O->isRelocationScattered(RE);
2829 r_value = info->O->getScatteredRelocationValue(RE);
2830 r_type = info->O->getScatteredRelocationType(RE);
2832 r_type = info->O->getAnyRelocationType(RE);
2833 isExtern = info->O->getPlainRelocationExternal(RE);
2844 info->O->moveRelocationNext(RelNext);
2846 RENext = info->O->getRelocation(RelNext);
2847 other_half = info->O->getAnyRelocationAddress(RENext) & 0xffff;
2848 if (info->O->isRelocationScattered(RENext))
2849 pair_r_value = info->O->getScatteredRelocationValue(RENext);
2854 unwrapOrError(Symbol.getName(), info->O->getFileName()).data();
2899 const char *add = GuessSymbolName(r_value, info->AddrMap);
2900 const char *sub = GuessSymbolName(pair_r_value, info->AddrMap);
2924 const char *add = GuessSymbolName(value, info->AddrMap);
2935 if (info->O->getHeader().filetype != MachO::MH_OBJECT) {
2944 uint64_t sect_addr = info->S.getAddress();
2947 find_if(info->S.relocations(), [&](const RelocationRef &Reloc) {
2952 if (Reloc == info->S.relocations().end())
2956 MachO::any_relocation_info RE = info->O->getRelocation(Rel);
2957 uint32_t r_type = info->O->getAnyRelocationType(RE);
2960 info->O->moveRelocationNext(RelNext);
2961 MachO::any_relocation_info RENext = info->O->getRelocation(RelNext);
2963 value = info->O->getPlainRelocationSymbolNum(RENext);
2968 if (!info->O->getPlainRelocationExternal(RE))
2971 unwrapOrError(Reloc->getSymbol()->getName(), info->O->getFileName())
3015 struct DisassembleInfo *info) {
3016 for (const auto &Load : info->O->load_commands()) {
3018 MachO::segment_command_64 Seg = info->O->getSegment64LoadCommand(Load);
3020 MachO::section_64 Sec = info->O->getSection64(Load, J);
3027 StringRef MachOContents = info->O->getData();
3039 MachO::segment_command Seg = info->O->getSegmentLoadCommand(Load);
3041 MachO::section Sec = info->O->getSection(Load, J);
3048 StringRef MachOContents = info->O->getData();
3069 struct DisassembleInfo *info) {
3070 MachO::dysymtab_command Dysymtab = info->O->getDysymtabLoadCommand();
3071 MachO::symtab_command Symtab = info->O->getSymtabLoadCommand();
3072 for (const auto &Load : info->O->load_commands()) {
3074 MachO::segment_command_64 Seg = info->O->getSegment64LoadCommand(Load);
3076 MachO::section_64 Sec = info->O->getSection64(Load, J);
3095 info->O->getIndirectSymbolTableEntry(Dysymtab, index);
3097 symbol_iterator Sym = info->O->getSymbolByIndex(indirect_symbol);
3098 return unwrapOrError(Sym->getName(), info->O->getFileName())
3105 MachO::segment_command Seg = info->O->getSegmentLoadCommand(Load);
3107 MachO::section Sec = info->O->getSection(Load, J);
3126 info->O->getIndirectSymbolTableEntry(Dysymtab, index);
3128 symbol_iterator Sym = info->O->getSymbolByIndex(indirect_symbol);
3129 return unwrapOrError(Sym->getName(), info->O->getFileName())
3144 // into the method field of the info and any previous string is free'ed.
3145 // Then the class_name field in the info is set to nullptr. The method call
3149 static void method_reference(struct DisassembleInfo *info,
3152 unsigned int Arch = info->O->getArch();
3155 if (info->selector_name != nullptr) {
3156 if (info->class_name != nullptr) {
3157 info->method = std::make_unique<char[]>(
3158 5 + strlen(info->class_name) + strlen(info->selector_name));
3159 char *method = info->method.get();
3162 strcat(method, info->class_name);
3164 strcat(method, info->selector_name);
3170 info->method =
3171 std::make_unique<char[]>(9 + strlen(info->selector_name));
3172 char *method = info->method.get();
3180 strcat(method, info->selector_name);
3186 info->class_name = nullptr;
3189 if (info->selector_name != nullptr) {
3190 info->method =
3191 std::make_unique<char[]>(17 + strlen(info->selector_name));
3192 char *method = info->method.get();
3200 strcat(method, info->selector_name);
3205 info->class_name = nullptr;
3216 struct DisassembleInfo *info,
3223 for (const auto &Load : info->O->load_commands()) {
3225 MachO::segment_command_64 Seg = info->O->getSegment64LoadCommand(Load);
3227 MachO::section_64 Sec = info->O->getSection64(Load, J);
3237 StringRef MachOContents = info->O->getData();
3244 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
3256 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
3279 DisassembleInfo *info,
3284 for (unsigned SectIdx = 0; SectIdx != info->Sections->size(); SectIdx++) {
3285 uint64_t SectAddress = ((*(info->Sections))[SectIdx]).getAddress();
3286 uint64_t SectSize = ((*(info->Sections))[SectIdx]).getSize();
3292 ((*(info->Sections))[SectIdx]).getName();
3298 DataRefImpl Ref = ((*(info->Sections))[SectIdx]).getRawDataRefImpl();
3299 StringRef SegName = info->O->getSectionFinalSegmentName(Ref);
3304 S = (*(info->Sections))[SectIdx];
3308 ((*(info->Sections))[SectIdx]).getContents(), info->O->getFileName());
3317 DisassembleInfo *info,
3319 return get_pointer_64(Address, offset, left, S, info, objc_only);
3326 // symbol is passed, look up that address in the info's AddrMap.
3328 DisassembleInfo *info, uint64_t &n_value,
3331 if (!info->verbose)
3344 RE = info->O->getRelocation(Rel);
3345 if (info->O->isRelocationScattered(RE))
3347 isExtern = info->O->getPlainRelocationExternal(RE);
3362 StringRef Name = unwrapOrError(Symbol.getName(), info->O->getFileName());
3380 SymbolName = GuessSymbolName(ReferenceValue, info->AddrMap);
3386 DisassembleInfo *info,
3389 return get_symbol_64(sect_offset, S, info, n_value64, ReferenceValue);
3635 int32_t info;
3643 #define CLS_GETINFO(cls, infomask) ((cls)->info & (infomask))
3918 sys::swapByteOrder(objc_class.info);
3978 struct DisassembleInfo *info);
3987 struct DisassembleInfo *info) {
3996 r = get_pointer_64(ReferenceValue, offset, left, S, info);
4000 const char *symbol_name = get_symbol_64(offset, S, info, n_value);
4012 r = get_pointer_64(pointer_value, offset, left, S, info);
4017 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4021 r = get_pointer_64(c.data, offset, left, S, info);
4026 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4030 const char *name = get_pointer_64(cro.name, offset, left, S, info);
4037 struct DisassembleInfo *info) {
4044 r = get_pointer_64(ReferenceValue, offset, left, S, info);
4048 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4053 offset + offsetof(struct cfstring64_t, characters), S, info, n_value);
4059 name = get_pointer_64(cfs_characters, offset, left, S, info);
4071 struct DisassembleInfo *info) {
4075 const char *r = get_pointer_64(ReferenceValue, offset, left, S, info);
4079 const char *symbol_name = get_symbol_64(offset, S, info, n_value);
4105 MachOObjectFile *O, struct DisassembleInfo *info,
4106 void (*func)(uint64_t, struct DisassembleInfo *info)) {
4138 const char *name = get_symbol_64(i, S, info, n_value, p);
4140 name = get_dyld_bind_info_symbolname(S.getAddress() + i, info);
4154 func(p, info);
4160 MachOObjectFile *O, struct DisassembleInfo *info,
4161 void (*func)(uint32_t, struct DisassembleInfo *info)) {
4188 const char *name = get_symbol_32(i, S, info, p);
4194 func(p, info);
4210 static void print_layout_map64(uint64_t p, struct DisassembleInfo *info) {
4217 layout_map = get_pointer_64(p, offset, left, S, info);
4221 static void print_layout_map32(uint32_t p, struct DisassembleInfo *info) {
4228 layout_map = get_pointer_32(p, offset, left, S, info);
4232 static void print_method_list64_t(uint64_t p, struct DisassembleInfo *info,
4242 r = get_pointer_64(p, offset, left, S, info);
4251 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4259 r = get_pointer_64(p, offset, left, S, info);
4268 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4273 info, n_value, m.name);
4275 if (info->verbose && sym_name != nullptr)
4283 name = get_pointer_64(m.name + n_value, xoffset, left, xS, info);
4290 info, n_value, m.types);
4292 if (info->verbose && sym_name != nullptr)
4300 name = get_pointer_64(m.types + n_value, xoffset, left, xS, info);
4306 name = get_symbol_64(offset + offsetof(struct method64_t, imp), S, info,
4308 if (info->verbose && name == nullptr) {
4325 static void print_method_list32_t(uint64_t p, struct DisassembleInfo *info,
4333 r = get_pointer_32(p, offset, left, S, info);
4342 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4350 r = get_pointer_32(p, offset, left, S, info);
4359 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4363 name = get_pointer_32(m.name, xoffset, left, xS, info);
4369 name = get_pointer_32(m.types, xoffset, left, xS, info);
4375 name = get_symbol_32(offset + offsetof(struct method32_t, imp), S, info,
4386 static bool print_method_list(uint32_t p, struct DisassembleInfo *info) {
4394 r = get_pointer_32(p, offset, left, S, info, true);
4406 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4421 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4426 if (info->verbose) {
4427 name = get_pointer_32(method.method_name, offset, xleft, S, info, true);
4437 if (info->verbose) {
4438 name = get_pointer_32(method.method_types, offset, xleft, S, info, true);
4448 if (info->verbose) {
4449 SymbolName = GuessSymbolName(method.method_imp, info->AddrMap);
4458 static void print_protocol_list64_t(uint64_t p, struct DisassembleInfo *info) {
4467 r = get_pointer_64(p, offset, left, S, info);
4476 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4483 r = get_pointer_64(p, offset, left, S, info);
4492 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4496 sym_name = get_symbol_64(offset, S, info, n_value, q);
4498 if (info->verbose && sym_name != nullptr)
4508 r = get_pointer_64(q + n_value, offset, left, S, info);
4517 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4524 info, n_value, pc.name);
4526 if (info->verbose && sym_name != nullptr)
4534 name = get_pointer_64(pc.name + n_value, xoffset, left, xS, info);
4544 S, info, n_value, pc.instanceMethods);
4546 if (info->verbose && sym_name != nullptr)
4556 print_method_list64_t(pc.instanceMethods + n_value, info, "\t");
4561 info, n_value, pc.classMethods);
4563 if (info->verbose && sym_name != nullptr)
4573 print_method_list64_t(pc.classMethods + n_value, info, "\t");
4587 static void print_protocol_list32_t(uint32_t p, struct DisassembleInfo *info) {
4596 r = get_pointer_32(p, offset, left, S, info);
4605 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4612 r = get_pointer_32(p, offset, left, S, info);
4621 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4625 r = get_pointer_32(q, offset, left, S, info);
4634 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4638 name = get_pointer_32(pc.name, xoffset, left, xS, info);
4647 print_method_list32_t(pc.instanceMethods, info, "\t");
4651 print_method_list32_t(pc.classMethods, info, "\t");
4677 struct DisassembleInfo *info) {
4685 r = get_pointer_32(p, offset, left, S, info, true);
4698 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4715 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4720 if (info->verbose) {
4721 name = get_pointer_32(md.name, offset, xleft, S, info, true);
4731 if (info->verbose) {
4732 name = get_pointer_32(md.types, offset, xleft, S, info, true);
4744 struct DisassembleInfo *info);
4747 struct DisassembleInfo *info) {
4753 r = get_pointer_32(p, offset, left, S, info, true);
4766 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4776 if (info->verbose) {
4777 name = get_pointer_32(protocol.protocol_name, offset, left, S, info, true);
4788 if (print_protocol_list(protocol.protocol_list, indent + 4, info))
4794 if (print_method_description_list(protocol.instance_methods, indent, info))
4800 if (print_method_description_list(protocol.class_methods, indent, info))
4807 struct DisassembleInfo *info) {
4814 r = get_pointer_32(p, offset, left, S, info, true);
4826 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4842 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4847 if (print_protocol(l, indent, info))
4853 static void print_ivar_list64_t(uint64_t p, struct DisassembleInfo *info) {
4862 r = get_pointer_64(p, offset, left, S, info);
4871 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4879 r = get_pointer_64(p, offset, left, S, info);
4888 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4893 info, n_value, i.offset);
4895 if (info->verbose && sym_name != nullptr)
4903 ivar_offset_p = get_pointer_64(i.offset + n_value, xoffset, left, xS, info);
4906 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4913 sym_name = get_symbol_64(offset + offsetof(struct ivar64_t, name), S, info,
4916 if (info->verbose && sym_name != nullptr)
4924 name = get_pointer_64(i.name + n_value, xoffset, left, xS, info);
4930 sym_name = get_symbol_64(offset + offsetof(struct ivar64_t, type), S, info,
4932 name = get_pointer_64(i.type + n_value, xoffset, left, xS, info);
4934 if (info->verbose && sym_name != nullptr)
4954 static void print_ivar_list32_t(uint32_t p, struct DisassembleInfo *info) {
4963 r = get_pointer_32(p, offset, left, S, info);
4972 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4980 r = get_pointer_32(p, offset, left, S, info);
4989 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
4993 ivar_offset_p = get_pointer_32(i.offset, xoffset, left, xS, info);
4996 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
5003 name = get_pointer_32(i.name, xoffset, left, xS, info);
5009 name = get_pointer_32(i.type, xoffset, left, xS, info);
5023 struct DisassembleInfo *info) {
5032 r = get_pointer_64(p, offset, left, S, info);
5041 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
5049 r = get_pointer_64(p, offset, left, S, info);
5058 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
5063 info, n_value, op.name);
5065 if (info->verbose && sym_name != nullptr)
5073 name = get_pointer_64(op.name + n_value, xoffset, left, xS, info);
5081 info, n_value, op.attributes);
5083 if (info->verbose && sym_name != nullptr)
5091 name = get_pointer_64(op.attributes + n_value, xoffset, left, xS, info);
5102 struct DisassembleInfo *info) {
5110 r = get_pointer_32(p, offset, left, S, info);
5119 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
5127 r = get_pointer_32(p, offset, left, S, info);
5136 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
5140 name = get_pointer_32(op.name, xoffset, left, xS, info);
5146 name = get_pointer_32(op.attributes, xoffset, left, xS, info);
5156 static bool print_class_ro64_t(uint64_t p, struct DisassembleInfo *info,
5165 r = get_pointer_64(p, offset, left, S, info);
5169 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
5185 print_layout_map64(cro.ivarLayout, info);
5189 info, n_value, cro.name);
5191 if (info->verbose && sym_name != nullptr)
5199 name = get_pointer_64(cro.name + n_value, xoffset, left, xS, info);
5206 S, info, n_value, cro.baseMethods);
5208 if (info->verbose && sym_name != nullptr)
5218 print_method_list64_t(cro.baseMethods + n_value, info, "");
5223 info, n_value, cro.baseProtocols);
5225 if (info->verbose && sym_name != nullptr)
5235 print_protocol_list64_t(cro.baseProtocols + n_value, info);
5239 info, n_value, cro.ivars);
5241 if (info->verbose && sym_name != nullptr)
5251 print_ivar_list64_t(cro.ivars + n_value, info);
5256 info, n_value, cro.weakIvarLayout);
5258 if (info->verbose && sym_name != nullptr)
5267 print_layout_map64(cro.weakIvarLayout + n_value, info);
5272 info, n_value, cro.baseProperties);
5274 if (info->verbose && sym_name != nullptr)
5284 print_objc_property_list64(cro.baseProperties + n_value, info);
5290 static bool print_class_ro32_t(uint32_t p, struct DisassembleInfo *info,
5298 r = get_pointer_32(p, offset, left, S, info);
5307 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
5321 print_layout_map32(cro.ivarLayout, info);
5324 name = get_pointer_32(cro.name, xoffset, left, xS, info);
5333 print_method_list32_t(cro.baseMethods, info, "");
5338 print_protocol_list32_t(cro.baseProtocols, info);
5342 print_ivar_list32_t(cro.ivars, info);
5345 print_layout_map32(cro.weakIvarLayout, info);
5349 print_objc_property_list32(cro.baseProperties, info);
5354 static void print_class64_t(uint64_t p, struct DisassembleInfo *info) {
5362 r = get_pointer_64(p, offset, left, S, info);
5366 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
5370 name = get_symbol_64(offset + offsetof(struct class64_t, isa), S, info,
5377 name = get_symbol_64(offset + offsetof(struct class64_t, superclass), S, info,
5383 offset + offsetof(struct class64_t, superclass), info);
5390 name = get_symbol_64(offset + offsetof(struct class64_t, cache), S, info,
5397 name = get_symbol_64(offset + offsetof(struct class64_t, vtable), S, info,
5403 name = get_symbol_64(offset + offsetof(struct class64_t, data), S, info,
5407 if (info->verbose && name != nullptr)
5422 if (!print_class_ro64_t((c.data + n_value) & ~0x7, info, is_meta_class))
5428 info->depth < 100) {
5429 info->depth++;
5431 print_class64_t(c.isa + isa_n_value, info);
5435 static void print_class32_t(uint32_t p, struct DisassembleInfo *info) {
5442 r = get_pointer_32(p, offset, left, S, info);
5451 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
5456 get_symbol_32(offset + offsetof(struct class32_t, isa), S, info, c.isa);
5462 name = get_symbol_32(offset + offsetof(struct class32_t, superclass), S, info,
5469 name = get_symbol_32(offset + offsetof(struct class32_t, cache), S, info,
5476 name = get_symbol_32(offset + offsetof(struct class32_t, vtable), S, info,
5483 get_symbol_32(offset + offsetof(struct class32_t, data), S, info, c.data);
5492 if (!print_class_ro32_t(c.data & ~0x3, info, is_meta_class))
5497 print_class32_t(c.isa, info);
5502 struct DisassembleInfo *info) {
5511 if (info->verbose && CLS_GETINFO(objc_class, CLS_META)) {
5512 name = get_pointer_32(objc_class->isa, offset, left, S, info, true);
5522 if (info->verbose) {
5523 name = get_pointer_32(objc_class->super_class, offset, left, S, info, true);
5532 if (info->verbose) {
5533 name = get_pointer_32(objc_class->name, offset, left, S, info, true);
5544 outs() << "\t\t info " << format("0x%08" PRIx32, objc_class->info);
5545 if (info->verbose) {
5556 p = get_pointer_32(objc_class->ivars, offset, left, S, info, true);
5567 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
5578 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
5582 if (info->verbose) {
5583 name = get_pointer_32(ivar.ivar_name, offset, xleft, S, info, true);
5592 if (info->verbose) {
5593 name = get_pointer_32(ivar.ivar_type, offset, xleft, S, info, true);
5609 if (print_method_list(objc_class->methodLists, info))
5616 if (print_protocol_list(objc_class->protocols, 16, info))
5621 struct DisassembleInfo *info) {
5628 if (info->verbose) {
5629 name = get_pointer_32(objc_category->category_name, offset, left, S, info,
5640 if (info->verbose) {
5642 get_pointer_32(objc_category->class_name, offset, left, S, info, true);
5652 if (print_method_list(objc_category->instance_methods, info))
5657 if (print_method_list(objc_category->class_methods, info))
5661 static void print_category64_t(uint64_t p, struct DisassembleInfo *info) {
5669 r = get_pointer_64(p, offset, left, S, info);
5678 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
5683 info, n_value, c.name);
5685 if (info->verbose && sym_name != nullptr)
5693 name = get_pointer_64(c.name + n_value, xoffset, left, xS, info);
5699 sym_name = get_symbol_64(offset + offsetof(struct category64_t, cls), S, info,
5702 if (info->verbose && sym_name != nullptr)
5712 print_class64_t(c.cls + n_value, info);
5717 info, n_value, c.instanceMethods);
5719 if (info->verbose && sym_name != nullptr)
5729 print_method_list64_t(c.instanceMethods + n_value, info, "");
5733 S, info, n_value, c.classMethods);
5735 if (info->verbose && sym_name != nullptr)
5745 print_method_list64_t(c.classMethods + n_value, info, "");
5749 info, n_value, c.protocols);
5751 if (info->verbose && sym_name != nullptr)
5761 print_protocol_list64_t(c.protocols + n_value, info);
5766 S, info, n_value, c.instanceProperties);
5768 if (info->verbose && sym_name != nullptr)
5778 print_objc_property_list64(c.instanceProperties + n_value, info);
5781 static void print_category32_t(uint32_t p, struct DisassembleInfo *info) {
5788 r = get_pointer_32(p, offset, left, S, info);
5797 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
5801 name = get_symbol_32(offset + offsetof(struct category32_t, name), S, info,
5809 print_class32_t(c.cls, info);
5813 print_method_list32_t(c.instanceMethods, info, "");
5817 print_method_list32_t(c.classMethods, info, "");
5820 print_protocol_list32_t(c.protocols, info);
5824 print_objc_property_list32(c.instanceProperties, info);
5827 static void print_message_refs64(SectionRef S, struct DisassembleInfo *info) {
5846 StringRef SegName = info->O->getSectionFinalSegmentName(Ref);
5851 r = get_pointer_64(p, offset, left, S, info);
5860 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
5864 name = get_symbol_64(offset + offsetof(struct message_ref64, imp), S, info,
5878 info, n_value, mr.sel);
5880 if (info->verbose && sym_name != nullptr)
5888 name = get_pointer_64(mr.sel + n_value, xoffset, left, xS, info);
5897 static void print_message_refs32(SectionRef S, struct DisassembleInfo *info) {
5914 StringRef SegName = info->O->getSectionFinalSegmentName(Ref);
5919 r = get_pointer_32(p, offset, left, S, info);
5928 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
5932 name = get_symbol_32(offset + offsetof(struct message_ref32, imp), S, info,
5939 name = get_pointer_32(mr.sel, xoffset, left, xS, info);
5948 static void print_image_info64(SectionRef S, struct DisassembleInfo *info) {
5965 StringRef SegName = info->O->getSectionFinalSegmentName(Ref);
5968 r = get_pointer_64(p, offset, left, S, info);
5977 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
6011 static void print_image_info32(SectionRef S, struct DisassembleInfo *info) {
6027 StringRef SegName = info->O->getSectionFinalSegmentName(Ref);
6030 r = get_pointer_32(p, offset, left, S, info);
6039 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
6069 static void print_image_info(SectionRef S, struct DisassembleInfo *info) {
6082 StringRef SegName = info->O->getSectionFinalSegmentName(Ref);
6085 r = get_pointer_32(p, offset, left, S, info);
6094 if (info->O->isLittleEndian() != sys::IsLittleEndianHost)
6118 struct DisassembleInfo info(O, &AddrMap, &Sections, verbose);
6127 info.S = CL;
6128 walk_pointer_list_64("class", CL, O, &info, print_class64_t);
6137 info.S = CR;
6138 walk_pointer_list_64("class refs", CR, O, &info, nullptr);
6147 info.S = SR;
6148 walk_pointer_list_64("super refs", SR, O, &info, nullptr);
6157 info.S = CA;
6158 walk_pointer_list_64("category", CA, O, &info, print_category64_t);
6167 info.S = PL;
6168 walk_pointer_list_64("protocol", PL, O, &info, nullptr);
6177 info.S = MR;
6178 print_message_refs64(MR, &info);
6187 info.S = II;
6188 print_image_info64(II, &info);
6200 struct DisassembleInfo info(O, &AddrMap, &Sections, verbose);
6209 info.S = CL;
6210 walk_pointer_list_32("class", CL, O, &info, print_class32_t);
6219 info.S = CR;
6220 walk_pointer_list_32("class refs", CR, O, &info, nullptr);
6229 info.S = SR;
6230 walk_pointer_list_32("super refs", SR, O, &info, nullptr);
6239 info.S = CA;
6240 walk_pointer_list_32("category", CA, O, &info, print_category32_t);
6249 info.S = PL;
6250 walk_pointer_list_32("protocol", PL, O, &info, nullptr);
6259 info.S = MR;
6260 print_message_refs32(MR, &info);
6269 info.S = II;
6270 print_image_info32(II, &info);
6295 struct DisassembleInfo info(O, &AddrMap, &Sections, verbose);
6299 r = get_pointer_32(p, offset, left, S, &info, true);
6315 name = get_pointer_32(module.name, xoffset, left, xS, &info, true);
6323 r = get_pointer_32(module.symtab, xoffset, left, xS, &info, true);
6347 r = get_pointer_32(symtab.refs, xoffset, left, xS, &info, true);
6366 r = get_pointer_32(def, xoffset, left, xS, &info, true);
6379 print_objc_class_t(&objc_class, &info);
6386 r = get_pointer_32(objc_class.isa, xoffset, left, xS, &info, true);
6398 print_objc_class_t(&objc_class, &info);
6417 r = get_pointer_32(def, xoffset, left, xS, &info, true);
6431 print_objc_objc_category_t(&objc_category, &info);
6439 print_image_info(II, &info);
6453 struct DisassembleInfo info(O, &AddrMap, &Sections, true);
6470 if (print_protocol(paddr, 0, &info))
6881 struct DisassembleInfo *info) {
6883 if (info->O->getHeader().filetype == MachO::MH_OBJECT) {
6884 uint64_t sect_addr = info->S.getAddress();
6891 for (const RelocationRef &Reloc : info->S.relocations()) {
6895 RE = info->O->getRelocation(Rel);
6896 if (info->O->isRelocationScattered(RE))
6898 isExtern = info->O->getPlainRelocationExternal(RE);
6910 if (info->O->getAnyRelocationPCRel(RE)) {
6911 unsigned Type = info->O->getAnyRelocationType(RE);
6922 uint64_t pointer_value = GuessPointerPointer(ReferenceValue, info, classref,
6928 const char *name = get_dyld_bind_info_symbolname(ReferenceValue, info);
6934 info->class_name = class_name + 2;
6943 get_objc2_64bit_class_name(pointer_value, ReferenceValue, info);
6945 info->class_name = name;
6953 const char *name = get_objc2_64bit_cfstring_name(ReferenceValue, info);
6958 pointer_value = get_objc2_64bit_selref(ReferenceValue, info);
6963 const char *name = GuessCstringPointer(ReferenceValue, info);
6967 info->selector_name = name;
6969 info->class_name = nullptr;
6971 info->selector_name = name;
6979 name = GuessIndirectSymbol(ReferenceValue, info);
6989 // the Symbolizer. It looks up the ReferenceValue using the info passed via the
7019 struct DisassembleInfo *info = (struct DisassembleInfo *)DisInfo;
7021 if (!info->verbose) {
7027 const char *SymbolName = GuessSymbolName(ReferenceValue, info->AddrMap);
7030 *ReferenceName = GuessIndirectSymbol(ReferenceValue, info);
7032 method_reference(info, ReferenceType, ReferenceName);
7036 if (info->demangled_name != nullptr)
7037 free(info->demangled_name);
7039 info->demangled_name =
7041 if (info->demangled_name != nullptr) {
7042 *ReferenceName = info->demangled_name;
7050 GuessLiteralPointer(ReferenceValue, ReferencePC, ReferenceType, info);
7052 method_reference(info, ReferenceType, ReferenceName);
7058 } else if (info->O->getArch() == Triple::aarch64 &&
7060 info->adrp_inst = ReferenceValue;
7061 info->adrp_addr = ReferencePC;
7072 } else if (info->O->getArch() == Triple::aarch64 &&
7074 ReferencePC - 4 == info->adrp_addr &&
7075 (info->adrp_inst & 0x9f000000) == 0x90000000 &&
7076 (info->adrp_inst & 0x1f) == ((ReferenceValue >> 5) & 0x1f)) {
7081 ((info->adrp_inst & 0x00ffffe0) >> 3) | ((info->adrp_inst >> 29) & 0x3);
7082 if (info->adrp_inst & 0x0200000)
7090 ReferenceValue = (info->adrp_addr & 0xfffffffffffff000LL) +
7094 GuessLiteralPointer(ReferenceValue, ReferencePC, ReferenceType, info);
7102 } else if (info->O->getArch() == Triple::aarch64 &&
7104 ReferencePC - 4 == info->adrp_addr &&
7105 (info->adrp_inst & 0x9f000000) == 0x90000000 &&
7106 (info->adrp_inst & 0x1f) == ((ReferenceValue >> 5) & 0x1f)) {
7111 ((info->adrp_inst & 0x00ffffe0) >> 3) | ((info->adrp_inst >> 29) & 0x3);
7112 if (info->adrp_inst & 0x0200000)
7118 ReferenceValue = (info->adrp_addr & 0xfffffffffffff000LL) +
7122 GuessLiteralPointer(ReferenceValue, ReferencePC, ReferenceType, info);
7128 else if (info->O->getArch() == Triple::aarch64 &&
7132 GuessLiteralPointer(ReferenceValue, ReferencePC, ReferenceType, info);
7136 if (info->demangled_name != nullptr)
7137 free(info->demangled_name);
7139 info->demangled_name =
7141 if (info->demangled_name != nullptr) {
7142 *ReferenceName = info->demangled_name;
7329 // Try to find debug info and set up the DIContext for it.
7466 // Set up the block of info used by the Symbolizer call backs.
7636 // Print debug info.
7639 // Print valid line info if it changed.
8201 // in the convenience lookup for unwind info and just take up resources.
10442 struct DisassembleInfo *info) {
10443 if (info->bindtable == nullptr) {
10444 info->bindtable = std::make_unique<SymbolAddressMap>();
10446 for (const object::MachOBindEntry &Entry : info->O->bindTable(Err)) {
10450 (*info->bindtable)[Address] = name;
10453 reportError(std::move(Err), info->O->getFileName());
10455 auto name = info->bindtable->lookup(ReferenceValue);