<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">You are correct, that test is using an ARM binary. Fixed with r183442.<div><br></div><div>Kev</div><div><br><div><div>On Jun 6, 2013, at 1:06 PM, Jim Grosbach <<a href="mailto:grosbach@apple.com">grosbach@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Excellent!<div><br></div><div>The test file should be in the test/Object/ARM subdirectory, though, not X86.</div><div><br></div><div>-Jim</div><div><br><div><div>On Jun 6, 2013, at 10:20 AM, Kevin Enderby <<a href="mailto:enderby@apple.com">enderby@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Author: enderby<br>Date: Thu Jun 6 12:20:50 2013<br>New Revision: 183424<br><br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=183424&view=rev">http://llvm.org/viewvc/llvm-project?rev=183424&view=rev</a><br>Log:<br>Teach llvm-objdump with the -macho parser how to use the data in code table<br>from the LC_DATA_IN_CODE load command. And when disassembling print<br>the data in code formatted for the kind of data it and not disassemble those<br>bytes.<br><br>I added the format specific functionality to the derived class MachOObjectFile<br>since these tables only appears in Mach-O object files. This is my first<br>attempt to modify the libObject stuff so if folks have better suggestions<br>how to fit this in or suggestions on the implementation please let me know.<br><br><a href="rdar://11791371">rdar://11791371</a><br><br>Added:<br> llvm/trunk/test/Object/Inputs/macho-data-in-code.macho-thumbv7 (with props)<br> llvm/trunk/test/Object/X86/macho-data-in-code.test</div></blockquote><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Modified:<br> llvm/trunk/include/llvm/Object/MachO.h<br> llvm/trunk/lib/Object/MachOObjectFile.cpp<br> llvm/trunk/tools/llvm-objdump/MachODump.cpp<br> llvm/trunk/tools/macho-dump/macho-dump.cpp<br><br>Modified: llvm/trunk/include/llvm/Object/MachO.h<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachO.h?rev=183424&r1=183423&r2=183424&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachO.h?rev=183424&r1=183423&r2=183424&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm/Object/MachO.h (original)<br>+++ llvm/trunk/include/llvm/Object/MachO.h Thu Jun 6 12:20:50 2013<br>@@ -25,6 +25,31 @@<br>namespace llvm {<br>namespace object {<br><br>+/// DiceRef - This is a value type class that represents a single<br>+/// data in code entry in the table in a Mach-O object file.<br>+class DiceRef {<br>+ DataRefImpl DicePimpl;<br>+ const ObjectFile *OwningObject;<br>+<br>+public:<br>+ DiceRef() : OwningObject(NULL) { }<br>+<br>+ DiceRef(DataRefImpl DiceP, const ObjectFile *Owner);<br>+<br>+ bool operator==(const DiceRef &Other) const;<br>+ bool operator<(const DiceRef &Other) const;<br>+<br>+ error_code getNext(DiceRef &Result) const;<br>+<br>+ error_code getOffset(uint32_t &Result) const;<br>+ error_code getLength(uint16_t &Result) const;<br>+ error_code getKind(uint16_t &Result) const;<br>+<br>+ DataRefImpl getRawDataRefImpl() const;<br>+ const ObjectFile *getObjectFile() const;<br>+};<br>+typedef content_iterator<DiceRef> dice_iterator;<br>+<br>class MachOObjectFile : public ObjectFile {<br>public:<br> struct LoadCommandInfo {<br>@@ -108,6 +133,9 @@ public:<br> relocation_iterator getSectionRelBegin(unsigned Index) const;<br> relocation_iterator getSectionRelEnd(unsigned Index) const;<br><br>+ dice_iterator begin_dices() const;<br>+ dice_iterator end_dices() const;<br>+<br> // In a MachO file, sections have a segment name. This is used in the .o<br> // files. They have a single segment, but this field specifies which segment<br> // a section should be put in in the final object.<br>@@ -152,6 +180,7 @@ public:<br> getLinkerOptionsLoadCommand(const LoadCommandInfo &L) const;<br><br> macho::RelocationEntry getRelocation(DataRefImpl Rel) const;<br>+ macho::DataInCodeTableEntry getDice(DataRefImpl Rel) const;<br> macho::Header getHeader() const;<br> macho::Header64Ext getHeader64Ext() const;<br> macho::IndirectSymbolTableEntry<br>@@ -161,6 +190,7 @@ public:<br> unsigned Index) const;<br> macho::SymtabLoadCommand getSymtabLoadCommand() const;<br> macho::DysymtabLoadCommand getDysymtabLoadCommand() const;<br>+ macho::LinkeditDataLoadCommand getDataInCodeLoadCommand() const;<br><br> StringRef getStringTableData() const;<br> bool is64Bit() const;<br>@@ -175,8 +205,66 @@ private:<br> SectionList Sections;<br> const char *SymtabLoadCmd;<br> const char *DysymtabLoadCmd;<br>+ const char *DataInCodeLoadCmd;<br>};<br><br>+/// DiceRef<br>+inline DiceRef::DiceRef(DataRefImpl DiceP, const ObjectFile *Owner)<br>+ : DicePimpl(DiceP) , OwningObject(Owner) {}<br>+<br>+inline bool DiceRef::operator==(const DiceRef &Other) const {<br>+ return DicePimpl == Other.DicePimpl;<br>+}<br>+<br>+inline bool DiceRef::operator<(const DiceRef &Other) const {<br>+ return DicePimpl < Other.DicePimpl;<br>+}<br>+<br>+inline error_code DiceRef::getNext(DiceRef &Result) const {<br>+ DataRefImpl Rel = DicePimpl;<br>+ const macho::DataInCodeTableEntry *P =<br>+ reinterpret_cast<const macho::DataInCodeTableEntry *>(Rel.p);<br>+ Rel.p = reinterpret_cast<uintptr_t>(P + 1);<br>+ Result = DiceRef(Rel, OwningObject);<br>+ return object_error::success;<br>+}<br>+<br>+// Since a Mach-O data in code reference, a DiceRef, can only be created when<br>+// the OwningObject ObjectFile is a MachOObjectFile a static_cast<> is used for<br>+// the methods that get the values of the fields of the reference.<br>+<br>+inline error_code DiceRef::getOffset(uint32_t &Result) const {<br>+ const MachOObjectFile *MachOOF =<br>+ static_cast<const MachOObjectFile *>(OwningObject);<br>+ macho::DataInCodeTableEntry Dice = MachOOF->getDice(DicePimpl);<br>+ Result = Dice.Offset;<br>+ return object_error::success;<br>+}<br>+<br>+inline error_code DiceRef::getLength(uint16_t &Result) const {<br>+ const MachOObjectFile *MachOOF =<br>+ static_cast<const MachOObjectFile *>(OwningObject);<br>+ macho::DataInCodeTableEntry Dice = MachOOF->getDice(DicePimpl);<br>+ Result = Dice.Length;<br>+ return object_error::success;<br>+}<br>+<br>+inline error_code DiceRef::getKind(uint16_t &Result) const {<br>+ const MachOObjectFile *MachOOF =<br>+ static_cast<const MachOObjectFile *>(OwningObject);<br>+ macho::DataInCodeTableEntry Dice = MachOOF->getDice(DicePimpl);<br>+ Result = Dice.Kind;<br>+ return object_error::success;<br>+}<br>+<br>+inline DataRefImpl DiceRef::getRawDataRefImpl() const {<br>+ return DicePimpl;<br>+}<br>+<br>+inline const ObjectFile *DiceRef::getObjectFile() const {<br>+ return OwningObject;<br>+}<br>+<br>}<br>}<br><br><br>Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=183424&r1=183423&r2=183424&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=183424&r1=183423&r2=183424&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)<br>+++ llvm/trunk/lib/Object/MachOObjectFile.cpp Thu Jun 6 12:20:50 2013<br>@@ -414,7 +414,7 @@ MachOObjectFile::MachOObjectFile(MemoryB<br> bool IsLittleEndian, bool Is64bits,<br> error_code &ec)<br> : ObjectFile(getMachOType(IsLittleEndian, Is64bits), Object),<br>- SymtabLoadCmd(NULL), DysymtabLoadCmd(NULL) {<br>+ SymtabLoadCmd(NULL), DysymtabLoadCmd(NULL), DataInCodeLoadCmd(NULL) {<br> uint32_t LoadCommandCount = this->getHeader().NumLoadCommands;<br> macho::LoadCommandType SegmentLoadType = is64Bit() ?<br> macho::LCT_Segment64 : macho::LCT_Segment;<br>@@ -427,6 +427,9 @@ MachOObjectFile::MachOObjectFile(MemoryB<br> } else if (Load.C.Type == macho::LCT_Dysymtab) {<br> assert(!DysymtabLoadCmd && "Multiple dynamic symbol tables");<br> DysymtabLoadCmd = Load.Ptr;<br>+ } else if (Load.C.Type == macho::LCT_DataInCode) {<br>+ assert(!DataInCodeLoadCmd && "Multiple data in code tables");<br>+ DataInCodeLoadCmd = Load.Ptr;<br> } else if (Load.C.Type == SegmentLoadType) {<br> uint32_t NumSections = getSegmentLoadCommandNumSections(this, Load);<br> for (unsigned J = 0; J < NumSections; ++J) {<br>@@ -1328,6 +1331,27 @@ relocation_iterator MachOObjectFile::get<br> return getSectionRelEnd(DRI);<br>}<br><br>+dice_iterator MachOObjectFile::begin_dices() const {<br>+ DataRefImpl DRI;<br>+ if (!DataInCodeLoadCmd)<br>+ return dice_iterator(DiceRef(DRI, this));<br>+<br>+ macho::LinkeditDataLoadCommand DicLC = getDataInCodeLoadCommand();<br>+ DRI.p = reinterpret_cast<uintptr_t>(getPtr(this, DicLC.DataOffset));<br>+ return dice_iterator(DiceRef(DRI, this));<br>+}<br>+<br>+dice_iterator MachOObjectFile::end_dices() const {<br>+ DataRefImpl DRI;<br>+ if (!DataInCodeLoadCmd)<br>+ return dice_iterator(DiceRef(DRI, this));<br>+<br>+ macho::LinkeditDataLoadCommand DicLC = getDataInCodeLoadCommand();<br>+ unsigned Offset = DicLC.DataOffset + DicLC.DataSize;<br>+ DRI.p = reinterpret_cast<uintptr_t>(getPtr(this, Offset));<br>+ return dice_iterator(DiceRef(DRI, this));<br>+}<br>+<br>StringRef<br>MachOObjectFile::getSectionFinalSegmentName(DataRefImpl Sec) const {<br> ArrayRef<char> Raw = getSectionRawFinalSegmentName(Sec);<br>@@ -1492,6 +1516,12 @@ MachOObjectFile::getRelocation(DataRefIm<br> return getStruct<macho::RelocationEntry>(this, P);<br>}<br><br>+macho::DataInCodeTableEntry<br>+MachOObjectFile::getDice(DataRefImpl Rel) const {<br>+ const char *P = reinterpret_cast<const char *>(Rel.p);<br>+ return getStruct<macho::DataInCodeTableEntry>(this, P);<br>+}<br>+<br>macho::Header MachOObjectFile::getHeader() const {<br> return getStruct<macho::Header>(this, getPtr(this, 0));<br>}<br>@@ -1524,6 +1554,20 @@ macho::DysymtabLoadCommand MachOObjectFi<br> return getStruct<macho::DysymtabLoadCommand>(this, DysymtabLoadCmd);<br>}<br><br>+macho::LinkeditDataLoadCommand<br>+MachOObjectFile::getDataInCodeLoadCommand() const {<br>+ if (DataInCodeLoadCmd)<br>+ return getStruct<macho::LinkeditDataLoadCommand>(this, DataInCodeLoadCmd);<br>+<br>+ // If there is no DataInCodeLoadCmd return a load command with zero'ed fields.<br>+ macho::LinkeditDataLoadCommand Cmd;<br>+ Cmd.Type = macho::LCT_DataInCode;<br>+ Cmd.Size = macho::LinkeditLoadCommandSize;<br>+ Cmd.DataOffset = 0;<br>+ Cmd.DataSize = 0;<br>+ return Cmd;<br>+}<br>+<br>StringRef MachOObjectFile::getStringTableData() const {<br> macho::SymtabLoadCommand S = getSymtabLoadCommand();<br> return getData().substr(S.StringTableOffset, S.StringTableSize);<br><br>Added: llvm/trunk/test/Object/Inputs/macho-data-in-code.macho-thumbv7<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/Inputs/macho-data-in-code.macho-thumbv7?rev=183424&view=auto">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/Inputs/macho-data-in-code.macho-thumbv7?rev=183424&view=auto</a><br>==============================================================================<br>Binary file - no diff available.<br><br>Propchange: llvm/trunk/test/Object/Inputs/macho-data-in-code.macho-thumbv7<br>------------------------------------------------------------------------------<br> svn:mime-type = application/octet-stream<br><br>Added: llvm/trunk/test/Object/X86/macho-data-in-code.test<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/X86/macho-data-in-code.test?rev=183424&view=auto">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/X86/macho-data-in-code.test?rev=183424&view=auto</a><br>==============================================================================<br>--- llvm/trunk/test/Object/X86/macho-data-in-code.test (added)<br>+++ llvm/trunk/test/Object/X86/macho-data-in-code.test Thu Jun 6 12:20:50 2013<br>@@ -0,0 +1,7 @@<br>+RUN: llvm-objdump -triple thumbv7-apple-iOS -disassemble %p/../Inputs/macho-data-in-code.macho-thumbv7 -macho | FileCheck %s<br>+<br>+CHECK: 12:<span class="Apple-tab-span" style="white-space: pre;"> </span>80 bd <span class="Apple-tab-span" style="white-space: pre;"> </span>pop<span class="Apple-tab-span" style="white-space: pre;"> </span>{r7, pc}<br>+<br>+CHECK: 14:<span class="Apple-tab-span" style="white-space: pre;"> </span>38 00 00 00 <span class="Apple-tab-span" style="white-space: pre;"> </span>.long 56<span class="Apple-tab-span" style="white-space: pre;"> </span>@ KIND_DATA<br>+CHECK: 16:<span class="Apple-tab-span" style="white-space: pre;"> </span>00 00 <span class="Apple-tab-span" style="white-space: pre;"> </span>movs<span class="Apple-tab-span" style="white-space: pre;"> </span>r0, r0<br>+<br><br>Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=183424&r1=183423&r2=183424&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=183424&r1=183423&r2=183424&view=diff</a><br>==============================================================================<br>--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)<br>+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Thu Jun 6 12:20:50 2013<br>@@ -87,12 +87,73 @@ struct SymbolSorter {<br> }<br>};<br><br>+// Types for the storted data in code table that is built before disassembly<br>+// and the predicate function to sort them.<br>+typedef std::pair<uint64_t, DiceRef> DiceTableEntry;<br>+typedef std::vector<DiceTableEntry> DiceTable;<br>+typedef DiceTable::iterator dice_table_iterator;<br>+<br>+static bool<br>+compareDiceTableEntries(const DiceTableEntry i,<br>+ const DiceTableEntry j) {<br>+ return i.first == j.first;<br>+}<br>+<br>+static void DumpDataInCode(const char *bytes, uint64_t Size,<br>+ unsigned short Kind) {<br>+ uint64_t Value;<br>+<br>+ switch (Kind) {<br>+ case macho::Data:<br>+ switch (Size) {<br>+ case 4:<br>+ Value = bytes[3] << 24 |<br>+ bytes[2] << 16 |<br>+ bytes[1] << 8 |<br>+ bytes[0];<br>+ outs() << "\t.long " << Value;<br>+ break;<br>+ case 2:<br>+ Value = bytes[1] << 8 |<br>+ bytes[0];<br>+ outs() << "\t.short " << Value;<br>+ break;<br>+ case 1:<br>+ Value = bytes[0];<br>+ outs() << "\t.byte " << Value;<br>+ break;<br>+ }<br>+ outs() << "\t@ KIND_DATA\n";<br>+ break;<br>+ case macho::JumpTable8:<br>+ Value = bytes[0];<br>+ outs() << "\t.byte " << Value << "\t@ KIND_JUMP_TABLE8";<br>+ break;<br>+ case macho::JumpTable16:<br>+ Value = bytes[1] << 8 |<br>+ bytes[0];<br>+ outs() << "\t.short " << Value << "\t@ KIND_JUMP_TABLE16";<br>+ break;<br>+ case macho::JumpTable32:<br>+ Value = bytes[3] << 24 |<br>+ bytes[2] << 16 |<br>+ bytes[1] << 8 |<br>+ bytes[0];<br>+ outs() << "\t.long " << Value << "\t@ KIND_JUMP_TABLE32";<br>+ break;<br>+ default:<br>+ outs() << "\t@ data in code kind = " << Kind << "\n";<br>+ break;<br>+ }<br>+}<br>+<br>static void<br>getSectionsAndSymbols(const macho::Header Header,<br> MachOObjectFile *MachOObj,<br> std::vector<SectionRef> &Sections,<br> std::vector<SymbolRef> &Symbols,<br>- SmallVectorImpl<uint64_t> &FoundFns) {<br>+ SmallVectorImpl<uint64_t> &FoundFns,<br>+ uint64_t &BaseSegmentAddress) {<br> error_code ec;<br> for (symbol_iterator SI = MachOObj->begin_symbols(),<br> SE = MachOObj->end_symbols(); SI != SE; SI.increment(ec))<br>@@ -108,6 +169,7 @@ getSectionsAndSymbols(const macho::Heade<br><br> MachOObjectFile::LoadCommandInfo Command =<br> MachOObj->getFirstLoadCommandInfo();<br>+ bool BaseSegmentAddressSet = false;<br> for (unsigned i = 0; ; ++i) {<br> if (Command.C.Type == macho::LCT_FunctionStarts) {<br> // We found a function starts segment, parse the addresses for later<br>@@ -117,6 +179,15 @@ getSectionsAndSymbols(const macho::Heade<br><br> MachOObj->ReadULEB128s(LLC.DataOffset, FoundFns);<br> }<br>+ else if (Command.C.Type == macho::LCT_Segment) {<br>+ macho::SegmentLoadCommand SLC =<br>+ MachOObj->getSegmentLoadCommand(Command);<br>+ StringRef SegName = SLC.Name;<br>+ if(!BaseSegmentAddressSet && SegName != "__PAGEZERO") {<br>+ BaseSegmentAddressSet = true;<br>+ BaseSegmentAddress = SLC.VMAddress;<br>+ }<br>+ }<br><br> if (i == Header.NumLoadCommands - 1)<br> break;<br>@@ -184,14 +255,32 @@ static void DisassembleInputMachO2(Strin<br> std::vector<SectionRef> Sections;<br> std::vector<SymbolRef> Symbols;<br> SmallVector<uint64_t, 8> FoundFns;<br>+ uint64_t BaseSegmentAddress;<br><br>- getSectionsAndSymbols(Header, MachOOF, Sections, Symbols, FoundFns);<br>+ getSectionsAndSymbols(Header, MachOOF, Sections, Symbols, FoundFns,<br>+ BaseSegmentAddress);<br><br> // Make a copy of the unsorted symbol list. FIXME: duplication<br> std::vector<SymbolRef> UnsortedSymbols(Symbols);<br> // Sort the symbols by address, just in case they didn't come in that way.<br> std::sort(Symbols.begin(), Symbols.end(), SymbolSorter());<br><br>+ // Build a data in code table that is sorted on by the address of each entry.<br>+ uint64_t BaseAddress = 0;<br>+ if (Header.FileType == macho::HFT_Object)<br>+ Sections[0].getAddress(BaseAddress);<br>+ else<br>+ BaseAddress = BaseSegmentAddress;<br>+ DiceTable Dices;<br>+ error_code ec;<br>+ for (dice_iterator DI = MachOOF->begin_dices(), DE = MachOOF->end_dices();<br>+ DI != DE; DI.increment(ec)){<br>+ uint32_t Offset;<br>+ DI->getOffset(Offset);<br>+ Dices.push_back(std::make_pair(BaseAddress + Offset, *DI));<br>+ }<br>+ array_pod_sort(Dices.begin(), Dices.end());<br>+<br>#ifndef NDEBUG<br> raw_ostream &DebugOut = DebugFlag ? dbgs() : nulls();<br>#else<br>@@ -309,12 +398,29 @@ static void DisassembleInputMachO2(Strin<br> for (uint64_t Index = Start; Index < End; Index += Size) {<br> MCInst Inst;<br><br>+ uint64_t SectAddress = 0;<br>+ Sections[SectIdx].getAddress(SectAddress);<br>+ outs() << format("%8" PRIx64 ":\t", SectAddress + Index);<br>+<br>+ // Check the data in code table here to see if this is data not an<br>+ // instruction to be disassembled.<br>+ DiceTable Dice;<br>+ Dice.push_back(std::make_pair(SectAddress + Index, DiceRef()));<br>+ dice_table_iterator DTI = std::search(Dices.begin(), Dices.end(),<br>+ Dice.begin(), Dice.end(),<br>+ compareDiceTableEntries);<br>+ if (DTI != Dices.end()){<br>+ uint16_t Length;<br>+ DTI->second.getLength(Length);<br>+ DumpBytes(StringRef(Bytes.data() + Index, Length));<br>+ uint16_t Kind;<br>+ DTI->second.getKind(Kind);<br>+ DumpDataInCode(Bytes.data() + Index, Length, Kind);<br>+ continue;<br>+ }<br>+<br> if (DisAsm->getInstruction(Inst, Size, memoryObject, Index,<br> DebugOut, nulls())) {<br>- uint64_t SectAddress = 0;<br>- Sections[SectIdx].getAddress(SectAddress);<br>- outs() << format("%8" PRIx64 ":\t", SectAddress + Index);<br>-<br> DumpBytes(StringRef(Bytes.data() + Index, Size));<br> IP->printInst(&Inst, outs(), "");<br><br><br>Modified: llvm/trunk/tools/macho-dump/macho-dump.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/macho-dump/macho-dump.cpp?rev=183424&r1=183423&r2=183424&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/macho-dump/macho-dump.cpp?rev=183424&r1=183423&r2=183424&view=diff</a><br>==============================================================================<br>--- llvm/trunk/tools/macho-dump/macho-dump.cpp (original)<br>+++ llvm/trunk/tools/macho-dump/macho-dump.cpp Thu Jun 6 12:20:50 2013<br>@@ -292,7 +292,7 @@ DumpDataInCodeDataCommand(const MachOObj<br> << " ('datasize', " << LLC.DataSize << ")\n"<br> << " ('_data_regions', [\n";<br><br>- unsigned NumRegions = LLC.DataSize / 8;<br>+ unsigned NumRegions = LLC.DataSize / sizeof(macho::DataInCodeTableEntry);<br> for (unsigned i = 0; i < NumRegions; ++i) {<br> macho::DataInCodeTableEntry DICE =<br> Obj.getDataInCodeTableEntry(LLC.DataOffset, i);<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></div></blockquote></div><br></div></div></blockquote></div><br></div></body></html>