Eugene Zelenko | 28db7e6 | 2017-03-01 01:14:23 +0000 | [diff] [blame] | 1 | //===- DWARFContext.cpp ---------------------------------------------------===// |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
Alexey Samsonov | e16e16a | 2012-07-19 07:03:58 +0000 | [diff] [blame] | 10 | #include "llvm/ADT/SmallString.h" |
Eugene Zelenko | 28db7e6 | 2017-03-01 01:14:23 +0000 | [diff] [blame] | 11 | #include "llvm/ADT/SmallVector.h" |
| 12 | #include "llvm/ADT/STLExtras.h" |
Alexey Samsonov | 3d0e3ed | 2013-04-17 14:27:04 +0000 | [diff] [blame] | 13 | #include "llvm/ADT/StringSwitch.h" |
Eugene Zelenko | 28db7e6 | 2017-03-01 01:14:23 +0000 | [diff] [blame] | 14 | #include "llvm/ADT/StringRef.h" |
Zachary Turner | 82af943 | 2015-01-30 18:07:45 +0000 | [diff] [blame] | 15 | #include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h" |
Eugene Zelenko | 28db7e6 | 2017-03-01 01:14:23 +0000 | [diff] [blame] | 16 | #include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h" |
| 17 | #include "llvm/DebugInfo/DWARF/DWARFContext.h" |
| 18 | #include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h" |
| 19 | #include "llvm/DebugInfo/DWARF/DWARFDebugAranges.h" |
Zachary Turner | 82af943 | 2015-01-30 18:07:45 +0000 | [diff] [blame] | 20 | #include "llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h" |
Eugene Zelenko | 28db7e6 | 2017-03-01 01:14:23 +0000 | [diff] [blame] | 21 | #include "llvm/DebugInfo/DWARF/DWARFDebugFrame.h" |
| 22 | #include "llvm/DebugInfo/DWARF/DWARFDebugLine.h" |
| 23 | #include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h" |
| 24 | #include "llvm/DebugInfo/DWARF/DWARFDebugMacro.h" |
George Rimar | e71e33f | 2016-12-17 09:10:32 +0000 | [diff] [blame] | 25 | #include "llvm/DebugInfo/DWARF/DWARFDebugPubTable.h" |
Eugene Zelenko | 28db7e6 | 2017-03-01 01:14:23 +0000 | [diff] [blame] | 26 | #include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h" |
| 27 | #include "llvm/DebugInfo/DWARF/DWARFDie.h" |
| 28 | #include "llvm/DebugInfo/DWARF/DWARFFormValue.h" |
| 29 | #include "llvm/DebugInfo/DWARF/DWARFGdbIndex.h" |
| 30 | #include "llvm/DebugInfo/DWARF/DWARFSection.h" |
David Blaikie | 65a8efe | 2015-11-11 19:28:21 +0000 | [diff] [blame] | 31 | #include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h" |
George Rimar | 4bf3083 | 2017-01-11 15:26:41 +0000 | [diff] [blame] | 32 | #include "llvm/Object/Decompressor.h" |
Reid Kleckner | dafc5d7 | 2016-07-06 16:56:42 +0000 | [diff] [blame] | 33 | #include "llvm/Object/MachO.h" |
Eugene Zelenko | 28db7e6 | 2017-03-01 01:14:23 +0000 | [diff] [blame] | 34 | #include "llvm/Object/ObjectFile.h" |
Reid Kleckner | dafc5d7 | 2016-07-06 16:56:42 +0000 | [diff] [blame] | 35 | #include "llvm/Object/RelocVisitor.h" |
Eugene Zelenko | 28db7e6 | 2017-03-01 01:14:23 +0000 | [diff] [blame] | 36 | #include "llvm/Support/Casting.h" |
| 37 | #include "llvm/Support/DataExtractor.h" |
| 38 | #include "llvm/Support/Debug.h" |
| 39 | #include "llvm/Support/Error.h" |
Benjamin Kramer | 07d4b1c | 2011-09-15 16:57:13 +0000 | [diff] [blame] | 40 | #include "llvm/Support/Format.h" |
Eugene Zelenko | 28db7e6 | 2017-03-01 01:14:23 +0000 | [diff] [blame] | 41 | #include "llvm/Support/MemoryBuffer.h" |
Benjamin Kramer | a6002fd | 2011-09-14 01:09:52 +0000 | [diff] [blame] | 42 | #include "llvm/Support/raw_ostream.h" |
Benjamin Kramer | 2602ca6 | 2011-09-15 20:43:22 +0000 | [diff] [blame] | 43 | #include <algorithm> |
Eugene Zelenko | 28db7e6 | 2017-03-01 01:14:23 +0000 | [diff] [blame] | 44 | #include <cstdint> |
Greg Clayton | c7695a8 | 2017-05-02 20:28:33 +0000 | [diff] [blame] | 45 | #include <map> |
| 46 | #include <set> |
Eugene Zelenko | 28db7e6 | 2017-03-01 01:14:23 +0000 | [diff] [blame] | 47 | #include <string> |
| 48 | #include <utility> |
| 49 | #include <vector> |
| 50 | |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 51 | using namespace llvm; |
Benjamin Kramer | 6dda032 | 2011-09-15 18:02:20 +0000 | [diff] [blame] | 52 | using namespace dwarf; |
Rafael Espindola | 4f60a38 | 2013-05-30 03:05:14 +0000 | [diff] [blame] | 53 | using namespace object; |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 54 | |
Chandler Carruth | e96dd89 | 2014-04-21 22:55:11 +0000 | [diff] [blame] | 55 | #define DEBUG_TYPE "dwarf" |
| 56 | |
Eric Christopher | 494109b | 2012-10-16 23:46:25 +0000 | [diff] [blame] | 57 | typedef DWARFDebugLine::LineTable DWARFLineTable; |
Alexey Samsonov | dce6734 | 2014-05-15 21:24:32 +0000 | [diff] [blame] | 58 | typedef DILineInfoSpecifier::FileLineInfoKind FileLineInfoKind; |
| 59 | typedef DILineInfoSpecifier::FunctionNameKind FunctionNameKind; |
Eric Christopher | 494109b | 2012-10-16 23:46:25 +0000 | [diff] [blame] | 60 | |
George Rimar | f8a9642 | 2017-04-21 09:12:18 +0000 | [diff] [blame] | 61 | uint64_t llvm::getRelocatedValue(const DataExtractor &Data, uint32_t Size, |
| 62 | uint32_t *Off, const RelocAddrMap *Relocs) { |
| 63 | if (!Relocs) |
| 64 | return Data.getUnsigned(Off, Size); |
| 65 | RelocAddrMap::const_iterator AI = Relocs->find(*Off); |
| 66 | if (AI == Relocs->end()) |
| 67 | return Data.getUnsigned(Off, Size); |
| 68 | return Data.getUnsigned(Off, Size) + AI->second.second; |
| 69 | } |
| 70 | |
Frederic Riss | 7c50047 | 2014-11-14 19:30:08 +0000 | [diff] [blame] | 71 | static void dumpAccelSection(raw_ostream &OS, StringRef Name, |
| 72 | const DWARFSection& Section, StringRef StringSection, |
| 73 | bool LittleEndian) { |
| 74 | DataExtractor AccelSection(Section.Data, LittleEndian, 0); |
Frederic Riss | e837ec2 | 2014-11-14 16:15:53 +0000 | [diff] [blame] | 75 | DataExtractor StrData(StringSection, LittleEndian, 0); |
| 76 | OS << "\n." << Name << " contents:\n"; |
Frederic Riss | 7c50047 | 2014-11-14 19:30:08 +0000 | [diff] [blame] | 77 | DWARFAcceleratorTable Accel(AccelSection, StrData, Section.Relocs); |
Frederic Riss | e837ec2 | 2014-11-14 16:15:53 +0000 | [diff] [blame] | 78 | if (!Accel.extract()) |
| 79 | return; |
| 80 | Accel.dump(OS); |
| 81 | } |
| 82 | |
David Blaikie | 50cc27e | 2016-10-18 21:09:48 +0000 | [diff] [blame] | 83 | void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType, bool DumpEH, |
| 84 | bool SummarizeTypes) { |
Eli Bendersky | 7a94daa | 2013-01-25 20:26:43 +0000 | [diff] [blame] | 85 | if (DumpType == DIDT_All || DumpType == DIDT_Abbrev) { |
| 86 | OS << ".debug_abbrev contents:\n"; |
| 87 | getDebugAbbrev()->dump(OS); |
| 88 | } |
Benjamin Kramer | a6002fd | 2011-09-14 01:09:52 +0000 | [diff] [blame] | 89 | |
David Blaikie | 66865d6 | 2014-01-09 00:13:35 +0000 | [diff] [blame] | 90 | if (DumpType == DIDT_All || DumpType == DIDT_AbbrevDwo) |
| 91 | if (const DWARFDebugAbbrev *D = getDebugAbbrevDWO()) { |
David Blaikie | 622dce4 | 2014-01-08 23:29:59 +0000 | [diff] [blame] | 92 | OS << "\n.debug_abbrev.dwo contents:\n"; |
David Blaikie | 66865d6 | 2014-01-09 00:13:35 +0000 | [diff] [blame] | 93 | D->dump(OS); |
David Blaikie | 622dce4 | 2014-01-08 23:29:59 +0000 | [diff] [blame] | 94 | } |
David Blaikie | 622dce4 | 2014-01-08 23:29:59 +0000 | [diff] [blame] | 95 | |
Eli Bendersky | 7a94daa | 2013-01-25 20:26:43 +0000 | [diff] [blame] | 96 | if (DumpType == DIDT_All || DumpType == DIDT_Info) { |
| 97 | OS << "\n.debug_info contents:\n"; |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 98 | for (const auto &CU : compile_units()) |
| 99 | CU->dump(OS); |
Eli Bendersky | 7a94daa | 2013-01-25 20:26:43 +0000 | [diff] [blame] | 100 | } |
Benjamin Kramer | a6002fd | 2011-09-14 01:09:52 +0000 | [diff] [blame] | 101 | |
David Blaikie | 66865d6 | 2014-01-09 00:13:35 +0000 | [diff] [blame] | 102 | if ((DumpType == DIDT_All || DumpType == DIDT_InfoDwo) && |
| 103 | getNumDWOCompileUnits()) { |
| 104 | OS << "\n.debug_info.dwo contents:\n"; |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 105 | for (const auto &DWOCU : dwo_compile_units()) |
| 106 | DWOCU->dump(OS); |
David Blaikie | 66865d6 | 2014-01-09 00:13:35 +0000 | [diff] [blame] | 107 | } |
David Blaikie | 622dce4 | 2014-01-08 23:29:59 +0000 | [diff] [blame] | 108 | |
David Blaikie | 66865d6 | 2014-01-09 00:13:35 +0000 | [diff] [blame] | 109 | if ((DumpType == DIDT_All || DumpType == DIDT_Types) && getNumTypeUnits()) { |
David Blaikie | 03c089c | 2013-09-23 22:44:47 +0000 | [diff] [blame] | 110 | OS << "\n.debug_types contents:\n"; |
Frederic Riss | 312a02e | 2014-09-29 13:56:39 +0000 | [diff] [blame] | 111 | for (const auto &TUS : type_unit_sections()) |
| 112 | for (const auto &TU : TUS) |
David Blaikie | 50cc27e | 2016-10-18 21:09:48 +0000 | [diff] [blame] | 113 | TU->dump(OS, SummarizeTypes); |
David Blaikie | 03c089c | 2013-09-23 22:44:47 +0000 | [diff] [blame] | 114 | } |
| 115 | |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 116 | if ((DumpType == DIDT_All || DumpType == DIDT_TypesDwo) && |
| 117 | getNumDWOTypeUnits()) { |
| 118 | OS << "\n.debug_types.dwo contents:\n"; |
Frederic Riss | 312a02e | 2014-09-29 13:56:39 +0000 | [diff] [blame] | 119 | for (const auto &DWOTUS : dwo_type_unit_sections()) |
| 120 | for (const auto &DWOTU : DWOTUS) |
David Blaikie | 50cc27e | 2016-10-18 21:09:48 +0000 | [diff] [blame] | 121 | DWOTU->dump(OS, SummarizeTypes); |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 122 | } |
David Blaikie | 92d9d62 | 2014-01-09 05:08:24 +0000 | [diff] [blame] | 123 | |
David Blaikie | 18e7350 | 2013-06-19 21:37:13 +0000 | [diff] [blame] | 124 | if (DumpType == DIDT_All || DumpType == DIDT_Loc) { |
David Blaikie | 03c089c | 2013-09-23 22:44:47 +0000 | [diff] [blame] | 125 | OS << "\n.debug_loc contents:\n"; |
David Blaikie | 18e7350 | 2013-06-19 21:37:13 +0000 | [diff] [blame] | 126 | getDebugLoc()->dump(OS); |
| 127 | } |
| 128 | |
David Blaikie | 9c550ac | 2014-03-25 01:44:02 +0000 | [diff] [blame] | 129 | if (DumpType == DIDT_All || DumpType == DIDT_LocDwo) { |
| 130 | OS << "\n.debug_loc.dwo contents:\n"; |
| 131 | getDebugLocDWO()->dump(OS); |
| 132 | } |
| 133 | |
Eli Bendersky | fd08bc1 | 2013-02-05 23:30:58 +0000 | [diff] [blame] | 134 | if (DumpType == DIDT_All || DumpType == DIDT_Frames) { |
| 135 | OS << "\n.debug_frame contents:\n"; |
| 136 | getDebugFrame()->dump(OS); |
Igor Laevsky | 03a670c | 2016-01-26 15:09:42 +0000 | [diff] [blame] | 137 | if (DumpEH) { |
| 138 | OS << "\n.eh_frame contents:\n"; |
| 139 | getEHFrame()->dump(OS); |
| 140 | } |
Eli Bendersky | fd08bc1 | 2013-02-05 23:30:58 +0000 | [diff] [blame] | 141 | } |
| 142 | |
Amjad Aboud | e59cc3e | 2015-11-12 09:38:54 +0000 | [diff] [blame] | 143 | if (DumpType == DIDT_All || DumpType == DIDT_Macro) { |
| 144 | OS << "\n.debug_macinfo contents:\n"; |
| 145 | getDebugMacro()->dump(OS); |
| 146 | } |
| 147 | |
Benjamin Kramer | a6002fd | 2011-09-14 01:09:52 +0000 | [diff] [blame] | 148 | uint32_t offset = 0; |
Eli Bendersky | 7a94daa | 2013-01-25 20:26:43 +0000 | [diff] [blame] | 149 | if (DumpType == DIDT_All || DumpType == DIDT_Aranges) { |
| 150 | OS << "\n.debug_aranges contents:\n"; |
| 151 | DataExtractor arangesData(getARangeSection(), isLittleEndian(), 0); |
| 152 | DWARFDebugArangeSet set; |
| 153 | while (set.extract(arangesData, &offset)) |
| 154 | set.dump(OS); |
| 155 | } |
Benjamin Kramer | 5acab50 | 2011-09-15 02:12:05 +0000 | [diff] [blame] | 156 | |
Alexey Samsonov | 034e57a | 2012-08-27 07:17:47 +0000 | [diff] [blame] | 157 | uint8_t savedAddressByteSize = 0; |
Eli Bendersky | 7a94daa | 2013-01-25 20:26:43 +0000 | [diff] [blame] | 158 | if (DumpType == DIDT_All || DumpType == DIDT_Line) { |
| 159 | OS << "\n.debug_line contents:\n"; |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 160 | for (const auto &CU : compile_units()) { |
| 161 | savedAddressByteSize = CU->getAddressByteSize(); |
Greg Clayton | c8c1032 | 2016-12-13 18:25:19 +0000 | [diff] [blame] | 162 | auto CUDIE = CU->getUnitDIE(); |
| 163 | if (!CUDIE) |
Alexey Samsonov | 7a18c06 | 2015-05-19 21:54:32 +0000 | [diff] [blame] | 164 | continue; |
Greg Clayton | 97d2218 | 2017-01-13 21:08:18 +0000 | [diff] [blame] | 165 | if (auto StmtOffset = toSectionOffset(CUDIE.find(DW_AT_stmt_list))) { |
David Blaikie | 1b5ee5d | 2013-09-23 17:42:01 +0000 | [diff] [blame] | 166 | DataExtractor lineData(getLineSection().Data, isLittleEndian(), |
Eli Bendersky | 7a94daa | 2013-01-25 20:26:43 +0000 | [diff] [blame] | 167 | savedAddressByteSize); |
Alexey Samsonov | 110d595 | 2014-04-30 00:09:19 +0000 | [diff] [blame] | 168 | DWARFDebugLine::LineTable LineTable; |
Greg Clayton | 52fe1f6 | 2016-12-14 22:38:08 +0000 | [diff] [blame] | 169 | uint32_t Offset = *StmtOffset; |
| 170 | LineTable.parse(lineData, &getLineSection().Relocs, &Offset); |
Alexey Samsonov | 110d595 | 2014-04-30 00:09:19 +0000 | [diff] [blame] | 171 | LineTable.dump(OS); |
Eli Bendersky | 7a94daa | 2013-01-25 20:26:43 +0000 | [diff] [blame] | 172 | } |
Benjamin Kramer | 6dda032 | 2011-09-15 18:02:20 +0000 | [diff] [blame] | 173 | } |
| 174 | } |
Benjamin Kramer | 07d4b1c | 2011-09-15 16:57:13 +0000 | [diff] [blame] | 175 | |
David Blaikie | 65a8efe | 2015-11-11 19:28:21 +0000 | [diff] [blame] | 176 | if (DumpType == DIDT_All || DumpType == DIDT_CUIndex) { |
| 177 | OS << "\n.debug_cu_index contents:\n"; |
David Blaikie | b073cb9 | 2015-12-02 06:21:34 +0000 | [diff] [blame] | 178 | getCUIndex().dump(OS); |
David Blaikie | 65a8efe | 2015-11-11 19:28:21 +0000 | [diff] [blame] | 179 | } |
| 180 | |
David Blaikie | 51c4028 | 2015-11-11 19:40:49 +0000 | [diff] [blame] | 181 | if (DumpType == DIDT_All || DumpType == DIDT_TUIndex) { |
| 182 | OS << "\n.debug_tu_index contents:\n"; |
David Blaikie | b073cb9 | 2015-12-02 06:21:34 +0000 | [diff] [blame] | 183 | getTUIndex().dump(OS); |
David Blaikie | 51c4028 | 2015-11-11 19:40:49 +0000 | [diff] [blame] | 184 | } |
| 185 | |
David Blaikie | 1d4736e | 2014-02-24 23:58:54 +0000 | [diff] [blame] | 186 | if (DumpType == DIDT_All || DumpType == DIDT_LineDwo) { |
| 187 | OS << "\n.debug_line.dwo contents:\n"; |
| 188 | unsigned stmtOffset = 0; |
| 189 | DataExtractor lineData(getLineDWOSection().Data, isLittleEndian(), |
| 190 | savedAddressByteSize); |
Alexey Samsonov | 110d595 | 2014-04-30 00:09:19 +0000 | [diff] [blame] | 191 | DWARFDebugLine::LineTable LineTable; |
| 192 | while (LineTable.Prologue.parse(lineData, &stmtOffset)) { |
| 193 | LineTable.dump(OS); |
| 194 | LineTable.clear(); |
| 195 | } |
David Blaikie | 1d4736e | 2014-02-24 23:58:54 +0000 | [diff] [blame] | 196 | } |
| 197 | |
Eli Bendersky | 7a94daa | 2013-01-25 20:26:43 +0000 | [diff] [blame] | 198 | if (DumpType == DIDT_All || DumpType == DIDT_Str) { |
| 199 | OS << "\n.debug_str contents:\n"; |
| 200 | DataExtractor strData(getStringSection(), isLittleEndian(), 0); |
| 201 | offset = 0; |
| 202 | uint32_t strOffset = 0; |
| 203 | while (const char *s = strData.getCStr(&offset)) { |
| 204 | OS << format("0x%8.8x: \"%s\"\n", strOffset, s); |
| 205 | strOffset = offset; |
| 206 | } |
Benjamin Kramer | 07d4b1c | 2011-09-15 16:57:13 +0000 | [diff] [blame] | 207 | } |
Alexey Samsonov | 034e57a | 2012-08-27 07:17:47 +0000 | [diff] [blame] | 208 | |
David Blaikie | 66865d6 | 2014-01-09 00:13:35 +0000 | [diff] [blame] | 209 | if ((DumpType == DIDT_All || DumpType == DIDT_StrDwo) && |
| 210 | !getStringDWOSection().empty()) { |
| 211 | OS << "\n.debug_str.dwo contents:\n"; |
| 212 | DataExtractor strDWOData(getStringDWOSection(), isLittleEndian(), 0); |
| 213 | offset = 0; |
| 214 | uint32_t strDWOOffset = 0; |
| 215 | while (const char *s = strDWOData.getCStr(&offset)) { |
| 216 | OS << format("0x%8.8x: \"%s\"\n", strDWOOffset, s); |
| 217 | strDWOOffset = offset; |
David Blaikie | 622dce4 | 2014-01-08 23:29:59 +0000 | [diff] [blame] | 218 | } |
David Blaikie | 66865d6 | 2014-01-09 00:13:35 +0000 | [diff] [blame] | 219 | } |
David Blaikie | 622dce4 | 2014-01-08 23:29:59 +0000 | [diff] [blame] | 220 | |
Eli Bendersky | 7a94daa | 2013-01-25 20:26:43 +0000 | [diff] [blame] | 221 | if (DumpType == DIDT_All || DumpType == DIDT_Ranges) { |
| 222 | OS << "\n.debug_ranges contents:\n"; |
| 223 | // In fact, different compile units may have different address byte |
| 224 | // sizes, but for simplicity we just use the address byte size of the last |
| 225 | // compile unit (there is no easy and fast way to associate address range |
| 226 | // list and the compile unit it describes). |
George Rimar | ca53211 | 2017-04-24 10:19:45 +0000 | [diff] [blame] | 227 | DataExtractor rangesData(getRangeSection().Data, isLittleEndian(), |
Eli Bendersky | 7a94daa | 2013-01-25 20:26:43 +0000 | [diff] [blame] | 228 | savedAddressByteSize); |
| 229 | offset = 0; |
| 230 | DWARFDebugRangeList rangeList; |
George Rimar | ca53211 | 2017-04-24 10:19:45 +0000 | [diff] [blame] | 231 | while (rangeList.extract(rangesData, &offset, getRangeSection().Relocs)) |
Eli Bendersky | 7a94daa | 2013-01-25 20:26:43 +0000 | [diff] [blame] | 232 | rangeList.dump(OS); |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 233 | } |
Eric Christopher | 962c908 | 2013-01-15 23:56:56 +0000 | [diff] [blame] | 234 | |
Eric Christopher | 0de5359 | 2013-09-25 23:02:36 +0000 | [diff] [blame] | 235 | if (DumpType == DIDT_All || DumpType == DIDT_Pubnames) |
George Rimar | e71e33f | 2016-12-17 09:10:32 +0000 | [diff] [blame] | 236 | DWARFDebugPubTable(getPubNamesSection(), isLittleEndian(), false) |
| 237 | .dump("debug_pubnames", OS); |
Krzysztof Parzyszek | 97438dc | 2013-02-12 16:20:28 +0000 | [diff] [blame] | 238 | |
Eric Christopher | 4c7e6ba | 2013-09-25 23:02:41 +0000 | [diff] [blame] | 239 | if (DumpType == DIDT_All || DumpType == DIDT_Pubtypes) |
George Rimar | e71e33f | 2016-12-17 09:10:32 +0000 | [diff] [blame] | 240 | DWARFDebugPubTable(getPubTypesSection(), isLittleEndian(), false) |
| 241 | .dump("debug_pubtypes", OS); |
Eric Christopher | 4c7e6ba | 2013-09-25 23:02:41 +0000 | [diff] [blame] | 242 | |
David Blaikie | ecd21ff | 2013-09-24 19:50:00 +0000 | [diff] [blame] | 243 | if (DumpType == DIDT_All || DumpType == DIDT_GnuPubnames) |
George Rimar | e71e33f | 2016-12-17 09:10:32 +0000 | [diff] [blame] | 244 | DWARFDebugPubTable(getGnuPubNamesSection(), isLittleEndian(), |
| 245 | true /* GnuStyle */) |
| 246 | .dump("debug_gnu_pubnames", OS); |
David Blaikie | ecd21ff | 2013-09-24 19:50:00 +0000 | [diff] [blame] | 247 | |
| 248 | if (DumpType == DIDT_All || DumpType == DIDT_GnuPubtypes) |
George Rimar | e71e33f | 2016-12-17 09:10:32 +0000 | [diff] [blame] | 249 | DWARFDebugPubTable(getGnuPubTypesSection(), isLittleEndian(), |
| 250 | true /* GnuStyle */) |
| 251 | .dump("debug_gnu_pubtypes", OS); |
David Blaikie | 404d304 | 2013-09-19 23:01:29 +0000 | [diff] [blame] | 252 | |
David Blaikie | 66865d6 | 2014-01-09 00:13:35 +0000 | [diff] [blame] | 253 | if ((DumpType == DIDT_All || DumpType == DIDT_StrOffsetsDwo) && |
| 254 | !getStringOffsetDWOSection().empty()) { |
| 255 | OS << "\n.debug_str_offsets.dwo contents:\n"; |
| 256 | DataExtractor strOffsetExt(getStringOffsetDWOSection(), isLittleEndian(), |
| 257 | 0); |
| 258 | offset = 0; |
| 259 | uint64_t size = getStringOffsetDWOSection().size(); |
| 260 | while (offset < size) { |
| 261 | OS << format("0x%8.8x: ", offset); |
| 262 | OS << format("%8.8x\n", strOffsetExt.getU32(&offset)); |
Eric Christopher | 92f3c0b | 2013-05-06 17:50:42 +0000 | [diff] [blame] | 263 | } |
David Blaikie | 66865d6 | 2014-01-09 00:13:35 +0000 | [diff] [blame] | 264 | } |
Frederic Riss | e837ec2 | 2014-11-14 16:15:53 +0000 | [diff] [blame] | 265 | |
George Rimar | 4f82df5 | 2016-09-23 11:01:53 +0000 | [diff] [blame] | 266 | if ((DumpType == DIDT_All || DumpType == DIDT_GdbIndex) && |
| 267 | !getGdbIndexSection().empty()) { |
| 268 | OS << "\n.gnu_index contents:\n"; |
| 269 | getGdbIndex().dump(OS); |
| 270 | } |
| 271 | |
Frederic Riss | e837ec2 | 2014-11-14 16:15:53 +0000 | [diff] [blame] | 272 | if (DumpType == DIDT_All || DumpType == DIDT_AppleNames) |
| 273 | dumpAccelSection(OS, "apple_names", getAppleNamesSection(), |
| 274 | getStringSection(), isLittleEndian()); |
| 275 | |
| 276 | if (DumpType == DIDT_All || DumpType == DIDT_AppleTypes) |
| 277 | dumpAccelSection(OS, "apple_types", getAppleTypesSection(), |
| 278 | getStringSection(), isLittleEndian()); |
| 279 | |
| 280 | if (DumpType == DIDT_All || DumpType == DIDT_AppleNamespaces) |
| 281 | dumpAccelSection(OS, "apple_namespaces", getAppleNamespacesSection(), |
| 282 | getStringSection(), isLittleEndian()); |
| 283 | |
| 284 | if (DumpType == DIDT_All || DumpType == DIDT_AppleObjC) |
| 285 | dumpAccelSection(OS, "apple_objc", getAppleObjCSection(), |
| 286 | getStringSection(), isLittleEndian()); |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 287 | } |
| 288 | |
Greg Clayton | c7695a8 | 2017-05-02 20:28:33 +0000 | [diff] [blame] | 289 | DWARFDie DWARFContext::getDIEForOffset(uint32_t Offset) { |
| 290 | parseCompileUnits(); |
| 291 | if (auto *CU = CUs.getUnitForOffset(Offset)) |
| 292 | return CU->getDIEForOffset(Offset); |
| 293 | return DWARFDie(); |
| 294 | } |
| 295 | |
| 296 | namespace { |
| 297 | |
| 298 | class Verifier { |
| 299 | raw_ostream &OS; |
| 300 | DWARFContext &DCtx; |
| 301 | public: |
| 302 | Verifier(raw_ostream &S, DWARFContext &D) : OS(S), DCtx(D) {} |
| 303 | |
| 304 | bool HandleDebugInfo() { |
| 305 | bool Success = true; |
| 306 | // A map that tracks all references (converted absolute references) so we |
| 307 | // can verify each reference points to a valid DIE and not an offset that |
| 308 | // lies between to valid DIEs. |
| 309 | std::map<uint64_t, std::set<uint32_t>> ReferenceToDIEOffsets; |
| 310 | |
Greg Clayton | 48432cf | 2017-05-01 22:07:02 +0000 | [diff] [blame] | 311 | OS << "Verifying .debug_info...\n"; |
Greg Clayton | c7695a8 | 2017-05-02 20:28:33 +0000 | [diff] [blame] | 312 | for (const auto &CU : DCtx.compile_units()) { |
Greg Clayton | 48432cf | 2017-05-01 22:07:02 +0000 | [diff] [blame] | 313 | unsigned NumDies = CU->getNumDIEs(); |
| 314 | for (unsigned I = 0; I < NumDies; ++I) { |
| 315 | auto Die = CU->getDIEAtIndex(I); |
| 316 | const auto Tag = Die.getTag(); |
| 317 | if (Tag == DW_TAG_null) |
| 318 | continue; |
| 319 | for (auto AttrValue : Die.attributes()) { |
| 320 | const auto Attr = AttrValue.Attr; |
| 321 | const auto Form = AttrValue.Value.getForm(); |
| 322 | switch (Attr) { |
Greg Clayton | c7695a8 | 2017-05-02 20:28:33 +0000 | [diff] [blame] | 323 | case DW_AT_ranges: |
| 324 | // Make sure the offset in the DW_AT_ranges attribute is valid. |
| 325 | if (auto SectionOffset = AttrValue.Value.getAsSectionOffset()) { |
| 326 | if (*SectionOffset >= DCtx.getRangeSection().Data.size()) { |
| 327 | Success = false; |
| 328 | OS << "error: DW_AT_ranges offset is beyond .debug_ranges " |
| 329 | "bounds:\n"; |
| 330 | Die.dump(OS, 0); |
| 331 | OS << "\n"; |
| 332 | } |
| 333 | } else { |
Greg Clayton | 48432cf | 2017-05-01 22:07:02 +0000 | [diff] [blame] | 334 | Success = false; |
Greg Clayton | c7695a8 | 2017-05-02 20:28:33 +0000 | [diff] [blame] | 335 | OS << "error: DIE has invalid DW_AT_ranges encoding:\n"; |
Greg Clayton | 48432cf | 2017-05-01 22:07:02 +0000 | [diff] [blame] | 336 | Die.dump(OS, 0); |
| 337 | OS << "\n"; |
| 338 | } |
Greg Clayton | c7695a8 | 2017-05-02 20:28:33 +0000 | [diff] [blame] | 339 | break; |
| 340 | case DW_AT_stmt_list: |
| 341 | // Make sure the offset in the DW_AT_stmt_list attribute is valid. |
| 342 | if (auto SectionOffset = AttrValue.Value.getAsSectionOffset()) { |
| 343 | if (*SectionOffset >= DCtx.getLineSection().Data.size()) { |
| 344 | Success = false; |
| 345 | OS << "error: DW_AT_stmt_list offset is beyond .debug_line " |
| 346 | "bounds: " |
| 347 | << format("0x%08" PRIx32, *SectionOffset) << "\n"; |
| 348 | CU->getUnitDIE().dump(OS, 0); |
| 349 | OS << "\n"; |
| 350 | } |
| 351 | } else { |
Greg Clayton | 48432cf | 2017-05-01 22:07:02 +0000 | [diff] [blame] | 352 | Success = false; |
Greg Clayton | c7695a8 | 2017-05-02 20:28:33 +0000 | [diff] [blame] | 353 | OS << "error: DIE has invalid DW_AT_stmt_list encoding:\n"; |
| 354 | Die.dump(OS, 0); |
Greg Clayton | 48432cf | 2017-05-01 22:07:02 +0000 | [diff] [blame] | 355 | OS << "\n"; |
| 356 | } |
Greg Clayton | c7695a8 | 2017-05-02 20:28:33 +0000 | [diff] [blame] | 357 | break; |
| 358 | |
| 359 | default: |
| 360 | break; |
Greg Clayton | 48432cf | 2017-05-01 22:07:02 +0000 | [diff] [blame] | 361 | } |
| 362 | switch (Form) { |
Greg Clayton | c7695a8 | 2017-05-02 20:28:33 +0000 | [diff] [blame] | 363 | case DW_FORM_ref1: |
| 364 | case DW_FORM_ref2: |
| 365 | case DW_FORM_ref4: |
| 366 | case DW_FORM_ref8: |
| 367 | case DW_FORM_ref_udata: { |
| 368 | // Verify all CU relative references are valid CU offsets. |
| 369 | Optional<uint64_t> RefVal = AttrValue.Value.getAsReference(); |
| 370 | assert(RefVal); |
| 371 | if (RefVal) { |
| 372 | auto DieCU = Die.getDwarfUnit(); |
| 373 | auto CUSize = DieCU->getNextUnitOffset() - DieCU->getOffset(); |
| 374 | auto CUOffset = AttrValue.Value.getRawUValue(); |
| 375 | if (CUOffset >= CUSize) { |
| 376 | Success = false; |
| 377 | OS << "error: " << FormEncodingString(Form) << " CU offset " |
| 378 | << format("0x%08" PRIx32, CUOffset) |
| 379 | << " is invalid (must be less than CU size of " |
| 380 | << format("0x%08" PRIx32, CUSize) << "):\n"; |
| 381 | Die.dump(OS, 0); |
| 382 | OS << "\n"; |
| 383 | } else { |
| 384 | // Valid reference, but we will verify it points to an actual |
| 385 | // DIE later. |
| 386 | ReferenceToDIEOffsets[*RefVal].insert(Die.getOffset()); |
| 387 | } |
| 388 | } |
| 389 | break; |
| 390 | } |
| 391 | case DW_FORM_ref_addr: { |
| 392 | // Verify all absolute DIE references have valid offsets in the |
| 393 | // .debug_info section. |
| 394 | Optional<uint64_t> RefVal = AttrValue.Value.getAsReference(); |
| 395 | assert(RefVal); |
| 396 | if (RefVal) { |
| 397 | if(*RefVal >= DCtx.getInfoSection().Data.size()) { |
| 398 | Success = false; |
| 399 | OS << "error: DW_FORM_ref_addr offset beyond .debug_info " |
| 400 | "bounds:\n"; |
| 401 | Die.dump(OS, 0); |
| 402 | OS << "\n"; |
| 403 | } else { |
| 404 | // Valid reference, but we will verify it points to an actual |
| 405 | // DIE later. |
| 406 | ReferenceToDIEOffsets[*RefVal].insert(Die.getOffset()); |
| 407 | } |
| 408 | } |
| 409 | break; |
| 410 | } |
| 411 | case DW_FORM_strp: { |
| 412 | auto SecOffset = AttrValue.Value.getAsSectionOffset(); |
| 413 | assert(SecOffset); // DW_FORM_strp is a section offset. |
| 414 | if (SecOffset && *SecOffset >= DCtx.getStringSection().size()) { |
Greg Clayton | 48432cf | 2017-05-01 22:07:02 +0000 | [diff] [blame] | 415 | Success = false; |
Greg Clayton | c7695a8 | 2017-05-02 20:28:33 +0000 | [diff] [blame] | 416 | OS << "error: DW_FORM_strp offset beyond .debug_str bounds:\n"; |
Greg Clayton | 48432cf | 2017-05-01 22:07:02 +0000 | [diff] [blame] | 417 | Die.dump(OS, 0); |
| 418 | OS << "\n"; |
| 419 | } |
Greg Clayton | c7695a8 | 2017-05-02 20:28:33 +0000 | [diff] [blame] | 420 | break; |
Greg Clayton | 48432cf | 2017-05-01 22:07:02 +0000 | [diff] [blame] | 421 | } |
Greg Clayton | c7695a8 | 2017-05-02 20:28:33 +0000 | [diff] [blame] | 422 | default: |
| 423 | break; |
Greg Clayton | 48432cf | 2017-05-01 22:07:02 +0000 | [diff] [blame] | 424 | } |
| 425 | } |
| 426 | } |
| 427 | } |
Greg Clayton | c7695a8 | 2017-05-02 20:28:33 +0000 | [diff] [blame] | 428 | |
| 429 | // Take all references and make sure they point to an actual DIE by |
| 430 | // getting the DIE by offset and emitting an error |
| 431 | OS << "Verifying .debug_info references...\n"; |
| 432 | for (auto Pair: ReferenceToDIEOffsets) { |
| 433 | auto Die = DCtx.getDIEForOffset(Pair.first); |
| 434 | if (Die) |
| 435 | continue; |
| 436 | Success = false; |
| 437 | OS << "error: invalid DIE reference " << format("0x%08" PRIx64, Pair.first) |
| 438 | << ". Offset is in between DIEs:\n"; |
| 439 | for (auto Offset: Pair.second) { |
| 440 | auto ReferencingDie = DCtx.getDIEForOffset(Offset); |
| 441 | ReferencingDie.dump(OS, 0); |
| 442 | OS << "\n"; |
| 443 | } |
| 444 | OS << "\n"; |
| 445 | } |
| 446 | return Success; |
| 447 | } |
Greg Clayton | 6707046 | 2017-05-02 22:48:52 +0000 | [diff] [blame] | 448 | |
| 449 | bool HandleDebugLine() { |
| 450 | bool Success = true; |
| 451 | OS << "Verifying .debug_line...\n"; |
| 452 | for (const auto &CU : DCtx.compile_units()) { |
| 453 | uint32_t LineTableOffset = 0; |
| 454 | auto StmtFormValue = CU->getUnitDIE().find(DW_AT_stmt_list); |
| 455 | if (!StmtFormValue) { |
| 456 | // No line table for this compile unit. |
| 457 | continue; |
| 458 | } |
| 459 | // Get the attribute value as a section offset. No need to produce an |
| 460 | // error here if the encoding isn't correct because we validate this in |
| 461 | // the .debug_info verifier. |
| 462 | if (auto StmtSectionOffset = toSectionOffset(StmtFormValue)) { |
| 463 | LineTableOffset = *StmtSectionOffset; |
| 464 | if (LineTableOffset >= DCtx.getLineSection().Data.size()) { |
| 465 | // Make sure we don't get a valid line table back if the offset |
| 466 | // is wrong. |
| 467 | assert(DCtx.getLineTableForUnit(CU.get()) == nullptr); |
| 468 | // Skip this line table as it isn't valid. No need to create an error |
| 469 | // here because we validate this in the .debug_info verifier. |
| 470 | continue; |
| 471 | } |
| 472 | } |
| 473 | auto LineTable = DCtx.getLineTableForUnit(CU.get()); |
| 474 | if (!LineTable) { |
| 475 | Success = false; |
| 476 | OS << "error: .debug_line[" << format("0x%08" PRIx32, LineTableOffset) |
| 477 | << "] was not able to be parsed for CU:\n"; |
| 478 | CU->getUnitDIE().dump(OS, 0); |
| 479 | OS << '\n'; |
| 480 | continue; |
| 481 | } |
| 482 | uint32_t MaxFileIndex = LineTable->Prologue.FileNames.size(); |
| 483 | uint64_t PrevAddress = 0; |
| 484 | uint32_t RowIndex = 0; |
| 485 | for (const auto &Row : LineTable->Rows) { |
| 486 | if (Row.Address < PrevAddress) { |
| 487 | Success = false; |
| 488 | OS << "error: .debug_line[" << format("0x%08" PRIx32, LineTableOffset) |
| 489 | << "] row[" << RowIndex |
| 490 | << "] decreases in address from previous row:\n"; |
| 491 | |
| 492 | DWARFDebugLine::Row::dumpTableHeader(OS); |
| 493 | if (RowIndex > 0) |
| 494 | LineTable->Rows[RowIndex - 1].dump(OS); |
| 495 | Row.dump(OS); |
| 496 | OS << '\n'; |
| 497 | } |
| 498 | |
| 499 | if (Row.File > MaxFileIndex) { |
| 500 | Success = false; |
| 501 | OS << "error: .debug_line[" << format("0x%08" PRIx32, LineTableOffset) |
| 502 | << "][" << RowIndex << "] has invalid file index " << Row.File |
| 503 | << " (valid values are [1," << MaxFileIndex << "]):\n"; |
| 504 | DWARFDebugLine::Row::dumpTableHeader(OS); |
| 505 | Row.dump(OS); |
| 506 | OS << '\n'; |
| 507 | } |
| 508 | if (Row.EndSequence) |
| 509 | PrevAddress = 0; |
| 510 | else |
| 511 | PrevAddress = Row.Address; |
| 512 | ++RowIndex; |
| 513 | } |
| 514 | } |
| 515 | return Success; |
| 516 | } |
Greg Clayton | c7695a8 | 2017-05-02 20:28:33 +0000 | [diff] [blame] | 517 | }; |
| 518 | |
| 519 | } // anonymous namespace |
| 520 | |
| 521 | bool DWARFContext::verify(raw_ostream &OS, DIDumpType DumpType) { |
| 522 | bool Success = true; |
| 523 | Verifier verifier(OS, *this); |
| 524 | if (DumpType == DIDT_All || DumpType == DIDT_Info) { |
| 525 | if (!verifier.HandleDebugInfo()) |
| 526 | Success = false; |
Greg Clayton | 48432cf | 2017-05-01 22:07:02 +0000 | [diff] [blame] | 527 | } |
Greg Clayton | 6707046 | 2017-05-02 22:48:52 +0000 | [diff] [blame] | 528 | if (DumpType == DIDT_All || DumpType == DIDT_Line) { |
| 529 | if (!verifier.HandleDebugLine()) |
| 530 | Success = false; |
| 531 | } |
Greg Clayton | 48432cf | 2017-05-01 22:07:02 +0000 | [diff] [blame] | 532 | return Success; |
| 533 | } |
David Blaikie | 82641be | 2015-11-17 00:39:55 +0000 | [diff] [blame] | 534 | const DWARFUnitIndex &DWARFContext::getCUIndex() { |
| 535 | if (CUIndex) |
| 536 | return *CUIndex; |
| 537 | |
| 538 | DataExtractor CUIndexData(getCUIndexSection(), isLittleEndian(), 0); |
| 539 | |
David Blaikie | b073cb9 | 2015-12-02 06:21:34 +0000 | [diff] [blame] | 540 | CUIndex = llvm::make_unique<DWARFUnitIndex>(DW_SECT_INFO); |
David Blaikie | 82641be | 2015-11-17 00:39:55 +0000 | [diff] [blame] | 541 | CUIndex->parse(CUIndexData); |
| 542 | return *CUIndex; |
| 543 | } |
| 544 | |
| 545 | const DWARFUnitIndex &DWARFContext::getTUIndex() { |
| 546 | if (TUIndex) |
| 547 | return *TUIndex; |
| 548 | |
| 549 | DataExtractor TUIndexData(getTUIndexSection(), isLittleEndian(), 0); |
| 550 | |
David Blaikie | b073cb9 | 2015-12-02 06:21:34 +0000 | [diff] [blame] | 551 | TUIndex = llvm::make_unique<DWARFUnitIndex>(DW_SECT_TYPES); |
David Blaikie | 82641be | 2015-11-17 00:39:55 +0000 | [diff] [blame] | 552 | TUIndex->parse(TUIndexData); |
| 553 | return *TUIndex; |
| 554 | } |
| 555 | |
George Rimar | 4f82df5 | 2016-09-23 11:01:53 +0000 | [diff] [blame] | 556 | DWARFGdbIndex &DWARFContext::getGdbIndex() { |
| 557 | if (GdbIndex) |
| 558 | return *GdbIndex; |
| 559 | |
| 560 | DataExtractor GdbIndexData(getGdbIndexSection(), true /*LE*/, 0); |
| 561 | GdbIndex = llvm::make_unique<DWARFGdbIndex>(); |
| 562 | GdbIndex->parse(GdbIndexData); |
| 563 | return *GdbIndex; |
| 564 | } |
| 565 | |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 566 | const DWARFDebugAbbrev *DWARFContext::getDebugAbbrev() { |
| 567 | if (Abbrev) |
| 568 | return Abbrev.get(); |
| 569 | |
| 570 | DataExtractor abbrData(getAbbrevSection(), isLittleEndian(), 0); |
| 571 | |
| 572 | Abbrev.reset(new DWARFDebugAbbrev()); |
Alexey Samsonov | 4316df5 | 2014-04-25 21:10:56 +0000 | [diff] [blame] | 573 | Abbrev->extract(abbrData); |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 574 | return Abbrev.get(); |
| 575 | } |
| 576 | |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 577 | const DWARFDebugAbbrev *DWARFContext::getDebugAbbrevDWO() { |
| 578 | if (AbbrevDWO) |
| 579 | return AbbrevDWO.get(); |
| 580 | |
| 581 | DataExtractor abbrData(getAbbrevDWOSection(), isLittleEndian(), 0); |
| 582 | AbbrevDWO.reset(new DWARFDebugAbbrev()); |
Alexey Samsonov | 4316df5 | 2014-04-25 21:10:56 +0000 | [diff] [blame] | 583 | AbbrevDWO->extract(abbrData); |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 584 | return AbbrevDWO.get(); |
| 585 | } |
| 586 | |
David Blaikie | 18e7350 | 2013-06-19 21:37:13 +0000 | [diff] [blame] | 587 | const DWARFDebugLoc *DWARFContext::getDebugLoc() { |
| 588 | if (Loc) |
| 589 | return Loc.get(); |
| 590 | |
David Blaikie | 1b5ee5d | 2013-09-23 17:42:01 +0000 | [diff] [blame] | 591 | DataExtractor LocData(getLocSection().Data, isLittleEndian(), 0); |
| 592 | Loc.reset(new DWARFDebugLoc(getLocSection().Relocs)); |
David Blaikie | 18e7350 | 2013-06-19 21:37:13 +0000 | [diff] [blame] | 593 | // assume all compile units have the same address byte size |
| 594 | if (getNumCompileUnits()) |
| 595 | Loc->parse(LocData, getCompileUnitAtIndex(0)->getAddressByteSize()); |
| 596 | return Loc.get(); |
| 597 | } |
| 598 | |
David Blaikie | 9c550ac | 2014-03-25 01:44:02 +0000 | [diff] [blame] | 599 | const DWARFDebugLocDWO *DWARFContext::getDebugLocDWO() { |
| 600 | if (LocDWO) |
| 601 | return LocDWO.get(); |
| 602 | |
| 603 | DataExtractor LocData(getLocDWOSection().Data, isLittleEndian(), 0); |
| 604 | LocDWO.reset(new DWARFDebugLocDWO()); |
| 605 | LocDWO->parse(LocData); |
| 606 | return LocDWO.get(); |
| 607 | } |
| 608 | |
Benjamin Kramer | a6002fd | 2011-09-14 01:09:52 +0000 | [diff] [blame] | 609 | const DWARFDebugAranges *DWARFContext::getDebugAranges() { |
| 610 | if (Aranges) |
| 611 | return Aranges.get(); |
| 612 | |
Benjamin Kramer | a6002fd | 2011-09-14 01:09:52 +0000 | [diff] [blame] | 613 | Aranges.reset(new DWARFDebugAranges()); |
Alexey Samsonov | a1694c1 | 2012-11-16 08:36:25 +0000 | [diff] [blame] | 614 | Aranges->generate(this); |
Benjamin Kramer | a6002fd | 2011-09-14 01:09:52 +0000 | [diff] [blame] | 615 | return Aranges.get(); |
| 616 | } |
| 617 | |
Eli Bendersky | fd08bc1 | 2013-02-05 23:30:58 +0000 | [diff] [blame] | 618 | const DWARFDebugFrame *DWARFContext::getDebugFrame() { |
| 619 | if (DebugFrame) |
| 620 | return DebugFrame.get(); |
| 621 | |
| 622 | // There's a "bug" in the DWARFv3 standard with respect to the target address |
| 623 | // size within debug frame sections. While DWARF is supposed to be independent |
| 624 | // of its container, FDEs have fields with size being "target address size", |
| 625 | // which isn't specified in DWARF in general. It's only specified for CUs, but |
| 626 | // .eh_frame can appear without a .debug_info section. Follow the example of |
| 627 | // other tools (libdwarf) and extract this from the container (ObjectFile |
| 628 | // provides this information). This problem is fixed in DWARFv4 |
| 629 | // See this dwarf-discuss discussion for more details: |
| 630 | // http://lists.dwarfstd.org/htdig.cgi/dwarf-discuss-dwarfstd.org/2011-December/001173.html |
| 631 | DataExtractor debugFrameData(getDebugFrameSection(), isLittleEndian(), |
| 632 | getAddressSize()); |
Igor Laevsky | 03a670c | 2016-01-26 15:09:42 +0000 | [diff] [blame] | 633 | DebugFrame.reset(new DWARFDebugFrame(false /* IsEH */)); |
| 634 | DebugFrame->parse(debugFrameData); |
| 635 | return DebugFrame.get(); |
| 636 | } |
| 637 | |
| 638 | const DWARFDebugFrame *DWARFContext::getEHFrame() { |
| 639 | if (EHFrame) |
| 640 | return EHFrame.get(); |
| 641 | |
| 642 | DataExtractor debugFrameData(getEHFrameSection(), isLittleEndian(), |
| 643 | getAddressSize()); |
| 644 | DebugFrame.reset(new DWARFDebugFrame(true /* IsEH */)); |
Eli Bendersky | fd08bc1 | 2013-02-05 23:30:58 +0000 | [diff] [blame] | 645 | DebugFrame->parse(debugFrameData); |
| 646 | return DebugFrame.get(); |
| 647 | } |
| 648 | |
Amjad Aboud | e59cc3e | 2015-11-12 09:38:54 +0000 | [diff] [blame] | 649 | const DWARFDebugMacro *DWARFContext::getDebugMacro() { |
| 650 | if (Macro) |
| 651 | return Macro.get(); |
| 652 | |
| 653 | DataExtractor MacinfoData(getMacinfoSection(), isLittleEndian(), 0); |
| 654 | Macro.reset(new DWARFDebugMacro()); |
| 655 | Macro->parse(MacinfoData); |
| 656 | return Macro.get(); |
| 657 | } |
| 658 | |
Eric Christopher | 494109b | 2012-10-16 23:46:25 +0000 | [diff] [blame] | 659 | const DWARFLineTable * |
Alexey Samsonov | 7a18c06 | 2015-05-19 21:54:32 +0000 | [diff] [blame] | 660 | DWARFContext::getLineTableForUnit(DWARFUnit *U) { |
Benjamin Kramer | 679e175 | 2011-09-15 20:43:18 +0000 | [diff] [blame] | 661 | if (!Line) |
David Blaikie | 1b5ee5d | 2013-09-23 17:42:01 +0000 | [diff] [blame] | 662 | Line.reset(new DWARFDebugLine(&getLineSection().Relocs)); |
David Blaikie | c4e2bed | 2015-11-17 21:08:05 +0000 | [diff] [blame] | 663 | |
Greg Clayton | c8c1032 | 2016-12-13 18:25:19 +0000 | [diff] [blame] | 664 | auto UnitDIE = U->getUnitDIE(); |
| 665 | if (!UnitDIE) |
Alexey Samsonov | 7a18c06 | 2015-05-19 21:54:32 +0000 | [diff] [blame] | 666 | return nullptr; |
David Blaikie | c4e2bed | 2015-11-17 21:08:05 +0000 | [diff] [blame] | 667 | |
Greg Clayton | 97d2218 | 2017-01-13 21:08:18 +0000 | [diff] [blame] | 668 | auto Offset = toSectionOffset(UnitDIE.find(DW_AT_stmt_list)); |
Greg Clayton | 52fe1f6 | 2016-12-14 22:38:08 +0000 | [diff] [blame] | 669 | if (!Offset) |
Craig Topper | 2617dcc | 2014-04-15 06:32:26 +0000 | [diff] [blame] | 670 | return nullptr; // No line table for this compile unit. |
Benjamin Kramer | 5acab50 | 2011-09-15 02:12:05 +0000 | [diff] [blame] | 671 | |
Greg Clayton | 52fe1f6 | 2016-12-14 22:38:08 +0000 | [diff] [blame] | 672 | uint32_t stmtOffset = *Offset + U->getLineTableOffset(); |
Benjamin Kramer | 679e175 | 2011-09-15 20:43:18 +0000 | [diff] [blame] | 673 | // See if the line table is cached. |
Eric Christopher | 494109b | 2012-10-16 23:46:25 +0000 | [diff] [blame] | 674 | if (const DWARFLineTable *lt = Line->getLineTable(stmtOffset)) |
Benjamin Kramer | 679e175 | 2011-09-15 20:43:18 +0000 | [diff] [blame] | 675 | return lt; |
| 676 | |
| 677 | // We have to parse it first. |
David Blaikie | c4e2bed | 2015-11-17 21:08:05 +0000 | [diff] [blame] | 678 | DataExtractor lineData(U->getLineSection(), isLittleEndian(), |
Alexey Samsonov | 7a18c06 | 2015-05-19 21:54:32 +0000 | [diff] [blame] | 679 | U->getAddressByteSize()); |
Benjamin Kramer | 679e175 | 2011-09-15 20:43:18 +0000 | [diff] [blame] | 680 | return Line->getOrParseLineTable(lineData, stmtOffset); |
Benjamin Kramer | 5acab50 | 2011-09-15 02:12:05 +0000 | [diff] [blame] | 681 | } |
| 682 | |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 683 | void DWARFContext::parseCompileUnits() { |
Alexey Samsonov | 8cd4c9d | 2014-10-08 00:07:53 +0000 | [diff] [blame] | 684 | CUs.parse(*this, getInfoSection()); |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 685 | } |
Benjamin Kramer | 2602ca6 | 2011-09-15 20:43:22 +0000 | [diff] [blame] | 686 | |
David Blaikie | 03c089c | 2013-09-23 22:44:47 +0000 | [diff] [blame] | 687 | void DWARFContext::parseTypeUnits() { |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 688 | if (!TUs.empty()) |
| 689 | return; |
| 690 | for (const auto &I : getTypesSections()) { |
Benjamin Kramer | f5e2fc4 | 2015-05-29 19:43:39 +0000 | [diff] [blame] | 691 | TUs.emplace_back(); |
Alexey Samsonov | 8cd4c9d | 2014-10-08 00:07:53 +0000 | [diff] [blame] | 692 | TUs.back().parse(*this, I.second); |
David Blaikie | 03c089c | 2013-09-23 22:44:47 +0000 | [diff] [blame] | 693 | } |
| 694 | } |
| 695 | |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 696 | void DWARFContext::parseDWOCompileUnits() { |
Alexey Samsonov | 8cd4c9d | 2014-10-08 00:07:53 +0000 | [diff] [blame] | 697 | DWOCUs.parseDWO(*this, getInfoDWOSection()); |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 698 | } |
| 699 | |
David Blaikie | 92d9d62 | 2014-01-09 05:08:24 +0000 | [diff] [blame] | 700 | void DWARFContext::parseDWOTypeUnits() { |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 701 | if (!DWOTUs.empty()) |
| 702 | return; |
| 703 | for (const auto &I : getTypesDWOSections()) { |
Benjamin Kramer | f5e2fc4 | 2015-05-29 19:43:39 +0000 | [diff] [blame] | 704 | DWOTUs.emplace_back(); |
Alexey Samsonov | 8cd4c9d | 2014-10-08 00:07:53 +0000 | [diff] [blame] | 705 | DWOTUs.back().parseDWO(*this, I.second); |
David Blaikie | 92d9d62 | 2014-01-09 05:08:24 +0000 | [diff] [blame] | 706 | } |
| 707 | } |
| 708 | |
Alexey Samsonov | 45be793 | 2012-08-30 07:49:50 +0000 | [diff] [blame] | 709 | DWARFCompileUnit *DWARFContext::getCompileUnitForOffset(uint32_t Offset) { |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 710 | parseCompileUnits(); |
Frederic Riss | 4e126a0 | 2014-09-15 07:50:27 +0000 | [diff] [blame] | 711 | return CUs.getUnitForOffset(Offset); |
Benjamin Kramer | 2602ca6 | 2011-09-15 20:43:22 +0000 | [diff] [blame] | 712 | } |
| 713 | |
Alexey Samsonov | 45be793 | 2012-08-30 07:49:50 +0000 | [diff] [blame] | 714 | DWARFCompileUnit *DWARFContext::getCompileUnitForAddress(uint64_t Address) { |
Benjamin Kramer | 112ec17 | 2011-09-15 21:59:13 +0000 | [diff] [blame] | 715 | // First, get the offset of the compile unit. |
Alexey Samsonov | 45be793 | 2012-08-30 07:49:50 +0000 | [diff] [blame] | 716 | uint32_t CUOffset = getDebugAranges()->findAddress(Address); |
Benjamin Kramer | 2602ca6 | 2011-09-15 20:43:22 +0000 | [diff] [blame] | 717 | // Retrieve the compile unit. |
Alexey Samsonov | 45be793 | 2012-08-30 07:49:50 +0000 | [diff] [blame] | 718 | return getCompileUnitForOffset(CUOffset); |
| 719 | } |
| 720 | |
David Blaikie | efc4eba | 2017-02-06 20:19:02 +0000 | [diff] [blame] | 721 | static bool getFunctionNameAndStartLineForAddress(DWARFCompileUnit *CU, |
| 722 | uint64_t Address, |
| 723 | FunctionNameKind Kind, |
| 724 | std::string &FunctionName, |
| 725 | uint32_t &StartLine) { |
Alexey Samsonov | d010999 | 2014-04-18 21:36:39 +0000 | [diff] [blame] | 726 | // The address may correspond to instruction in some inlined function, |
| 727 | // so we have to build the chain of inlined functions and take the |
David Blaikie | efc4eba | 2017-02-06 20:19:02 +0000 | [diff] [blame] | 728 | // name of the topmost function in it. |
Greg Clayton | c8c1032 | 2016-12-13 18:25:19 +0000 | [diff] [blame] | 729 | SmallVector<DWARFDie, 4> InlinedChain; |
| 730 | CU->getInlinedChainForAddress(Address, InlinedChain); |
David Blaikie | efc4eba | 2017-02-06 20:19:02 +0000 | [diff] [blame] | 731 | if (InlinedChain.empty()) |
Alexey Samsonov | d010999 | 2014-04-18 21:36:39 +0000 | [diff] [blame] | 732 | return false; |
David Blaikie | efc4eba | 2017-02-06 20:19:02 +0000 | [diff] [blame] | 733 | |
| 734 | const DWARFDie &DIE = InlinedChain[0]; |
| 735 | bool FoundResult = false; |
| 736 | const char *Name = nullptr; |
| 737 | if (Kind != FunctionNameKind::None && (Name = DIE.getSubroutineName(Kind))) { |
Alexey Samsonov | d010999 | 2014-04-18 21:36:39 +0000 | [diff] [blame] | 738 | FunctionName = Name; |
David Blaikie | efc4eba | 2017-02-06 20:19:02 +0000 | [diff] [blame] | 739 | FoundResult = true; |
Alexey Samsonov | d010999 | 2014-04-18 21:36:39 +0000 | [diff] [blame] | 740 | } |
David Blaikie | efc4eba | 2017-02-06 20:19:02 +0000 | [diff] [blame] | 741 | if (auto DeclLineResult = DIE.getDeclLine()) { |
| 742 | StartLine = DeclLineResult; |
| 743 | FoundResult = true; |
| 744 | } |
| 745 | |
| 746 | return FoundResult; |
Alexey Samsonov | d010999 | 2014-04-18 21:36:39 +0000 | [diff] [blame] | 747 | } |
| 748 | |
Alexey Samsonov | 45be793 | 2012-08-30 07:49:50 +0000 | [diff] [blame] | 749 | DILineInfo DWARFContext::getLineInfoForAddress(uint64_t Address, |
Alexey Samsonov | dce6734 | 2014-05-15 21:24:32 +0000 | [diff] [blame] | 750 | DILineInfoSpecifier Spec) { |
Alexey Samsonov | d010999 | 2014-04-18 21:36:39 +0000 | [diff] [blame] | 751 | DILineInfo Result; |
| 752 | |
Alexey Samsonov | 45be793 | 2012-08-30 07:49:50 +0000 | [diff] [blame] | 753 | DWARFCompileUnit *CU = getCompileUnitForAddress(Address); |
| 754 | if (!CU) |
Alexey Samsonov | d010999 | 2014-04-18 21:36:39 +0000 | [diff] [blame] | 755 | return Result; |
David Blaikie | efc4eba | 2017-02-06 20:19:02 +0000 | [diff] [blame] | 756 | getFunctionNameAndStartLineForAddress(CU, Address, Spec.FNKind, |
| 757 | Result.FunctionName, |
| 758 | Result.StartLine); |
Alexey Samsonov | dce6734 | 2014-05-15 21:24:32 +0000 | [diff] [blame] | 759 | if (Spec.FLIKind != FileLineInfoKind::None) { |
Frederic Riss | 101b5e2 | 2014-09-19 15:11:51 +0000 | [diff] [blame] | 760 | if (const DWARFLineTable *LineTable = getLineTableForUnit(CU)) |
| 761 | LineTable->getFileLineInfoForAddress(Address, CU->getCompilationDir(), |
| 762 | Spec.FLIKind, Result); |
Alexey Samsonov | f4462fa | 2012-07-02 05:54:45 +0000 | [diff] [blame] | 763 | } |
Alexey Samsonov | d010999 | 2014-04-18 21:36:39 +0000 | [diff] [blame] | 764 | return Result; |
Benjamin Kramer | 2602ca6 | 2011-09-15 20:43:22 +0000 | [diff] [blame] | 765 | } |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 766 | |
Alexey Samsonov | dce6734 | 2014-05-15 21:24:32 +0000 | [diff] [blame] | 767 | DILineInfoTable |
| 768 | DWARFContext::getLineInfoForAddressRange(uint64_t Address, uint64_t Size, |
| 769 | DILineInfoSpecifier Spec) { |
Andrew Kaylor | 9a8ff81 | 2013-01-26 00:28:05 +0000 | [diff] [blame] | 770 | DILineInfoTable Lines; |
| 771 | DWARFCompileUnit *CU = getCompileUnitForAddress(Address); |
| 772 | if (!CU) |
| 773 | return Lines; |
| 774 | |
| 775 | std::string FunctionName = "<invalid>"; |
David Blaikie | efc4eba | 2017-02-06 20:19:02 +0000 | [diff] [blame] | 776 | uint32_t StartLine = 0; |
| 777 | getFunctionNameAndStartLineForAddress(CU, Address, Spec.FNKind, FunctionName, |
| 778 | StartLine); |
Andrew Kaylor | 9a8ff81 | 2013-01-26 00:28:05 +0000 | [diff] [blame] | 779 | |
Andrew Kaylor | 9a8ff81 | 2013-01-26 00:28:05 +0000 | [diff] [blame] | 780 | // If the Specifier says we don't need FileLineInfo, just |
| 781 | // return the top-most function at the starting address. |
Alexey Samsonov | dce6734 | 2014-05-15 21:24:32 +0000 | [diff] [blame] | 782 | if (Spec.FLIKind == FileLineInfoKind::None) { |
Alexey Samsonov | d010999 | 2014-04-18 21:36:39 +0000 | [diff] [blame] | 783 | DILineInfo Result; |
| 784 | Result.FunctionName = FunctionName; |
David Blaikie | efc4eba | 2017-02-06 20:19:02 +0000 | [diff] [blame] | 785 | Result.StartLine = StartLine; |
Alexey Samsonov | d010999 | 2014-04-18 21:36:39 +0000 | [diff] [blame] | 786 | Lines.push_back(std::make_pair(Address, Result)); |
Andrew Kaylor | 9a8ff81 | 2013-01-26 00:28:05 +0000 | [diff] [blame] | 787 | return Lines; |
| 788 | } |
| 789 | |
Frederic Riss | ec8a5ba | 2014-09-04 06:14:40 +0000 | [diff] [blame] | 790 | const DWARFLineTable *LineTable = getLineTableForUnit(CU); |
Andrew Kaylor | 9a8ff81 | 2013-01-26 00:28:05 +0000 | [diff] [blame] | 791 | |
| 792 | // Get the index of row we're looking for in the line table. |
| 793 | std::vector<uint32_t> RowVector; |
| 794 | if (!LineTable->lookupAddressRange(Address, Size, RowVector)) |
| 795 | return Lines; |
| 796 | |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 797 | for (uint32_t RowIndex : RowVector) { |
Andrew Kaylor | 9a8ff81 | 2013-01-26 00:28:05 +0000 | [diff] [blame] | 798 | // Take file number and line/column from the row. |
| 799 | const DWARFDebugLine::Row &Row = LineTable->Rows[RowIndex]; |
Alexey Samsonov | d010999 | 2014-04-18 21:36:39 +0000 | [diff] [blame] | 800 | DILineInfo Result; |
Frederic Riss | 101b5e2 | 2014-09-19 15:11:51 +0000 | [diff] [blame] | 801 | LineTable->getFileNameByIndex(Row.File, CU->getCompilationDir(), |
| 802 | Spec.FLIKind, Result.FileName); |
Alexey Samsonov | d010999 | 2014-04-18 21:36:39 +0000 | [diff] [blame] | 803 | Result.FunctionName = FunctionName; |
| 804 | Result.Line = Row.Line; |
| 805 | Result.Column = Row.Column; |
David Blaikie | efc4eba | 2017-02-06 20:19:02 +0000 | [diff] [blame] | 806 | Result.StartLine = StartLine; |
Alexey Samsonov | d010999 | 2014-04-18 21:36:39 +0000 | [diff] [blame] | 807 | Lines.push_back(std::make_pair(Row.Address, Result)); |
Andrew Kaylor | 9a8ff81 | 2013-01-26 00:28:05 +0000 | [diff] [blame] | 808 | } |
| 809 | |
| 810 | return Lines; |
| 811 | } |
| 812 | |
Alexey Samsonov | dce6734 | 2014-05-15 21:24:32 +0000 | [diff] [blame] | 813 | DIInliningInfo |
| 814 | DWARFContext::getInliningInfoForAddress(uint64_t Address, |
| 815 | DILineInfoSpecifier Spec) { |
Alexey Samsonov | 5c39fdf | 2014-04-18 22:22:44 +0000 | [diff] [blame] | 816 | DIInliningInfo InliningInfo; |
| 817 | |
Alexey Samsonov | c942e6b | 2012-09-04 08:12:33 +0000 | [diff] [blame] | 818 | DWARFCompileUnit *CU = getCompileUnitForAddress(Address); |
| 819 | if (!CU) |
Alexey Samsonov | 5c39fdf | 2014-04-18 22:22:44 +0000 | [diff] [blame] | 820 | return InliningInfo; |
Alexey Samsonov | c942e6b | 2012-09-04 08:12:33 +0000 | [diff] [blame] | 821 | |
Alexey Samsonov | 5c39fdf | 2014-04-18 22:22:44 +0000 | [diff] [blame] | 822 | const DWARFLineTable *LineTable = nullptr; |
Greg Clayton | c8c1032 | 2016-12-13 18:25:19 +0000 | [diff] [blame] | 823 | SmallVector<DWARFDie, 4> InlinedChain; |
| 824 | CU->getInlinedChainForAddress(Address, InlinedChain); |
| 825 | if (InlinedChain.size() == 0) { |
Alexey Samsonov | 5c39fdf | 2014-04-18 22:22:44 +0000 | [diff] [blame] | 826 | // If there is no DIE for address (e.g. it is in unavailable .dwo file), |
| 827 | // try to at least get file/line info from symbol table. |
Alexey Samsonov | dce6734 | 2014-05-15 21:24:32 +0000 | [diff] [blame] | 828 | if (Spec.FLIKind != FileLineInfoKind::None) { |
Alexey Samsonov | 5c39fdf | 2014-04-18 22:22:44 +0000 | [diff] [blame] | 829 | DILineInfo Frame; |
Frederic Riss | ec8a5ba | 2014-09-04 06:14:40 +0000 | [diff] [blame] | 830 | LineTable = getLineTableForUnit(CU); |
Frederic Riss | 101b5e2 | 2014-09-19 15:11:51 +0000 | [diff] [blame] | 831 | if (LineTable && |
| 832 | LineTable->getFileLineInfoForAddress(Address, CU->getCompilationDir(), |
| 833 | Spec.FLIKind, Frame)) |
Alexey Samsonov | 5c39fdf | 2014-04-18 22:22:44 +0000 | [diff] [blame] | 834 | InliningInfo.addFrame(Frame); |
Alexey Samsonov | 5c39fdf | 2014-04-18 22:22:44 +0000 | [diff] [blame] | 835 | } |
| 836 | return InliningInfo; |
| 837 | } |
Alexey Samsonov | c942e6b | 2012-09-04 08:12:33 +0000 | [diff] [blame] | 838 | |
Dehao Chen | ef700d5 | 2017-04-17 20:10:39 +0000 | [diff] [blame] | 839 | uint32_t CallFile = 0, CallLine = 0, CallColumn = 0, CallDiscriminator = 0; |
Greg Clayton | c8c1032 | 2016-12-13 18:25:19 +0000 | [diff] [blame] | 840 | for (uint32_t i = 0, n = InlinedChain.size(); i != n; i++) { |
| 841 | DWARFDie &FunctionDIE = InlinedChain[i]; |
Alexey Samsonov | d010999 | 2014-04-18 21:36:39 +0000 | [diff] [blame] | 842 | DILineInfo Frame; |
Alexey Samsonov | c942e6b | 2012-09-04 08:12:33 +0000 | [diff] [blame] | 843 | // Get function name if necessary. |
Greg Clayton | c8c1032 | 2016-12-13 18:25:19 +0000 | [diff] [blame] | 844 | if (const char *Name = FunctionDIE.getSubroutineName(Spec.FNKind)) |
Alexey Samsonov | dce6734 | 2014-05-15 21:24:32 +0000 | [diff] [blame] | 845 | Frame.FunctionName = Name; |
David Blaikie | efc4eba | 2017-02-06 20:19:02 +0000 | [diff] [blame] | 846 | if (auto DeclLineResult = FunctionDIE.getDeclLine()) |
| 847 | Frame.StartLine = DeclLineResult; |
Alexey Samsonov | dce6734 | 2014-05-15 21:24:32 +0000 | [diff] [blame] | 848 | if (Spec.FLIKind != FileLineInfoKind::None) { |
Alexey Samsonov | c942e6b | 2012-09-04 08:12:33 +0000 | [diff] [blame] | 849 | if (i == 0) { |
| 850 | // For the topmost frame, initialize the line table of this |
| 851 | // compile unit and fetch file/line info from it. |
Frederic Riss | ec8a5ba | 2014-09-04 06:14:40 +0000 | [diff] [blame] | 852 | LineTable = getLineTableForUnit(CU); |
Alexey Samsonov | c942e6b | 2012-09-04 08:12:33 +0000 | [diff] [blame] | 853 | // For the topmost routine, get file/line info from line table. |
Frederic Riss | 101b5e2 | 2014-09-19 15:11:51 +0000 | [diff] [blame] | 854 | if (LineTable) |
| 855 | LineTable->getFileLineInfoForAddress(Address, CU->getCompilationDir(), |
| 856 | Spec.FLIKind, Frame); |
Alexey Samsonov | c942e6b | 2012-09-04 08:12:33 +0000 | [diff] [blame] | 857 | } else { |
| 858 | // Otherwise, use call file, call line and call column from |
| 859 | // previous DIE in inlined chain. |
Frederic Riss | 101b5e2 | 2014-09-19 15:11:51 +0000 | [diff] [blame] | 860 | if (LineTable) |
| 861 | LineTable->getFileNameByIndex(CallFile, CU->getCompilationDir(), |
| 862 | Spec.FLIKind, Frame.FileName); |
Alexey Samsonov | d010999 | 2014-04-18 21:36:39 +0000 | [diff] [blame] | 863 | Frame.Line = CallLine; |
| 864 | Frame.Column = CallColumn; |
Dehao Chen | ef700d5 | 2017-04-17 20:10:39 +0000 | [diff] [blame] | 865 | Frame.Discriminator = CallDiscriminator; |
Alexey Samsonov | c942e6b | 2012-09-04 08:12:33 +0000 | [diff] [blame] | 866 | } |
| 867 | // Get call file/line/column of a current DIE. |
| 868 | if (i + 1 < n) { |
Dehao Chen | ef700d5 | 2017-04-17 20:10:39 +0000 | [diff] [blame] | 869 | FunctionDIE.getCallerFrame(CallFile, CallLine, CallColumn, |
| 870 | CallDiscriminator); |
Alexey Samsonov | c942e6b | 2012-09-04 08:12:33 +0000 | [diff] [blame] | 871 | } |
| 872 | } |
Alexey Samsonov | c942e6b | 2012-09-04 08:12:33 +0000 | [diff] [blame] | 873 | InliningInfo.addFrame(Frame); |
| 874 | } |
| 875 | return InliningInfo; |
| 876 | } |
| 877 | |
George Rimar | 702dac6 | 2017-04-12 08:59:15 +0000 | [diff] [blame] | 878 | static Error createError(const Twine &Reason, llvm::Error E) { |
| 879 | return make_error<StringError>(Reason + toString(std::move(E)), |
| 880 | inconvertibleErrorCode()); |
| 881 | } |
| 882 | |
| 883 | /// Returns the address of symbol relocation used against. Used for futher |
| 884 | /// relocations computation. Symbol's section load address is taken in account if |
| 885 | /// LoadedObjectInfo interface is provided. |
| 886 | static Expected<uint64_t> getSymbolAddress(const object::ObjectFile &Obj, |
| 887 | const RelocationRef &Reloc, |
| 888 | const LoadedObjectInfo *L) { |
| 889 | uint64_t Ret = 0; |
| 890 | object::section_iterator RSec = Obj.section_end(); |
| 891 | object::symbol_iterator Sym = Reloc.getSymbol(); |
| 892 | |
| 893 | // First calculate the address of the symbol or section as it appears |
| 894 | // in the object file |
| 895 | if (Sym != Obj.symbol_end()) { |
| 896 | Expected<uint64_t> SymAddrOrErr = Sym->getAddress(); |
| 897 | if (!SymAddrOrErr) |
| 898 | return createError("error: failed to compute symbol address: ", |
| 899 | SymAddrOrErr.takeError()); |
| 900 | |
| 901 | // Also remember what section this symbol is in for later |
| 902 | auto SectOrErr = Sym->getSection(); |
| 903 | if (!SectOrErr) |
| 904 | return createError("error: failed to get symbol section: ", |
| 905 | SectOrErr.takeError()); |
| 906 | |
| 907 | RSec = *SectOrErr; |
| 908 | Ret = *SymAddrOrErr; |
| 909 | } else if (auto *MObj = dyn_cast<MachOObjectFile>(&Obj)) { |
| 910 | RSec = MObj->getRelocationSection(Reloc.getRawDataRefImpl()); |
| 911 | Ret = RSec->getAddress(); |
| 912 | } |
| 913 | |
| 914 | // If we are given load addresses for the sections, we need to adjust: |
| 915 | // SymAddr = (Address of Symbol Or Section in File) - |
| 916 | // (Address of Section in File) + |
| 917 | // (Load Address of Section) |
| 918 | // RSec is now either the section being targeted or the section |
| 919 | // containing the symbol being targeted. In either case, |
| 920 | // we need to perform the same computation. |
| 921 | if (L && RSec != Obj.section_end()) |
| 922 | if (uint64_t SectionLoadAddress = L->getSectionLoadAddress(*RSec)) |
| 923 | Ret += SectionLoadAddress - RSec->getAddress(); |
| 924 | return Ret; |
| 925 | } |
| 926 | |
| 927 | static bool isRelocScattered(const object::ObjectFile &Obj, |
| 928 | const RelocationRef &Reloc) { |
George Rimar | d4998b0 | 2017-04-13 09:52:50 +0000 | [diff] [blame] | 929 | const MachOObjectFile *MachObj = dyn_cast<MachOObjectFile>(&Obj); |
| 930 | if (!MachObj) |
George Rimar | 702dac6 | 2017-04-12 08:59:15 +0000 | [diff] [blame] | 931 | return false; |
| 932 | // MachO also has relocations that point to sections and |
| 933 | // scattered relocations. |
George Rimar | 702dac6 | 2017-04-12 08:59:15 +0000 | [diff] [blame] | 934 | auto RelocInfo = MachObj->getRelocation(Reloc.getRawDataRefImpl()); |
| 935 | return MachObj->isRelocationScattered(RelocInfo); |
| 936 | } |
| 937 | |
Keno Fischer | c780e8e | 2015-05-21 21:24:32 +0000 | [diff] [blame] | 938 | DWARFContextInMemory::DWARFContextInMemory(const object::ObjectFile &Obj, |
| 939 | const LoadedObjectInfo *L) |
Rafael Espindola | a04bb5b | 2014-07-31 20:19:36 +0000 | [diff] [blame] | 940 | : IsLittleEndian(Obj.isLittleEndian()), |
| 941 | AddressSize(Obj.getBytesInAddress()) { |
| 942 | for (const SectionRef &Section : Obj.sections()) { |
Eric Christopher | 7370b55 | 2012-11-12 21:40:38 +0000 | [diff] [blame] | 943 | StringRef name; |
Alexey Samsonov | 063eb3f | 2014-03-13 13:52:54 +0000 | [diff] [blame] | 944 | Section.getName(name); |
David Majnemer | dac3985 | 2014-09-26 22:32:16 +0000 | [diff] [blame] | 945 | // Skip BSS and Virtual sections, they aren't interesting. |
Rafael Espindola | 8029127 | 2014-10-08 15:28:58 +0000 | [diff] [blame] | 946 | bool IsBSS = Section.isBSS(); |
David Majnemer | dac3985 | 2014-09-26 22:32:16 +0000 | [diff] [blame] | 947 | if (IsBSS) |
| 948 | continue; |
Rafael Espindola | 8029127 | 2014-10-08 15:28:58 +0000 | [diff] [blame] | 949 | bool IsVirtual = Section.isVirtual(); |
David Majnemer | dac3985 | 2014-09-26 22:32:16 +0000 | [diff] [blame] | 950 | if (IsVirtual) |
| 951 | continue; |
Eric Christopher | 7370b55 | 2012-11-12 21:40:38 +0000 | [diff] [blame] | 952 | StringRef data; |
Keno Fischer | c780e8e | 2015-05-21 21:24:32 +0000 | [diff] [blame] | 953 | |
Lang Hames | 2e88f4f | 2015-07-28 17:52:11 +0000 | [diff] [blame] | 954 | section_iterator RelocatedSection = Section.getRelocatedSection(); |
Keno Fischer | c780e8e | 2015-05-21 21:24:32 +0000 | [diff] [blame] | 955 | // Try to obtain an already relocated version of this section. |
| 956 | // Else use the unrelocated section from the object file. We'll have to |
| 957 | // apply relocations ourselves later. |
Lang Hames | 2e88f4f | 2015-07-28 17:52:11 +0000 | [diff] [blame] | 958 | if (!L || !L->getLoadedSectionContents(*RelocatedSection,data)) |
Keno Fischer | c780e8e | 2015-05-21 21:24:32 +0000 | [diff] [blame] | 959 | Section.getContents(data); |
Eric Christopher | 7370b55 | 2012-11-12 21:40:38 +0000 | [diff] [blame] | 960 | |
George Rimar | 4bf3083 | 2017-01-11 15:26:41 +0000 | [diff] [blame] | 961 | if (Decompressor::isCompressed(Section)) { |
| 962 | Expected<Decompressor> Decompressor = |
| 963 | Decompressor::create(name, data, IsLittleEndian, AddressSize == 8); |
| 964 | if (!Decompressor) |
| 965 | continue; |
George Rimar | 401e4e5 | 2016-05-24 12:48:46 +0000 | [diff] [blame] | 966 | SmallString<32> Out; |
George Rimar | 4bf3083 | 2017-01-11 15:26:41 +0000 | [diff] [blame] | 967 | if (auto Err = Decompressor->decompress(Out)) |
Alexey Samsonov | 068fc8a | 2013-04-23 10:17:34 +0000 | [diff] [blame] | 968 | continue; |
George Rimar | 401e4e5 | 2016-05-24 12:48:46 +0000 | [diff] [blame] | 969 | UncompressedSections.emplace_back(std::move(Out)); |
David Blaikie | a505f24 | 2014-04-05 21:26:44 +0000 | [diff] [blame] | 970 | data = UncompressedSections.back(); |
Alexey Samsonov | 068fc8a | 2013-04-23 10:17:34 +0000 | [diff] [blame] | 971 | } |
| 972 | |
George Rimar | 4bf3083 | 2017-01-11 15:26:41 +0000 | [diff] [blame] | 973 | // Compressed sections names in GNU style starts from ".z", |
| 974 | // at this point section is decompressed and we drop compression prefix. |
| 975 | name = name.substr( |
| 976 | name.find_first_not_of("._z")); // Skip ".", "z" and "_" prefixes. |
| 977 | |
Chris Bieneman | 2e752db | 2017-01-20 19:03:14 +0000 | [diff] [blame] | 978 | if (StringRef *SectionData = MapSectionToMember(name)) { |
Alexey Samsonov | 063eb3f | 2014-03-13 13:52:54 +0000 | [diff] [blame] | 979 | *SectionData = data; |
Rafael Espindola | 4f60a38 | 2013-05-30 03:05:14 +0000 | [diff] [blame] | 980 | if (name == "debug_ranges") { |
| 981 | // FIXME: Use the other dwo range section when we emit it. |
George Rimar | ca53211 | 2017-04-24 10:19:45 +0000 | [diff] [blame] | 982 | RangeDWOSection.Data = data; |
Rafael Espindola | 4f60a38 | 2013-05-30 03:05:14 +0000 | [diff] [blame] | 983 | } |
David Blaikie | 03c089c | 2013-09-23 22:44:47 +0000 | [diff] [blame] | 984 | } else if (name == "debug_types") { |
David Blaikie | 427e435 | 2013-09-23 23:39:55 +0000 | [diff] [blame] | 985 | // Find debug_types data by section rather than name as there are |
| 986 | // multiple, comdat grouped, debug_types sections. |
Alexey Samsonov | 063eb3f | 2014-03-13 13:52:54 +0000 | [diff] [blame] | 987 | TypesSections[Section].Data = data; |
David Blaikie | 92d9d62 | 2014-01-09 05:08:24 +0000 | [diff] [blame] | 988 | } else if (name == "debug_types.dwo") { |
Alexey Samsonov | 063eb3f | 2014-03-13 13:52:54 +0000 | [diff] [blame] | 989 | TypesDWOSections[Section].Data = data; |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 990 | } |
Eric Christopher | 7370b55 | 2012-11-12 21:40:38 +0000 | [diff] [blame] | 991 | |
Rafael Espindola | a04bb5b | 2014-07-31 20:19:36 +0000 | [diff] [blame] | 992 | if (RelocatedSection == Obj.section_end()) |
Rafael Espindola | 4f60a38 | 2013-05-30 03:05:14 +0000 | [diff] [blame] | 993 | continue; |
| 994 | |
| 995 | StringRef RelSecName; |
Keno Fischer | c780e8e | 2015-05-21 21:24:32 +0000 | [diff] [blame] | 996 | StringRef RelSecData; |
Rafael Espindola | 4f60a38 | 2013-05-30 03:05:14 +0000 | [diff] [blame] | 997 | RelocatedSection->getName(RelSecName); |
Keno Fischer | c780e8e | 2015-05-21 21:24:32 +0000 | [diff] [blame] | 998 | |
| 999 | // If the section we're relocating was relocated already by the JIT, |
| 1000 | // then we used the relocated version above, so we do not need to process |
| 1001 | // relocations for it now. |
Lang Hames | 2e88f4f | 2015-07-28 17:52:11 +0000 | [diff] [blame] | 1002 | if (L && L->getLoadedSectionContents(*RelocatedSection,RelSecData)) |
Keno Fischer | c780e8e | 2015-05-21 21:24:32 +0000 | [diff] [blame] | 1003 | continue; |
| 1004 | |
Frederic Riss | 7bb1226 | 2015-08-23 04:44:21 +0000 | [diff] [blame] | 1005 | // In Mach-o files, the relocations do not need to be applied if |
| 1006 | // there is no load offset to apply. The value read at the |
| 1007 | // relocation point already factors in the section address |
| 1008 | // (actually applying the relocations will produce wrong results |
| 1009 | // as the section address will be added twice). |
Craig Topper | 66059c9 | 2015-11-18 07:07:59 +0000 | [diff] [blame] | 1010 | if (!L && isa<MachOObjectFile>(&Obj)) |
Frederic Riss | 7bb1226 | 2015-08-23 04:44:21 +0000 | [diff] [blame] | 1011 | continue; |
| 1012 | |
Rafael Espindola | 4f60a38 | 2013-05-30 03:05:14 +0000 | [diff] [blame] | 1013 | RelSecName = RelSecName.substr( |
| 1014 | RelSecName.find_first_not_of("._")); // Skip . and _ prefixes. |
| 1015 | |
Andrew Kaylor | d55d701 | 2013-01-25 22:50:58 +0000 | [diff] [blame] | 1016 | // TODO: Add support for relocations in other sections as needed. |
| 1017 | // Record relocations for the debug_info and debug_line sections. |
Rafael Espindola | 4f60a38 | 2013-05-30 03:05:14 +0000 | [diff] [blame] | 1018 | RelocAddrMap *Map = StringSwitch<RelocAddrMap*>(RelSecName) |
David Blaikie | 1b5ee5d | 2013-09-23 17:42:01 +0000 | [diff] [blame] | 1019 | .Case("debug_info", &InfoSection.Relocs) |
| 1020 | .Case("debug_loc", &LocSection.Relocs) |
| 1021 | .Case("debug_info.dwo", &InfoDWOSection.Relocs) |
| 1022 | .Case("debug_line", &LineSection.Relocs) |
George Rimar | ca53211 | 2017-04-24 10:19:45 +0000 | [diff] [blame] | 1023 | .Case("debug_ranges", &RangeSection.Relocs) |
Frederic Riss | 7c50047 | 2014-11-14 19:30:08 +0000 | [diff] [blame] | 1024 | .Case("apple_names", &AppleNamesSection.Relocs) |
| 1025 | .Case("apple_types", &AppleTypesSection.Relocs) |
| 1026 | .Case("apple_namespaces", &AppleNamespacesSection.Relocs) |
| 1027 | .Case("apple_namespac", &AppleNamespacesSection.Relocs) |
| 1028 | .Case("apple_objc", &AppleObjCSection.Relocs) |
Craig Topper | 2617dcc | 2014-04-15 06:32:26 +0000 | [diff] [blame] | 1029 | .Default(nullptr); |
David Blaikie | 03c089c | 2013-09-23 22:44:47 +0000 | [diff] [blame] | 1030 | if (!Map) { |
David Blaikie | 427e435 | 2013-09-23 23:39:55 +0000 | [diff] [blame] | 1031 | // Find debug_types relocs by section rather than name as there are |
| 1032 | // multiple, comdat grouped, debug_types sections. |
David Blaikie | 92d9d62 | 2014-01-09 05:08:24 +0000 | [diff] [blame] | 1033 | if (RelSecName == "debug_types") |
| 1034 | Map = &TypesSections[*RelocatedSection].Relocs; |
| 1035 | else if (RelSecName == "debug_types.dwo") |
| 1036 | Map = &TypesDWOSections[*RelocatedSection].Relocs; |
| 1037 | else |
| 1038 | continue; |
David Blaikie | 03c089c | 2013-09-23 22:44:47 +0000 | [diff] [blame] | 1039 | } |
Eric Christopher | 7370b55 | 2012-11-12 21:40:38 +0000 | [diff] [blame] | 1040 | |
Alexey Samsonov | 063eb3f | 2014-03-13 13:52:54 +0000 | [diff] [blame] | 1041 | if (Section.relocation_begin() != Section.relocation_end()) { |
Rafael Espindola | 8029127 | 2014-10-08 15:28:58 +0000 | [diff] [blame] | 1042 | uint64_t SectionSize = RelocatedSection->getSize(); |
Alexey Samsonov | aa4d295 | 2014-03-14 14:22:49 +0000 | [diff] [blame] | 1043 | for (const RelocationRef &Reloc : Section.relocations()) { |
George Rimar | 702dac6 | 2017-04-12 08:59:15 +0000 | [diff] [blame] | 1044 | // FIXME: it's not clear how to correctly handle scattered |
| 1045 | // relocations. |
| 1046 | if (isRelocScattered(Obj, Reloc)) |
| 1047 | continue; |
Keno Fischer | c780e8e | 2015-05-21 21:24:32 +0000 | [diff] [blame] | 1048 | |
George Rimar | 702dac6 | 2017-04-12 08:59:15 +0000 | [diff] [blame] | 1049 | Expected<uint64_t> SymAddrOrErr = getSymbolAddress(Obj, Reloc, L); |
| 1050 | if (!SymAddrOrErr) { |
Krasimir Georgiev | 4ed589d | 2017-04-12 11:33:26 +0000 | [diff] [blame] | 1051 | errs() << toString(SymAddrOrErr.takeError()) << '\n'; |
George Rimar | 702dac6 | 2017-04-12 08:59:15 +0000 | [diff] [blame] | 1052 | continue; |
Keno Fischer | c780e8e | 2015-05-21 21:24:32 +0000 | [diff] [blame] | 1053 | } |
Eric Christopher | 7370b55 | 2012-11-12 21:40:38 +0000 | [diff] [blame] | 1054 | |
Eric Christopher | 47e079d | 2014-10-06 06:55:55 +0000 | [diff] [blame] | 1055 | object::RelocVisitor V(Obj); |
George Rimar | 702dac6 | 2017-04-12 08:59:15 +0000 | [diff] [blame] | 1056 | object::RelocToApply R(V.visit(Reloc.getType(), Reloc, *SymAddrOrErr)); |
Eric Christopher | 7370b55 | 2012-11-12 21:40:38 +0000 | [diff] [blame] | 1057 | if (V.error()) { |
| 1058 | SmallString<32> Name; |
Rafael Espindola | 41bb432 | 2015-06-30 04:08:37 +0000 | [diff] [blame] | 1059 | Reloc.getTypeName(Name); |
Eric Christopher | 7370b55 | 2012-11-12 21:40:38 +0000 | [diff] [blame] | 1060 | errs() << "error: failed to compute relocation: " |
| 1061 | << Name << "\n"; |
| 1062 | continue; |
| 1063 | } |
George Rimar | 702dac6 | 2017-04-12 08:59:15 +0000 | [diff] [blame] | 1064 | uint64_t Address = Reloc.getOffset(); |
Eric Christopher | 7370b55 | 2012-11-12 21:40:38 +0000 | [diff] [blame] | 1065 | if (Address + R.Width > SectionSize) { |
| 1066 | errs() << "error: " << R.Width << "-byte relocation starting " |
| 1067 | << Address << " bytes into section " << name << " which is " |
| 1068 | << SectionSize << " bytes long.\n"; |
| 1069 | continue; |
| 1070 | } |
| 1071 | if (R.Width > 8) { |
| 1072 | errs() << "error: can't handle a relocation of more than 8 bytes at " |
| 1073 | "a time.\n"; |
| 1074 | continue; |
| 1075 | } |
| 1076 | DEBUG(dbgs() << "Writing " << format("%p", R.Value) |
| 1077 | << " at " << format("%p", Address) |
| 1078 | << " with width " << format("%d", R.Width) |
| 1079 | << "\n"); |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 1080 | Map->insert(std::make_pair(Address, std::make_pair(R.Width, R.Value))); |
Eric Christopher | 7370b55 | 2012-11-12 21:40:38 +0000 | [diff] [blame] | 1081 | } |
| 1082 | } |
| 1083 | } |
| 1084 | } |
| 1085 | |
Chris Bieneman | 2e752db | 2017-01-20 19:03:14 +0000 | [diff] [blame] | 1086 | DWARFContextInMemory::DWARFContextInMemory( |
| 1087 | const StringMap<std::unique_ptr<MemoryBuffer>> &Sections, uint8_t AddrSize, |
| 1088 | bool isLittleEndian) |
| 1089 | : IsLittleEndian(isLittleEndian), AddressSize(AddrSize) { |
| 1090 | for (const auto &SecIt : Sections) { |
| 1091 | if (StringRef *SectionData = MapSectionToMember(SecIt.first())) |
| 1092 | *SectionData = SecIt.second->getBuffer(); |
| 1093 | } |
| 1094 | } |
| 1095 | |
| 1096 | StringRef *DWARFContextInMemory::MapSectionToMember(StringRef Name) { |
| 1097 | return StringSwitch<StringRef *>(Name) |
| 1098 | .Case("debug_info", &InfoSection.Data) |
| 1099 | .Case("debug_abbrev", &AbbrevSection) |
| 1100 | .Case("debug_loc", &LocSection.Data) |
| 1101 | .Case("debug_line", &LineSection.Data) |
| 1102 | .Case("debug_aranges", &ARangeSection) |
| 1103 | .Case("debug_frame", &DebugFrameSection) |
| 1104 | .Case("eh_frame", &EHFrameSection) |
| 1105 | .Case("debug_str", &StringSection) |
George Rimar | ca53211 | 2017-04-24 10:19:45 +0000 | [diff] [blame] | 1106 | .Case("debug_ranges", &RangeSection.Data) |
Chris Bieneman | 2e752db | 2017-01-20 19:03:14 +0000 | [diff] [blame] | 1107 | .Case("debug_macinfo", &MacinfoSection) |
| 1108 | .Case("debug_pubnames", &PubNamesSection) |
| 1109 | .Case("debug_pubtypes", &PubTypesSection) |
| 1110 | .Case("debug_gnu_pubnames", &GnuPubNamesSection) |
| 1111 | .Case("debug_gnu_pubtypes", &GnuPubTypesSection) |
| 1112 | .Case("debug_info.dwo", &InfoDWOSection.Data) |
| 1113 | .Case("debug_abbrev.dwo", &AbbrevDWOSection) |
| 1114 | .Case("debug_loc.dwo", &LocDWOSection.Data) |
| 1115 | .Case("debug_line.dwo", &LineDWOSection.Data) |
| 1116 | .Case("debug_str.dwo", &StringDWOSection) |
| 1117 | .Case("debug_str_offsets.dwo", &StringOffsetDWOSection) |
| 1118 | .Case("debug_addr", &AddrSection) |
| 1119 | .Case("apple_names", &AppleNamesSection.Data) |
| 1120 | .Case("apple_types", &AppleTypesSection.Data) |
| 1121 | .Case("apple_namespaces", &AppleNamespacesSection.Data) |
| 1122 | .Case("apple_namespac", &AppleNamespacesSection.Data) |
| 1123 | .Case("apple_objc", &AppleObjCSection.Data) |
| 1124 | .Case("debug_cu_index", &CUIndexSection) |
| 1125 | .Case("debug_tu_index", &TUIndexSection) |
| 1126 | .Case("gdb_index", &GdbIndexSection) |
| 1127 | // Any more debug info sections go here. |
| 1128 | .Default(nullptr); |
| 1129 | } |
| 1130 | |
Eugene Zelenko | 28db7e6 | 2017-03-01 01:14:23 +0000 | [diff] [blame] | 1131 | void DWARFContextInMemory::anchor() {} |