diff options
author | dim <dim@FreeBSD.org> | 2012-08-15 19:34:23 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-08-15 19:34:23 +0000 |
commit | 721c201bd55ffb73cb2ba8d39e0570fa38c44e15 (patch) | |
tree | eacfc83d988e4b9d11114387ae7dc41243f2a363 /tools/macho-dump/macho-dump.cpp | |
parent | 2b2816e083a455f7a656ae88b0fd059d1688bb36 (diff) | |
download | FreeBSD-src-721c201bd55ffb73cb2ba8d39e0570fa38c44e15.zip FreeBSD-src-721c201bd55ffb73cb2ba8d39e0570fa38c44e15.tar.gz |
Vendor import of llvm trunk r161861:
http://llvm.org/svn/llvm-project/llvm/trunk@161861
Diffstat (limited to 'tools/macho-dump/macho-dump.cpp')
-rw-r--r-- | tools/macho-dump/macho-dump.cpp | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/tools/macho-dump/macho-dump.cpp b/tools/macho-dump/macho-dump.cpp index 2b22c3b..20deda9 100644 --- a/tools/macho-dump/macho-dump.cpp +++ b/tools/macho-dump/macho-dump.cpp @@ -194,7 +194,7 @@ static int DumpSegment64Command(MachOObject &Obj, } outs() << " ])\n"; - return 0; + return Res; } static void DumpSymbolTableEntryData(MachOObject &Obj, @@ -332,6 +332,35 @@ static int DumpLinkeditDataCommand(MachOObject &Obj, return 0; } +static int DumpDataInCodeDataCommand(MachOObject &Obj, + const MachOObject::LoadCommandInfo &LCI) { + InMemoryStruct<macho::LinkeditDataLoadCommand> LLC; + Obj.ReadLinkeditDataLoadCommand(LCI, LLC); + if (!LLC) + return Error("unable to read segment load command"); + + outs() << " ('dataoff', " << LLC->DataOffset << ")\n" + << " ('datasize', " << LLC->DataSize << ")\n" + << " ('_data_regions', [\n"; + + + unsigned NumRegions = LLC->DataSize / 8; + for (unsigned i = 0; i < NumRegions; ++i) { + InMemoryStruct<macho::DataInCodeTableEntry> DICE; + Obj.ReadDataInCodeTableEntry(LLC->DataOffset, i, DICE); + if (!DICE) + return Error("unable to read DataInCodeTableEntry"); + outs() << " # DICE " << i << "\n" + << " ('offset', " << DICE->Offset << ")\n" + << " ('length', " << DICE->Length << ")\n" + << " ('kind', " << DICE->Kind << ")\n"; + } + + outs() <<" ])\n"; + + return 0; +} + static int DumpLoadCommand(MachOObject &Obj, unsigned Index) { const MachOObject::LoadCommandInfo &LCI = Obj.getLoadCommandInfo(Index); @@ -358,6 +387,9 @@ static int DumpLoadCommand(MachOObject &Obj, unsigned Index) { case macho::LCT_FunctionStarts: Res = DumpLinkeditDataCommand(Obj, LCI); break; + case macho::LCT_DataInCode: + Res = DumpDataInCodeDataCommand(Obj, LCI); + break; default: Warning("unknown load command: " + Twine(LCI.Command.Type)); break; |