1 //===-- DWARFContext.cpp --------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "DWARFContext.h"
11 #include "llvm/ADT/SmallString.h"
12 #include "llvm/ADT/StringSwitch.h"
13 #include "llvm/ADT/STLExtras.h"
14 #include "llvm/Support/Compression.h"
15 #include "llvm/Support/Dwarf.h"
16 #include "llvm/Support/Format.h"
17 #include "llvm/Support/Path.h"
18 #include "llvm/Support/raw_ostream.h"
21 using namespace dwarf;
22 using namespace object;
24 typedef DWARFDebugLine::LineTable DWARFLineTable;
26 DWARFContext::~DWARFContext() {
27 DeleteContainerPointers(CUs);
28 DeleteContainerPointers(DWOCUs);
31 void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType) {
32 if (DumpType == DIDT_All || DumpType == DIDT_Abbrev) {
33 OS << ".debug_abbrev contents:\n";
34 getDebugAbbrev()->dump(OS);
37 if (DumpType == DIDT_All || DumpType == DIDT_Info) {
38 OS << "\n.debug_info contents:\n";
39 for (unsigned i = 0, e = getNumCompileUnits(); i != e; ++i)
40 getCompileUnitAtIndex(i)->dump(OS);
43 if (DumpType == DIDT_All || DumpType == DIDT_Loc) {
44 OS << ".debug_loc contents:\n";
45 getDebugLoc()->dump(OS);
48 if (DumpType == DIDT_All || DumpType == DIDT_Frames) {
49 OS << "\n.debug_frame contents:\n";
50 getDebugFrame()->dump(OS);
54 if (DumpType == DIDT_All || DumpType == DIDT_Aranges) {
55 OS << "\n.debug_aranges contents:\n";
56 DataExtractor arangesData(getARangeSection(), isLittleEndian(), 0);
57 DWARFDebugArangeSet set;
58 while (set.extract(arangesData, &offset))
62 uint8_t savedAddressByteSize = 0;
63 if (DumpType == DIDT_All || DumpType == DIDT_Line) {
64 OS << "\n.debug_line contents:\n";
65 for (unsigned i = 0, e = getNumCompileUnits(); i != e; ++i) {
66 DWARFCompileUnit *cu = getCompileUnitAtIndex(i);
67 savedAddressByteSize = cu->getAddressByteSize();
69 cu->getCompileUnitDIE()->getAttributeValueAsUnsigned(cu, DW_AT_stmt_list,
71 if (stmtOffset != -1U) {
72 DataExtractor lineData(getLineSection(), isLittleEndian(),
73 savedAddressByteSize);
74 DWARFDebugLine::DumpingState state(OS);
75 DWARFDebugLine::parseStatementTable(lineData, &lineRelocMap(), &stmtOffset, state);
80 if (DumpType == DIDT_All || DumpType == DIDT_Str) {
81 OS << "\n.debug_str contents:\n";
82 DataExtractor strData(getStringSection(), isLittleEndian(), 0);
84 uint32_t strOffset = 0;
85 while (const char *s = strData.getCStr(&offset)) {
86 OS << format("0x%8.8x: \"%s\"\n", strOffset, s);
91 if (DumpType == DIDT_All || DumpType == DIDT_Ranges) {
92 OS << "\n.debug_ranges contents:\n";
93 // In fact, different compile units may have different address byte
94 // sizes, but for simplicity we just use the address byte size of the last
95 // compile unit (there is no easy and fast way to associate address range
96 // list and the compile unit it describes).
97 DataExtractor rangesData(getRangeSection(), isLittleEndian(),
98 savedAddressByteSize);
100 DWARFDebugRangeList rangeList;
101 while (rangeList.extract(rangesData, &offset))
105 if (DumpType == DIDT_All || DumpType == DIDT_Pubnames) {
106 OS << "\n.debug_pubnames contents:\n";
107 DataExtractor pubNames(getPubNamesSection(), isLittleEndian(), 0);
109 OS << "Length: " << pubNames.getU32(&offset) << "\n";
110 OS << "Version: " << pubNames.getU16(&offset) << "\n";
111 OS << "Offset in .debug_info: " << pubNames.getU32(&offset) << "\n";
112 OS << "Size: " << pubNames.getU32(&offset) << "\n";
113 OS << "\n Offset Name\n";
114 while (offset < getPubNamesSection().size()) {
115 uint32_t n = pubNames.getU32(&offset);
118 OS << format("%8x ", n);
119 OS << pubNames.getCStr(&offset) << "\n";
123 if (DumpType == DIDT_All || DumpType == DIDT_GnuPubnames) {
124 OS << "\n.debug_gnu_pubnames contents:\n";
125 DataExtractor pubNames(getGnuPubNamesSection(), isLittleEndian(), 0);
127 OS << "Length: " << pubNames.getU32(&offset) << "\n";
128 OS << "Version: " << pubNames.getU16(&offset) << "\n";
129 OS << "Offset in .debug_info: " << pubNames.getU32(&offset) << "\n";
130 OS << "Size: " << pubNames.getU32(&offset) << "\n";
131 OS << "Offset Linkage Kind Name\n";
132 while (offset < getGnuPubNamesSection().size()) {
133 uint32_t dieRef = pubNames.getU32(&offset);
136 PubIndexEntryDescriptor desc(pubNames.getU8(&offset));
137 OS << format("0x%8.8x ", dieRef)
138 << format("%-8s", dwarf::GDBIndexEntryLinkageString(desc.Linkage))
139 << ' ' << dwarf::GDBIndexEntryKindString(desc.Kind) << " \""
140 << pubNames.getCStr(&offset) << "\"\n";
144 if (DumpType == DIDT_All || DumpType == DIDT_AbbrevDwo) {
145 const DWARFDebugAbbrev *D = getDebugAbbrevDWO();
147 OS << "\n.debug_abbrev.dwo contents:\n";
148 getDebugAbbrevDWO()->dump(OS);
152 if (DumpType == DIDT_All || DumpType == DIDT_InfoDwo)
153 if (getNumDWOCompileUnits()) {
154 OS << "\n.debug_info.dwo contents:\n";
155 for (unsigned i = 0, e = getNumDWOCompileUnits(); i != e; ++i)
156 getDWOCompileUnitAtIndex(i)->dump(OS);
159 if (DumpType == DIDT_All || DumpType == DIDT_StrDwo)
160 if (!getStringDWOSection().empty()) {
161 OS << "\n.debug_str.dwo contents:\n";
162 DataExtractor strDWOData(getStringDWOSection(), isLittleEndian(), 0);
164 uint32_t strDWOOffset = 0;
165 while (const char *s = strDWOData.getCStr(&offset)) {
166 OS << format("0x%8.8x: \"%s\"\n", strDWOOffset, s);
167 strDWOOffset = offset;
171 if (DumpType == DIDT_All || DumpType == DIDT_StrOffsetsDwo)
172 if (!getStringOffsetDWOSection().empty()) {
173 OS << "\n.debug_str_offsets.dwo contents:\n";
174 DataExtractor strOffsetExt(getStringOffsetDWOSection(), isLittleEndian(), 0);
176 uint64_t size = getStringOffsetDWOSection().size();
177 while (offset < size) {
178 OS << format("0x%8.8x: ", offset);
179 OS << format("%8.8x\n", strOffsetExt.getU32(&offset));
184 const DWARFDebugAbbrev *DWARFContext::getDebugAbbrev() {
188 DataExtractor abbrData(getAbbrevSection(), isLittleEndian(), 0);
190 Abbrev.reset(new DWARFDebugAbbrev());
191 Abbrev->parse(abbrData);
195 const DWARFDebugAbbrev *DWARFContext::getDebugAbbrevDWO() {
197 return AbbrevDWO.get();
199 DataExtractor abbrData(getAbbrevDWOSection(), isLittleEndian(), 0);
200 AbbrevDWO.reset(new DWARFDebugAbbrev());
201 AbbrevDWO->parse(abbrData);
202 return AbbrevDWO.get();
205 const DWARFDebugLoc *DWARFContext::getDebugLoc() {
209 DataExtractor LocData(getLocSection(), isLittleEndian(), 0);
210 Loc.reset(new DWARFDebugLoc(locRelocMap()));
211 // assume all compile units have the same address byte size
212 if (getNumCompileUnits())
213 Loc->parse(LocData, getCompileUnitAtIndex(0)->getAddressByteSize());
217 const DWARFDebugAranges *DWARFContext::getDebugAranges() {
219 return Aranges.get();
221 DataExtractor arangesData(getARangeSection(), isLittleEndian(), 0);
223 Aranges.reset(new DWARFDebugAranges());
224 Aranges->extract(arangesData);
225 // Generate aranges from DIEs: even if .debug_aranges section is present,
226 // it may describe only a small subset of compilation units, so we need to
227 // manually build aranges for the rest of them.
228 Aranges->generate(this);
229 return Aranges.get();
232 const DWARFDebugFrame *DWARFContext::getDebugFrame() {
234 return DebugFrame.get();
236 // There's a "bug" in the DWARFv3 standard with respect to the target address
237 // size within debug frame sections. While DWARF is supposed to be independent
238 // of its container, FDEs have fields with size being "target address size",
239 // which isn't specified in DWARF in general. It's only specified for CUs, but
240 // .eh_frame can appear without a .debug_info section. Follow the example of
241 // other tools (libdwarf) and extract this from the container (ObjectFile
242 // provides this information). This problem is fixed in DWARFv4
243 // See this dwarf-discuss discussion for more details:
244 // http://lists.dwarfstd.org/htdig.cgi/dwarf-discuss-dwarfstd.org/2011-December/001173.html
245 DataExtractor debugFrameData(getDebugFrameSection(), isLittleEndian(),
247 DebugFrame.reset(new DWARFDebugFrame());
248 DebugFrame->parse(debugFrameData);
249 return DebugFrame.get();
252 const DWARFLineTable *
253 DWARFContext::getLineTableForCompileUnit(DWARFCompileUnit *cu) {
255 Line.reset(new DWARFDebugLine(&lineRelocMap()));
257 unsigned stmtOffset =
258 cu->getCompileUnitDIE()->getAttributeValueAsUnsigned(cu, DW_AT_stmt_list,
260 if (stmtOffset == -1U)
261 return 0; // No line table for this compile unit.
263 // See if the line table is cached.
264 if (const DWARFLineTable *lt = Line->getLineTable(stmtOffset))
267 // We have to parse it first.
268 DataExtractor lineData(getLineSection(), isLittleEndian(),
269 cu->getAddressByteSize());
270 return Line->getOrParseLineTable(lineData, stmtOffset);
273 void DWARFContext::parseCompileUnits() {
275 const DataExtractor &DIData = DataExtractor(getInfoSection(),
276 isLittleEndian(), 0);
277 while (DIData.isValidOffset(offset)) {
278 OwningPtr<DWARFCompileUnit> CU(new DWARFCompileUnit(
279 getDebugAbbrev(), getInfoSection(), getAbbrevSection(),
280 getRangeSection(), getStringSection(), StringRef(), getAddrSection(),
281 &infoRelocMap(), isLittleEndian()));
282 if (!CU->extract(DIData, &offset)) {
285 CUs.push_back(CU.take());
286 offset = CUs.back()->getNextCompileUnitOffset();
290 void DWARFContext::parseDWOCompileUnits() {
292 const DataExtractor &DIData = DataExtractor(getInfoDWOSection(),
293 isLittleEndian(), 0);
294 while (DIData.isValidOffset(offset)) {
295 OwningPtr<DWARFCompileUnit> DWOCU(new DWARFCompileUnit(
296 getDebugAbbrevDWO(), getInfoDWOSection(), getAbbrevDWOSection(),
297 getRangeDWOSection(), getStringDWOSection(),
298 getStringOffsetDWOSection(), getAddrSection(), &infoDWORelocMap(),
300 if (!DWOCU->extract(DIData, &offset)) {
303 DWOCUs.push_back(DWOCU.take());
304 offset = DWOCUs.back()->getNextCompileUnitOffset();
309 struct OffsetComparator {
310 bool operator()(const DWARFCompileUnit *LHS,
311 const DWARFCompileUnit *RHS) const {
312 return LHS->getOffset() < RHS->getOffset();
314 bool operator()(const DWARFCompileUnit *LHS, uint32_t RHS) const {
315 return LHS->getOffset() < RHS;
317 bool operator()(uint32_t LHS, const DWARFCompileUnit *RHS) const {
318 return LHS < RHS->getOffset();
323 DWARFCompileUnit *DWARFContext::getCompileUnitForOffset(uint32_t Offset) {
327 DWARFCompileUnit **CU =
328 std::lower_bound(CUs.begin(), CUs.end(), Offset, OffsetComparator());
329 if (CU != CUs.end()) {
335 DWARFCompileUnit *DWARFContext::getCompileUnitForAddress(uint64_t Address) {
336 // First, get the offset of the compile unit.
337 uint32_t CUOffset = getDebugAranges()->findAddress(Address);
338 // Retrieve the compile unit.
339 return getCompileUnitForOffset(CUOffset);
342 static bool getFileNameForCompileUnit(DWARFCompileUnit *CU,
343 const DWARFLineTable *LineTable,
345 bool NeedsAbsoluteFilePath,
346 std::string &FileName) {
349 !LineTable->getFileNameByIndex(FileIndex, NeedsAbsoluteFilePath,
352 if (NeedsAbsoluteFilePath && sys::path::is_relative(FileName)) {
353 // We may still need to append compilation directory of compile unit.
354 SmallString<16> AbsolutePath;
355 if (const char *CompilationDir = CU->getCompilationDir()) {
356 sys::path::append(AbsolutePath, CompilationDir);
358 sys::path::append(AbsolutePath, FileName);
359 FileName = AbsolutePath.str();
364 static bool getFileLineInfoForCompileUnit(DWARFCompileUnit *CU,
365 const DWARFLineTable *LineTable,
367 bool NeedsAbsoluteFilePath,
368 std::string &FileName,
369 uint32_t &Line, uint32_t &Column) {
370 if (CU == 0 || LineTable == 0)
372 // Get the index of row we're looking for in the line table.
373 uint32_t RowIndex = LineTable->lookupAddress(Address);
376 // Take file number and line/column from the row.
377 const DWARFDebugLine::Row &Row = LineTable->Rows[RowIndex];
378 if (!getFileNameForCompileUnit(CU, LineTable, Row.File,
379 NeedsAbsoluteFilePath, FileName))
386 DILineInfo DWARFContext::getLineInfoForAddress(uint64_t Address,
387 DILineInfoSpecifier Specifier) {
388 DWARFCompileUnit *CU = getCompileUnitForAddress(Address);
391 std::string FileName = "<invalid>";
392 std::string FunctionName = "<invalid>";
395 if (Specifier.needs(DILineInfoSpecifier::FunctionName)) {
396 // The address may correspond to instruction in some inlined function,
397 // so we have to build the chain of inlined functions and take the
398 // name of the topmost function in it.
399 const DWARFDebugInfoEntryInlinedChain &InlinedChain =
400 CU->getInlinedChainForAddress(Address);
401 if (InlinedChain.DIEs.size() > 0) {
402 const DWARFDebugInfoEntryMinimal &TopFunctionDIE = InlinedChain.DIEs[0];
403 if (const char *Name = TopFunctionDIE.getSubroutineName(InlinedChain.CU))
407 if (Specifier.needs(DILineInfoSpecifier::FileLineInfo)) {
408 const DWARFLineTable *LineTable = getLineTableForCompileUnit(CU);
409 const bool NeedsAbsoluteFilePath =
410 Specifier.needs(DILineInfoSpecifier::AbsoluteFilePath);
411 getFileLineInfoForCompileUnit(CU, LineTable, Address,
412 NeedsAbsoluteFilePath,
413 FileName, Line, Column);
415 return DILineInfo(StringRef(FileName), StringRef(FunctionName),
419 DILineInfoTable DWARFContext::getLineInfoForAddressRange(uint64_t Address,
421 DILineInfoSpecifier Specifier) {
422 DILineInfoTable Lines;
423 DWARFCompileUnit *CU = getCompileUnitForAddress(Address);
427 std::string FunctionName = "<invalid>";
428 if (Specifier.needs(DILineInfoSpecifier::FunctionName)) {
429 // The address may correspond to instruction in some inlined function,
430 // so we have to build the chain of inlined functions and take the
431 // name of the topmost function in it.
432 const DWARFDebugInfoEntryInlinedChain &InlinedChain =
433 CU->getInlinedChainForAddress(Address);
434 if (InlinedChain.DIEs.size() > 0) {
435 const DWARFDebugInfoEntryMinimal &TopFunctionDIE = InlinedChain.DIEs[0];
436 if (const char *Name = TopFunctionDIE.getSubroutineName(InlinedChain.CU))
441 StringRef FuncNameRef = StringRef(FunctionName);
443 // If the Specifier says we don't need FileLineInfo, just
444 // return the top-most function at the starting address.
445 if (!Specifier.needs(DILineInfoSpecifier::FileLineInfo)) {
446 Lines.push_back(std::make_pair(Address,
447 DILineInfo(StringRef("<invalid>"),
448 FuncNameRef, 0, 0)));
452 const DWARFLineTable *LineTable = getLineTableForCompileUnit(CU);
453 const bool NeedsAbsoluteFilePath =
454 Specifier.needs(DILineInfoSpecifier::AbsoluteFilePath);
456 // Get the index of row we're looking for in the line table.
457 std::vector<uint32_t> RowVector;
458 if (!LineTable->lookupAddressRange(Address, Size, RowVector))
461 uint32_t NumRows = RowVector.size();
462 for (uint32_t i = 0; i < NumRows; ++i) {
463 uint32_t RowIndex = RowVector[i];
464 // Take file number and line/column from the row.
465 const DWARFDebugLine::Row &Row = LineTable->Rows[RowIndex];
466 std::string FileName = "<invalid>";
467 getFileNameForCompileUnit(CU, LineTable, Row.File,
468 NeedsAbsoluteFilePath, FileName);
469 Lines.push_back(std::make_pair(Row.Address,
470 DILineInfo(StringRef(FileName),
471 FuncNameRef, Row.Line, Row.Column)));
477 DIInliningInfo DWARFContext::getInliningInfoForAddress(uint64_t Address,
478 DILineInfoSpecifier Specifier) {
479 DWARFCompileUnit *CU = getCompileUnitForAddress(Address);
481 return DIInliningInfo();
483 const DWARFDebugInfoEntryInlinedChain &InlinedChain =
484 CU->getInlinedChainForAddress(Address);
485 if (InlinedChain.DIEs.size() == 0)
486 return DIInliningInfo();
488 DIInliningInfo InliningInfo;
489 uint32_t CallFile = 0, CallLine = 0, CallColumn = 0;
490 const DWARFLineTable *LineTable = 0;
491 for (uint32_t i = 0, n = InlinedChain.DIEs.size(); i != n; i++) {
492 const DWARFDebugInfoEntryMinimal &FunctionDIE = InlinedChain.DIEs[i];
493 std::string FileName = "<invalid>";
494 std::string FunctionName = "<invalid>";
497 // Get function name if necessary.
498 if (Specifier.needs(DILineInfoSpecifier::FunctionName)) {
499 if (const char *Name = FunctionDIE.getSubroutineName(InlinedChain.CU))
502 if (Specifier.needs(DILineInfoSpecifier::FileLineInfo)) {
503 const bool NeedsAbsoluteFilePath =
504 Specifier.needs(DILineInfoSpecifier::AbsoluteFilePath);
506 // For the topmost frame, initialize the line table of this
507 // compile unit and fetch file/line info from it.
508 LineTable = getLineTableForCompileUnit(CU);
509 // For the topmost routine, get file/line info from line table.
510 getFileLineInfoForCompileUnit(CU, LineTable, Address,
511 NeedsAbsoluteFilePath,
512 FileName, Line, Column);
514 // Otherwise, use call file, call line and call column from
515 // previous DIE in inlined chain.
516 getFileNameForCompileUnit(CU, LineTable, CallFile,
517 NeedsAbsoluteFilePath, FileName);
521 // Get call file/line/column of a current DIE.
523 FunctionDIE.getCallerFrame(InlinedChain.CU, CallFile, CallLine,
527 DILineInfo Frame(StringRef(FileName), StringRef(FunctionName),
529 InliningInfo.addFrame(Frame);
534 static bool consumeCompressedDebugSectionHeader(StringRef &data,
535 uint64_t &OriginalSize) {
536 // Consume "ZLIB" prefix.
537 if (!data.startswith("ZLIB"))
539 data = data.substr(4);
540 // Consume uncompressed section size (big-endian 8 bytes).
541 DataExtractor extractor(data, false, 8);
543 OriginalSize = extractor.getU64(&Offset);
546 data = data.substr(Offset);
550 DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) :
551 IsLittleEndian(Obj->isLittleEndian()),
552 AddressSize(Obj->getBytesInAddress()) {
554 for (object::section_iterator i = Obj->begin_sections(),
555 e = Obj->end_sections();
556 i != e; i.increment(ec)) {
560 i->getContents(data);
562 name = name.substr(name.find_first_not_of("._")); // Skip . and _ prefixes.
564 // Check if debug info section is compressed with zlib.
565 if (name.startswith("zdebug_")) {
566 uint64_t OriginalSize;
567 if (!zlib::isAvailable() ||
568 !consumeCompressedDebugSectionHeader(data, OriginalSize))
570 OwningPtr<MemoryBuffer> UncompressedSection;
571 if (zlib::uncompress(data, UncompressedSection, OriginalSize) !=
574 // Make data point to uncompressed section contents and save its contents.
575 name = name.substr(1);
576 data = UncompressedSection->getBuffer();
577 UncompressedSections.push_back(UncompressedSection.take());
580 StringRef *Section = StringSwitch<StringRef*>(name)
581 .Case("debug_info", &InfoSection)
582 .Case("debug_abbrev", &AbbrevSection)
583 .Case("debug_loc", &LocSection)
584 .Case("debug_line", &LineSection)
585 .Case("debug_aranges", &ARangeSection)
586 .Case("debug_frame", &DebugFrameSection)
587 .Case("debug_str", &StringSection)
588 .Case("debug_ranges", &RangeSection)
589 .Case("debug_pubnames", &PubNamesSection)
590 .Case("debug_gnu_pubnames", &GnuPubNamesSection)
591 .Case("debug_info.dwo", &InfoDWOSection)
592 .Case("debug_abbrev.dwo", &AbbrevDWOSection)
593 .Case("debug_str.dwo", &StringDWOSection)
594 .Case("debug_str_offsets.dwo", &StringOffsetDWOSection)
595 .Case("debug_addr", &AddrSection)
596 // Any more debug info sections go here.
600 if (name == "debug_ranges") {
601 // FIXME: Use the other dwo range section when we emit it.
602 RangeDWOSection = data;
606 section_iterator RelocatedSection = i->getRelocatedSection();
607 if (RelocatedSection == Obj->end_sections())
610 StringRef RelSecName;
611 RelocatedSection->getName(RelSecName);
612 RelSecName = RelSecName.substr(
613 RelSecName.find_first_not_of("._")); // Skip . and _ prefixes.
615 // TODO: Add support for relocations in other sections as needed.
616 // Record relocations for the debug_info and debug_line sections.
617 RelocAddrMap *Map = StringSwitch<RelocAddrMap*>(RelSecName)
618 .Case("debug_info", &InfoRelocMap)
619 .Case("debug_loc", &LocRelocMap)
620 .Case("debug_info.dwo", &InfoDWORelocMap)
621 .Case("debug_line", &LineRelocMap)
626 if (i->begin_relocations() != i->end_relocations()) {
627 uint64_t SectionSize;
628 RelocatedSection->getSize(SectionSize);
629 for (object::relocation_iterator reloc_i = i->begin_relocations(),
630 reloc_e = i->end_relocations();
631 reloc_i != reloc_e; reloc_i.increment(ec)) {
633 reloc_i->getOffset(Address);
635 reloc_i->getType(Type);
636 uint64_t SymAddr = 0;
637 // ELF relocations may need the symbol address
639 object::symbol_iterator Sym = reloc_i->getSymbol();
640 Sym->getAddress(SymAddr);
643 object::RelocVisitor V(Obj->getFileFormatName());
644 // The section address is always 0 for debug sections.
645 object::RelocToApply R(V.visit(Type, *reloc_i, 0, SymAddr));
647 SmallString<32> Name;
648 error_code ec(reloc_i->getTypeName(Name));
650 errs() << "Aaaaaa! Nameless relocation! Aaaaaa!\n";
652 errs() << "error: failed to compute relocation: "
657 if (Address + R.Width > SectionSize) {
658 errs() << "error: " << R.Width << "-byte relocation starting "
659 << Address << " bytes into section " << name << " which is "
660 << SectionSize << " bytes long.\n";
664 errs() << "error: can't handle a relocation of more than 8 bytes at "
668 DEBUG(dbgs() << "Writing " << format("%p", R.Value)
669 << " at " << format("%p", Address)
670 << " with width " << format("%d", R.Width)
672 Map->insert(std::make_pair(Address, std::make_pair(R.Width, R.Value)));
678 DWARFContextInMemory::~DWARFContextInMemory() {
679 DeleteContainerPointers(UncompressedSections);
682 void DWARFContextInMemory::anchor() { }