Add printing the LC_SUB_CLIENT load command with llvm-objdump’s -private-headers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224616 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kevin Enderby
2014-12-19 21:06:24 +00:00
parent 9caa5bdec0
commit 728b8cfc76
6 changed files with 38 additions and 0 deletions

View File

@@ -3722,6 +3722,21 @@ static void PrintSubLibraryCommand(MachO::sub_library_command sub,
}
}
static void PrintSubClientCommand(MachO::sub_client_command sub,
const char *Ptr) {
outs() << " cmd LC_SUB_CLIENT\n";
outs() << " cmdsize " << sub.cmdsize;
if (sub.cmdsize < sizeof(struct MachO::sub_client_command))
outs() << " Incorrect size\n";
else
outs() << "\n";
if (sub.client < sub.cmdsize) {
const char *P = Ptr + sub.client;
outs() << " client " << P << " (offset " << sub.client << ")\n";
} else {
outs() << " client ?(bad offset " << sub.client << ")\n";
}
}
static void PrintDylibCommand(MachO::dylib_command dl, const char *Ptr) {
if (dl.cmd == MachO::LC_ID_DYLIB)
@@ -3888,6 +3903,9 @@ static void PrintLoadCommands(const MachOObjectFile *Obj, uint32_t ncmds,
} else if (Command.C.cmd == MachO::LC_SUB_LIBRARY) {
MachO::sub_library_command Sl = Obj->getSubLibraryCommand(Command);
PrintSubLibraryCommand(Sl, Command.Ptr);
} else if (Command.C.cmd == MachO::LC_SUB_CLIENT) {
MachO::sub_client_command Sc = Obj->getSubClientCommand(Command);
PrintSubClientCommand(Sc, Command.Ptr);
} else if (Command.C.cmd == MachO::LC_LOAD_DYLIB ||
Command.C.cmd == MachO::LC_ID_DYLIB ||
Command.C.cmd == MachO::LC_LOAD_WEAK_DYLIB ||