llvm.org GIT mirror llvm / a217f98
Run clang-format on tools/llvm-objdump/MachODump.cpp again as some of my previous changes got in with incorrect formatting. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225417 91177308-0d34-0410-b5e6-96231b3b80d8 Kevin Enderby 4 years ago
1 changed file(s) with 28 addition(s) and 27 deletion(s). Raw diff Collapse all Expand all
35593559 outs() << "\n";
35603560 }
35613561
3562 static void PrintRpathLoadCommand(MachO::rpath_command rpath,
3563 const char *Ptr) {
3562 static void PrintRpathLoadCommand(MachO::rpath_command rpath, const char *Ptr) {
35643563 outs() << " cmd LC_RPATH\n";
35653564 outs() << " cmdsize " << rpath.cmdsize;
35663565 if (rpath.cmdsize < sizeof(struct MachO::rpath_command))
36583657 }
36593658
36603659 static void PrintEncryptionInfoCommand64(MachO::encryption_info_command_64 ec,
3661 uint32_t object_size) {
3660 uint32_t object_size) {
36623661 outs() << " cmd LC_ENCRYPTION_INFO_64\n";
36633662 outs() << " cmdsize " << ec.cmdsize;
36643663 if (ec.cmdsize != sizeof(struct MachO::encryption_info_command_64))
37063705 }
37073706 }
37083707 if (lo.count != i)
3709 outs() << " count " << lo.count << " does not match number of strings " << i
3710 << "\n";
3708 outs() << " count " << lo.count << " does not match number of strings "
3709 << i << "\n";
37113710 }
37123711
37133712 static void PrintSubFrameworkCommand(MachO::sub_framework_command sub,
37433742 }
37443743
37453744 static void PrintSubLibraryCommand(MachO::sub_library_command sub,
3746 const char *Ptr) {
3745 const char *Ptr) {
37473746 outs() << " cmd LC_SUB_LIBRARY\n";
37483747 outs() << " cmdsize " << sub.cmdsize;
37493748 if (sub.cmdsize < sizeof(struct MachO::sub_library_command))
38783877 else if (fpu.fpu_fcw.rc == MachO::x86_FP_RND_UP)
38793878 outs() << "FP_RND_UP ";
38803879 else if (fpu.fpu_fcw.rc == MachO::x86_FP_CHOP)
3881 outs() << "FP_CHOP ";
3880 outs() << "FP_CHOP ";
38823881 outs() << "\n";
38833882 outs() << "\t status: invalid " << fpu.fpu_fsw.invalid;
38843883 outs() << " denorm " << fpu.fpu_fsw.denorm;
39583957 for (uint32_t f = 0; f < 6; f++) {
39593958 outs() << "\t ";
39603959 for (uint32_t g = 0; g < 16; g++)
3961 outs() << format("%02" PRIx32, fpu.fpu_rsrv4[f*g]) << " ";
3960 outs() << format("%02" PRIx32, fpu.fpu_rsrv4[f * g]) << " ";
39623961 outs() << "\n";
39633962 }
39643963 outs() << "\t fpu_reserved1 " << format("0x%08" PRIx32, fpu.fpu_reserved1);
39933992 if (end - begin > (ptrdiff_t)sizeof(uint32_t)) {
39943993 memcpy((char *)&flavor, begin, sizeof(uint32_t));
39953994 begin += sizeof(uint32_t);
3996 } else{
3995 } else {
39973996 flavor = 0;
39983997 begin = end;
39993998 }
40024001 if (end - begin > (ptrdiff_t)sizeof(uint32_t)) {
40034002 memcpy((char *)&count, begin, sizeof(uint32_t));
40044003 begin += sizeof(uint32_t);
4005 } else{
4004 } else {
40064005 count = 0;
40074006 begin = end;
40084007 }
40564055 << " (not x86_THREAD_STATE64_COUNT\n";
40574056 Print_x86_thread_state64_t(ts.uts.ts64);
40584057 } else {
4059 outs() << "\t tsh.flavor " << ts.tsh.flavor
4060 << " tsh.count " << ts.tsh.count << "\n";
4058 outs() << "\t tsh.flavor " << ts.tsh.flavor << " tsh.count "
4059 << ts.tsh.count << "\n";
40614060 }
40624061 } else if (flavor == MachO::x86_FLOAT_STATE) {
40634062 outs() << " flavor x86_FLOAT_STATE\n";
40644063 if (count == MachO::x86_FLOAT_STATE_COUNT)
40654064 outs() << " count x86_FLOAT_STATE_COUNT\n";
40664065 else
4067 outs() << " count " << count
4068 << " (not x86_FLOAT_STATE_COUNT)\n";
4066 outs() << " count " << count << " (not x86_FLOAT_STATE_COUNT)\n";
40694067 struct MachO::x86_float_state_t fs;
40704068 left = end - begin;
40714069 if (left >= sizeof(MachO::x86_float_state_t)) {
40804078 swapStruct(fs);
40814079 if (fs.fsh.flavor == MachO::x86_FLOAT_STATE64) {
40824080 outs() << "\t fsh.flavor x86_FLOAT_STATE64 ";
4083 if (fs.fsh.count == MachO::x86_FLOAT_STATE64_COUNT)
4081 if (fs.fsh.count == MachO::x86_FLOAT_STATE64_COUNT)
40844082 outs() << "fsh.count x86_FLOAT_STATE64_COUNT\n";
40854083 else
40864084 outs() << "fsh.count " << fs.fsh.count
40874085 << " (not x86_FLOAT_STATE64_COUNT\n";
40884086 Print_x86_float_state_t(fs.ufs.fs64);
40894087 } else {
4090 outs() << "\t fsh.flavor " << fs.fsh.flavor
4091 << " fsh.count " << fs.fsh.count << "\n";
4088 outs() << "\t fsh.flavor " << fs.fsh.flavor << " fsh.count "
4089 << fs.fsh.count << "\n";
40924090 }
40934091 } else if (flavor == MachO::x86_EXCEPTION_STATE) {
40944092 outs() << " flavor x86_EXCEPTION_STATE\n";
40954093 if (count == MachO::x86_EXCEPTION_STATE_COUNT)
40964094 outs() << " count x86_EXCEPTION_STATE_COUNT\n";
40974095 else
4098 outs() << " count " << count
4096 outs() << " count " << count
40994097 << " (not x86_EXCEPTION_STATE_COUNT)\n";
41004098 struct MachO::x86_exception_state_t es;
41014099 left = end - begin;
41114109 swapStruct(es);
41124110 if (es.esh.flavor == MachO::x86_EXCEPTION_STATE64) {
41134111 outs() << "\t esh.flavor x86_EXCEPTION_STATE64\n";
4114 if (es.esh.count == MachO::x86_EXCEPTION_STATE64_COUNT)
4112 if (es.esh.count == MachO::x86_EXCEPTION_STATE64_COUNT)
41154113 outs() << "\t esh.count x86_EXCEPTION_STATE64_COUNT\n";
41164114 else
41174115 outs() << "\t esh.count " << es.esh.count
41184116 << " (not x86_EXCEPTION_STATE64_COUNT\n";
41194117 Print_x86_exception_state_t(es.ues.es64);
41204118 } else {
4121 outs() << "\t esh.flavor " << es.esh.flavor
4122 << " esh.count " << es.esh.count << "\n";
4119 outs() << "\t esh.flavor " << es.esh.flavor << " esh.count "
4120 << es.esh.count << "\n";
41234121 }
41244122 } else {
41254123 outs() << " flavor " << flavor << " (unknown)\n";
41334131 if (end - begin > (ptrdiff_t)sizeof(uint32_t)) {
41344132 memcpy((char *)&flavor, begin, sizeof(uint32_t));
41354133 begin += sizeof(uint32_t);
4136 } else{
4134 } else {
41374135 flavor = 0;
41384136 begin = end;
41394137 }
41424140 if (end - begin > (ptrdiff_t)sizeof(uint32_t)) {
41434141 memcpy((char *)&count, begin, sizeof(uint32_t));
41444142 begin += sizeof(uint32_t);
4145 } else{
4143 } else {
41464144 count = 0;
41474145 begin = end;
41484146 }
41554153 }
41564154 }
41574155 }
4158
4156
41594157 static void PrintDylibCommand(MachO::dylib_command dl, const char *Ptr) {
41604158 if (dl.cmd == MachO::LC_ID_DYLIB)
41614159 outs() << " cmd LC_ID_DYLIB\n";
43064304 MachO::entry_point_command Ep = Obj->getEntryPointCommand(Command);
43074305 PrintEntryPointCommand(Ep);
43084306 } else if (Command.C.cmd == MachO::LC_ENCRYPTION_INFO) {
4309 MachO::encryption_info_command Ei = Obj->getEncryptionInfoCommand(Command);
4307 MachO::encryption_info_command Ei =
4308 Obj->getEncryptionInfoCommand(Command);
43104309 PrintEncryptionInfoCommand(Ei, Buf.size());
43114310 } else if (Command.C.cmd == MachO::LC_ENCRYPTION_INFO_64) {
4312 MachO::encryption_info_command_64 Ei = Obj->getEncryptionInfoCommand64(Command);
4311 MachO::encryption_info_command_64 Ei =
4312 Obj->getEncryptionInfoCommand64(Command);
43134313 PrintEncryptionInfoCommand64(Ei, Buf.size());
43144314 } else if (Command.C.cmd == MachO::LC_LINKER_OPTION) {
4315 MachO::linker_option_command Lo = Obj->getLinkerOptionLoadCommand(Command);
4315 MachO::linker_option_command Lo =
4316 Obj->getLinkerOptionLoadCommand(Command);
43164317 PrintLinkerOptionCommand(Lo, Command.Ptr);
43174318 } else if (Command.C.cmd == MachO::LC_SUB_FRAMEWORK) {
43184319 MachO::sub_framework_command Sf = Obj->getSubFrameworkCommand(Command);