- // Sort the symbols by address, just in case they didn't come in that way.
- array_pod_sort(Symbols.begin(), Symbols.end());
-
- // Make a list of all the relocations for this section.
- std::vector<RelocationRef> Rels;
- // if (InlineRelocs) {
- // for (relocation_iterator ri = i->begin_relocations(),
- // re = i->end_relocations();
- // ri != re; ri.increment(ec)) {
- // if (error(ec)) break;
- // Rels.push_back(*ri);
- // }
- // }
-
- // Sort relocations by address.
- std::sort(Rels.begin(), Rels.end(), RelocAddressLess);
-
- StringRef SegmentName = "";
- // if (const MachOObjectFile *MachO =
- // dyn_cast<const MachOObjectFile>(o)) {
- // DataRefImpl DR = i->getRawDataRefImpl();
- // SegmentName = MachO->getSectionFinalSegmentName(DR);
- // }
- StringRef name;
- if (error(i->getName(name))) break;
- outs() << "Disassembly of section ";
- if (!SegmentName.empty())
- outs() << SegmentName << ",";
- outs() << name << ':';
-
- // If the section has no symbols just insert a dummy one and disassemble
- // the whole section.
- if (Symbols.empty())
- Symbols.push_back(std::make_pair(0, name));
-
-
- StringRef Bytes;
- if (error(i->getContents(Bytes))) break;
- StringRefMemoryObject memoryObject(Bytes);
- uint64_t Size;
- uint64_t Index;
- uint64_t SectSize;
- if (error(i->getSize(SectSize))) break;
-
- std::vector<RelocationRef>::const_iterator rel_cur = Rels.begin();
- std::vector<RelocationRef>::const_iterator rel_end = Rels.end();
- // Disassemble symbol by symbol.
- for (unsigned si = 0, se = Symbols.size(); si != se; ++si) {
- uint64_t Start = Symbols[si].first;
- uint64_t End;
- // The end is either the size of the section or the beginning of the next
- // symbol.
- if (si == se - 1)
- End = SectSize;
- // Make sure this symbol takes up space.
- else if (Symbols[si + 1].first != Start)
- End = Symbols[si + 1].first - 1;
- else
- // This symbol has the same address as the next symbol. Skip it.
- continue;
-
- outs() << '\n' << Symbols[si].second << ":\n";
+ // Sort the symbols by address, just in case they didn't come in that way.
+ array_pod_sort(Symbols.begin(), Symbols.end());
+
+ // Make a list of all the relocations for this section.
+ std::vector<RelocationRef> Rels;
+ // if (InlineRelocs) {
+ // for (relocation_iterator ri = i->begin_relocations(),
+ // re = i->end_relocations();
+ // ri != re; ri.increment(ec)) {
+ // if (error(ec)) break;
+ // Rels.push_back(*ri);
+ // }
+ // }
+
+ // Sort relocations by address.
+ std::sort(Rels.begin(), Rels.end(), RelocAddressLess);
+
+ StringRef SegmentName = "";
+ // if (const MachOObjectFile *MachO =
+ // dyn_cast<const MachOObjectFile>(o)) {
+ // DataRefImpl DR = i->getRawDataRefImpl();
+ // SegmentName = MachO->getSectionFinalSegmentName(DR);
+ // }
+ StringRef name;
+ if (error(i->getName(name))) break;
+ outs() << "Disassembly of section ";
+ if (!SegmentName.empty())
+ outs() << SegmentName << ",";
+ outs() << name << ':';
+
+ // If the section has no symbols just insert a dummy one and disassemble
+ // the whole section.
+ if (Symbols.empty())
+ Symbols.push_back(std::make_pair(0, name));
+
+
+ StringRef Bytes;
+ if (error(i->getContents(Bytes))) break;
+ StringRefMemoryObject memoryObject(Bytes);
+ uint64_t Size;
+ uint64_t Index;
+ uint64_t SectSize;
+ if (error(i->getSize(SectSize))) break;
+
+ std::vector<RelocationRef>::const_iterator rel_cur = Rels.begin();
+ std::vector<RelocationRef>::const_iterator rel_end = Rels.end();
+ // Disassemble symbol by symbol.
+ for (unsigned si = 0, se = Symbols.size(); si != se; ++si) {
+ uint64_t Start = Symbols[si].first;
+ uint64_t End;
+ // The end is either the size of the section or the beginning of the next
+ // symbol.
+ if (si == se - 1)
+ End = SectSize;
+ // Make sure this symbol takes up space.
+ else if (Symbols[si + 1].first != Start)
+ End = Symbols[si + 1].first - 1;
+ else
+ // This symbol has the same address as the next symbol. Skip it.
+ continue;
+
+ outs() << '\n' << Symbols[si].second << ":\n";