Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 1 | //===- MinimalSymbolDumper.cpp -------------------------------- *- C++ --*-===// |
| 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 | |
| 10 | #include "MinimalSymbolDumper.h" |
| 11 | |
| 12 | #include "FormatUtil.h" |
Zachary Turner | 6047858 | 2018-01-05 19:12:40 +0000 | [diff] [blame^] | 13 | #include "InputFile.h" |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 14 | #include "LinePrinter.h" |
| 15 | |
| 16 | #include "llvm/DebugInfo/CodeView/CVRecord.h" |
| 17 | #include "llvm/DebugInfo/CodeView/CodeView.h" |
| 18 | #include "llvm/DebugInfo/CodeView/Formatters.h" |
| 19 | #include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h" |
| 20 | #include "llvm/DebugInfo/CodeView/SymbolRecord.h" |
| 21 | #include "llvm/DebugInfo/CodeView/TypeRecord.h" |
Zachary Turner | 6047858 | 2018-01-05 19:12:40 +0000 | [diff] [blame^] | 22 | #include "llvm/DebugInfo/PDB/Native/PDBStringTable.h" |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 23 | #include "llvm/Support/FormatVariadic.h" |
| 24 | |
| 25 | using namespace llvm; |
| 26 | using namespace llvm::codeview; |
| 27 | using namespace llvm::pdb; |
| 28 | |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 29 | static std::string formatLocalSymFlags(uint32_t IndentLevel, |
| 30 | LocalSymFlags Flags) { |
| 31 | std::vector<std::string> Opts; |
| 32 | if (Flags == LocalSymFlags::None) |
| 33 | return "none"; |
| 34 | |
| 35 | PUSH_FLAG(LocalSymFlags, IsParameter, Flags, "param"); |
| 36 | PUSH_FLAG(LocalSymFlags, IsAddressTaken, Flags, "address is taken"); |
| 37 | PUSH_FLAG(LocalSymFlags, IsCompilerGenerated, Flags, "compiler generated"); |
| 38 | PUSH_FLAG(LocalSymFlags, IsAggregate, Flags, "aggregate"); |
| 39 | PUSH_FLAG(LocalSymFlags, IsAggregated, Flags, "aggregated"); |
| 40 | PUSH_FLAG(LocalSymFlags, IsAliased, Flags, "aliased"); |
| 41 | PUSH_FLAG(LocalSymFlags, IsAlias, Flags, "alias"); |
| 42 | PUSH_FLAG(LocalSymFlags, IsReturnValue, Flags, "return val"); |
| 43 | PUSH_FLAG(LocalSymFlags, IsOptimizedOut, Flags, "optimized away"); |
| 44 | PUSH_FLAG(LocalSymFlags, IsEnregisteredGlobal, Flags, "enreg global"); |
| 45 | PUSH_FLAG(LocalSymFlags, IsEnregisteredStatic, Flags, "enreg static"); |
| 46 | return typesetItemList(Opts, 4, IndentLevel, " | "); |
| 47 | } |
| 48 | |
| 49 | static std::string formatExportFlags(uint32_t IndentLevel, ExportFlags Flags) { |
| 50 | std::vector<std::string> Opts; |
| 51 | if (Flags == ExportFlags::None) |
| 52 | return "none"; |
| 53 | |
| 54 | PUSH_FLAG(ExportFlags, IsConstant, Flags, "constant"); |
| 55 | PUSH_FLAG(ExportFlags, IsData, Flags, "data"); |
| 56 | PUSH_FLAG(ExportFlags, IsPrivate, Flags, "private"); |
| 57 | PUSH_FLAG(ExportFlags, HasNoName, Flags, "no name"); |
| 58 | PUSH_FLAG(ExportFlags, HasExplicitOrdinal, Flags, "explicit ord"); |
| 59 | PUSH_FLAG(ExportFlags, IsForwarder, Flags, "forwarder"); |
| 60 | |
| 61 | return typesetItemList(Opts, 4, IndentLevel, " | "); |
| 62 | } |
| 63 | |
| 64 | static std::string formatCompileSym2Flags(uint32_t IndentLevel, |
| 65 | CompileSym2Flags Flags) { |
| 66 | std::vector<std::string> Opts; |
| 67 | Flags &= ~CompileSym2Flags::SourceLanguageMask; |
| 68 | if (Flags == CompileSym2Flags::None) |
| 69 | return "none"; |
| 70 | |
| 71 | PUSH_FLAG(CompileSym2Flags, EC, Flags, "edit and continue"); |
| 72 | PUSH_FLAG(CompileSym2Flags, NoDbgInfo, Flags, "no dbg info"); |
| 73 | PUSH_FLAG(CompileSym2Flags, LTCG, Flags, "ltcg"); |
| 74 | PUSH_FLAG(CompileSym2Flags, NoDataAlign, Flags, "no data align"); |
| 75 | PUSH_FLAG(CompileSym2Flags, ManagedPresent, Flags, "has managed code"); |
| 76 | PUSH_FLAG(CompileSym2Flags, SecurityChecks, Flags, "security checks"); |
| 77 | PUSH_FLAG(CompileSym2Flags, HotPatch, Flags, "hot patchable"); |
| 78 | PUSH_FLAG(CompileSym2Flags, CVTCIL, Flags, "cvtcil"); |
| 79 | PUSH_FLAG(CompileSym2Flags, MSILModule, Flags, "msil module"); |
| 80 | return typesetItemList(Opts, 4, IndentLevel, " | "); |
| 81 | } |
| 82 | |
| 83 | static std::string formatCompileSym3Flags(uint32_t IndentLevel, |
| 84 | CompileSym3Flags Flags) { |
| 85 | std::vector<std::string> Opts; |
| 86 | Flags &= ~CompileSym3Flags::SourceLanguageMask; |
| 87 | |
| 88 | if (Flags == CompileSym3Flags::None) |
| 89 | return "none"; |
| 90 | |
| 91 | PUSH_FLAG(CompileSym3Flags, EC, Flags, "edit and continue"); |
| 92 | PUSH_FLAG(CompileSym3Flags, NoDbgInfo, Flags, "no dbg info"); |
| 93 | PUSH_FLAG(CompileSym3Flags, LTCG, Flags, "ltcg"); |
| 94 | PUSH_FLAG(CompileSym3Flags, NoDataAlign, Flags, "no data align"); |
| 95 | PUSH_FLAG(CompileSym3Flags, ManagedPresent, Flags, "has managed code"); |
| 96 | PUSH_FLAG(CompileSym3Flags, SecurityChecks, Flags, "security checks"); |
| 97 | PUSH_FLAG(CompileSym3Flags, HotPatch, Flags, "hot patchable"); |
| 98 | PUSH_FLAG(CompileSym3Flags, CVTCIL, Flags, "cvtcil"); |
| 99 | PUSH_FLAG(CompileSym3Flags, MSILModule, Flags, "msil module"); |
| 100 | PUSH_FLAG(CompileSym3Flags, Sdl, Flags, "sdl"); |
| 101 | PUSH_FLAG(CompileSym3Flags, PGO, Flags, "pgo"); |
| 102 | PUSH_FLAG(CompileSym3Flags, Exp, Flags, "exp"); |
| 103 | return typesetItemList(Opts, 4, IndentLevel, " | "); |
| 104 | } |
| 105 | |
| 106 | static std::string formatFrameProcedureOptions(uint32_t IndentLevel, |
| 107 | FrameProcedureOptions FPO) { |
| 108 | std::vector<std::string> Opts; |
| 109 | if (FPO == FrameProcedureOptions::None) |
| 110 | return "none"; |
| 111 | |
| 112 | PUSH_FLAG(FrameProcedureOptions, HasAlloca, FPO, "has alloca"); |
| 113 | PUSH_FLAG(FrameProcedureOptions, HasSetJmp, FPO, "has setjmp"); |
| 114 | PUSH_FLAG(FrameProcedureOptions, HasLongJmp, FPO, "has longjmp"); |
| 115 | PUSH_FLAG(FrameProcedureOptions, HasInlineAssembly, FPO, "has inline asm"); |
| 116 | PUSH_FLAG(FrameProcedureOptions, HasExceptionHandling, FPO, "has eh"); |
| 117 | PUSH_FLAG(FrameProcedureOptions, MarkedInline, FPO, "marked inline"); |
| 118 | PUSH_FLAG(FrameProcedureOptions, HasStructuredExceptionHandling, FPO, |
| 119 | "has seh"); |
| 120 | PUSH_FLAG(FrameProcedureOptions, Naked, FPO, "naked"); |
| 121 | PUSH_FLAG(FrameProcedureOptions, SecurityChecks, FPO, "secure checks"); |
| 122 | PUSH_FLAG(FrameProcedureOptions, AsynchronousExceptionHandling, FPO, |
| 123 | "has async eh"); |
| 124 | PUSH_FLAG(FrameProcedureOptions, NoStackOrderingForSecurityChecks, FPO, |
| 125 | "no stack order"); |
| 126 | PUSH_FLAG(FrameProcedureOptions, Inlined, FPO, "inlined"); |
| 127 | PUSH_FLAG(FrameProcedureOptions, StrictSecurityChecks, FPO, |
| 128 | "strict secure checks"); |
| 129 | PUSH_FLAG(FrameProcedureOptions, SafeBuffers, FPO, "safe buffers"); |
| 130 | PUSH_FLAG(FrameProcedureOptions, ProfileGuidedOptimization, FPO, "pgo"); |
| 131 | PUSH_FLAG(FrameProcedureOptions, ValidProfileCounts, FPO, |
| 132 | "has profile counts"); |
| 133 | PUSH_FLAG(FrameProcedureOptions, OptimizedForSpeed, FPO, "opt speed"); |
| 134 | PUSH_FLAG(FrameProcedureOptions, GuardCfg, FPO, "guard cfg"); |
| 135 | PUSH_FLAG(FrameProcedureOptions, GuardCfw, FPO, "guard cfw"); |
| 136 | return typesetItemList(Opts, 4, IndentLevel, " | "); |
| 137 | } |
| 138 | |
Reid Kleckner | 18d90e1 | 2017-06-19 16:54:51 +0000 | [diff] [blame] | 139 | static std::string formatPublicSymFlags(uint32_t IndentLevel, |
| 140 | PublicSymFlags Flags) { |
| 141 | std::vector<std::string> Opts; |
| 142 | if (Flags == PublicSymFlags::None) |
| 143 | return "none"; |
| 144 | |
| 145 | PUSH_FLAG(PublicSymFlags, Code, Flags, "code"); |
| 146 | PUSH_FLAG(PublicSymFlags, Function, Flags, "function"); |
| 147 | PUSH_FLAG(PublicSymFlags, Managed, Flags, "managed"); |
| 148 | PUSH_FLAG(PublicSymFlags, MSIL, Flags, "msil"); |
| 149 | return typesetItemList(Opts, 4, IndentLevel, " | "); |
| 150 | } |
| 151 | |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 152 | static std::string formatProcSymFlags(uint32_t IndentLevel, |
| 153 | ProcSymFlags Flags) { |
| 154 | std::vector<std::string> Opts; |
| 155 | if (Flags == ProcSymFlags::None) |
| 156 | return "none"; |
| 157 | |
| 158 | PUSH_FLAG(ProcSymFlags, HasFP, Flags, "has fp"); |
| 159 | PUSH_FLAG(ProcSymFlags, HasIRET, Flags, "has iret"); |
| 160 | PUSH_FLAG(ProcSymFlags, HasFRET, Flags, "has fret"); |
| 161 | PUSH_FLAG(ProcSymFlags, IsNoReturn, Flags, "noreturn"); |
| 162 | PUSH_FLAG(ProcSymFlags, IsUnreachable, Flags, "unreachable"); |
| 163 | PUSH_FLAG(ProcSymFlags, HasCustomCallingConv, Flags, "custom calling conv"); |
| 164 | PUSH_FLAG(ProcSymFlags, IsNoInline, Flags, "noinline"); |
| 165 | PUSH_FLAG(ProcSymFlags, HasOptimizedDebugInfo, Flags, "opt debuginfo"); |
| 166 | return typesetItemList(Opts, 4, IndentLevel, " | "); |
| 167 | } |
| 168 | |
| 169 | static std::string formatThunkOrdinal(ThunkOrdinal Ordinal) { |
| 170 | switch (Ordinal) { |
| 171 | RETURN_CASE(ThunkOrdinal, Standard, "thunk"); |
| 172 | RETURN_CASE(ThunkOrdinal, ThisAdjustor, "this adjustor"); |
| 173 | RETURN_CASE(ThunkOrdinal, Vcall, "vcall"); |
| 174 | RETURN_CASE(ThunkOrdinal, Pcode, "pcode"); |
| 175 | RETURN_CASE(ThunkOrdinal, UnknownLoad, "unknown load"); |
| 176 | RETURN_CASE(ThunkOrdinal, TrampIncremental, "tramp incremental"); |
| 177 | RETURN_CASE(ThunkOrdinal, BranchIsland, "branch island"); |
| 178 | } |
| 179 | return formatUnknownEnum(Ordinal); |
| 180 | } |
| 181 | |
| 182 | static std::string formatTrampolineType(TrampolineType Tramp) { |
| 183 | switch (Tramp) { |
| 184 | RETURN_CASE(TrampolineType, TrampIncremental, "tramp incremental"); |
| 185 | RETURN_CASE(TrampolineType, BranchIsland, "branch island"); |
| 186 | } |
| 187 | return formatUnknownEnum(Tramp); |
| 188 | } |
| 189 | |
| 190 | static std::string formatSourceLanguage(SourceLanguage Lang) { |
| 191 | switch (Lang) { |
| 192 | RETURN_CASE(SourceLanguage, C, "c"); |
| 193 | RETURN_CASE(SourceLanguage, Cpp, "c++"); |
| 194 | RETURN_CASE(SourceLanguage, Fortran, "fortran"); |
| 195 | RETURN_CASE(SourceLanguage, Masm, "masm"); |
| 196 | RETURN_CASE(SourceLanguage, Pascal, "pascal"); |
| 197 | RETURN_CASE(SourceLanguage, Basic, "basic"); |
| 198 | RETURN_CASE(SourceLanguage, Cobol, "cobol"); |
| 199 | RETURN_CASE(SourceLanguage, Link, "link"); |
| 200 | RETURN_CASE(SourceLanguage, VB, "vb"); |
| 201 | RETURN_CASE(SourceLanguage, Cvtres, "cvtres"); |
| 202 | RETURN_CASE(SourceLanguage, Cvtpgd, "cvtpgd"); |
| 203 | RETURN_CASE(SourceLanguage, CSharp, "c#"); |
| 204 | RETURN_CASE(SourceLanguage, ILAsm, "il asm"); |
| 205 | RETURN_CASE(SourceLanguage, Java, "java"); |
| 206 | RETURN_CASE(SourceLanguage, JScript, "javascript"); |
| 207 | RETURN_CASE(SourceLanguage, MSIL, "msil"); |
| 208 | RETURN_CASE(SourceLanguage, HLSL, "hlsl"); |
Reid Kleckner | 898ddf6 | 2017-07-24 16:16:42 +0000 | [diff] [blame] | 209 | RETURN_CASE(SourceLanguage, D, "d"); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 210 | } |
| 211 | return formatUnknownEnum(Lang); |
| 212 | } |
| 213 | |
| 214 | static std::string formatMachineType(CPUType Cpu) { |
| 215 | switch (Cpu) { |
| 216 | RETURN_CASE(CPUType, Intel8080, "intel 8080"); |
| 217 | RETURN_CASE(CPUType, Intel8086, "intel 8086"); |
| 218 | RETURN_CASE(CPUType, Intel80286, "intel 80286"); |
| 219 | RETURN_CASE(CPUType, Intel80386, "intel 80386"); |
| 220 | RETURN_CASE(CPUType, Intel80486, "intel 80486"); |
| 221 | RETURN_CASE(CPUType, Pentium, "intel pentium"); |
| 222 | RETURN_CASE(CPUType, PentiumPro, "intel pentium pro"); |
| 223 | RETURN_CASE(CPUType, Pentium3, "intel pentium 3"); |
| 224 | RETURN_CASE(CPUType, MIPS, "mips"); |
| 225 | RETURN_CASE(CPUType, MIPS16, "mips-16"); |
| 226 | RETURN_CASE(CPUType, MIPS32, "mips-32"); |
| 227 | RETURN_CASE(CPUType, MIPS64, "mips-64"); |
| 228 | RETURN_CASE(CPUType, MIPSI, "mips i"); |
| 229 | RETURN_CASE(CPUType, MIPSII, "mips ii"); |
| 230 | RETURN_CASE(CPUType, MIPSIII, "mips iii"); |
| 231 | RETURN_CASE(CPUType, MIPSIV, "mips iv"); |
| 232 | RETURN_CASE(CPUType, MIPSV, "mips v"); |
| 233 | RETURN_CASE(CPUType, M68000, "motorola 68000"); |
| 234 | RETURN_CASE(CPUType, M68010, "motorola 68010"); |
| 235 | RETURN_CASE(CPUType, M68020, "motorola 68020"); |
| 236 | RETURN_CASE(CPUType, M68030, "motorola 68030"); |
| 237 | RETURN_CASE(CPUType, M68040, "motorola 68040"); |
| 238 | RETURN_CASE(CPUType, Alpha, "alpha"); |
| 239 | RETURN_CASE(CPUType, Alpha21164, "alpha 21164"); |
| 240 | RETURN_CASE(CPUType, Alpha21164A, "alpha 21164a"); |
| 241 | RETURN_CASE(CPUType, Alpha21264, "alpha 21264"); |
| 242 | RETURN_CASE(CPUType, Alpha21364, "alpha 21364"); |
| 243 | RETURN_CASE(CPUType, PPC601, "powerpc 601"); |
| 244 | RETURN_CASE(CPUType, PPC603, "powerpc 603"); |
| 245 | RETURN_CASE(CPUType, PPC604, "powerpc 604"); |
| 246 | RETURN_CASE(CPUType, PPC620, "powerpc 620"); |
| 247 | RETURN_CASE(CPUType, PPCFP, "powerpc fp"); |
| 248 | RETURN_CASE(CPUType, PPCBE, "powerpc be"); |
| 249 | RETURN_CASE(CPUType, SH3, "sh3"); |
| 250 | RETURN_CASE(CPUType, SH3E, "sh3e"); |
| 251 | RETURN_CASE(CPUType, SH3DSP, "sh3 dsp"); |
| 252 | RETURN_CASE(CPUType, SH4, "sh4"); |
| 253 | RETURN_CASE(CPUType, SHMedia, "shmedia"); |
| 254 | RETURN_CASE(CPUType, ARM3, "arm 3"); |
| 255 | RETURN_CASE(CPUType, ARM4, "arm 4"); |
| 256 | RETURN_CASE(CPUType, ARM4T, "arm 4t"); |
| 257 | RETURN_CASE(CPUType, ARM5, "arm 5"); |
| 258 | RETURN_CASE(CPUType, ARM5T, "arm 5t"); |
| 259 | RETURN_CASE(CPUType, ARM6, "arm 6"); |
| 260 | RETURN_CASE(CPUType, ARM_XMAC, "arm xmac"); |
| 261 | RETURN_CASE(CPUType, ARM_WMMX, "arm wmmx"); |
| 262 | RETURN_CASE(CPUType, ARM7, "arm 7"); |
Mandeep Singh Grang | d41ac89 | 2017-07-20 20:20:00 +0000 | [diff] [blame] | 263 | RETURN_CASE(CPUType, ARM64, "arm64"); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 264 | RETURN_CASE(CPUType, Omni, "omni"); |
| 265 | RETURN_CASE(CPUType, Ia64, "intel itanium ia64"); |
| 266 | RETURN_CASE(CPUType, Ia64_2, "intel itanium ia64 2"); |
| 267 | RETURN_CASE(CPUType, CEE, "cee"); |
| 268 | RETURN_CASE(CPUType, AM33, "am33"); |
| 269 | RETURN_CASE(CPUType, M32R, "m32r"); |
| 270 | RETURN_CASE(CPUType, TriCore, "tri-core"); |
| 271 | RETURN_CASE(CPUType, X64, "intel x86-x64"); |
| 272 | RETURN_CASE(CPUType, EBC, "ebc"); |
| 273 | RETURN_CASE(CPUType, Thumb, "thumb"); |
| 274 | RETURN_CASE(CPUType, ARMNT, "arm nt"); |
| 275 | RETURN_CASE(CPUType, D3D11_Shader, "d3d11 shader"); |
| 276 | } |
| 277 | return formatUnknownEnum(Cpu); |
| 278 | } |
| 279 | |
| 280 | static std::string formatCookieKind(FrameCookieKind Kind) { |
| 281 | switch (Kind) { |
| 282 | RETURN_CASE(FrameCookieKind, Copy, "copy"); |
| 283 | RETURN_CASE(FrameCookieKind, XorStackPointer, "xor stack ptr"); |
| 284 | RETURN_CASE(FrameCookieKind, XorFramePointer, "xor frame ptr"); |
| 285 | RETURN_CASE(FrameCookieKind, XorR13, "xor rot13"); |
| 286 | } |
| 287 | return formatUnknownEnum(Kind); |
| 288 | } |
| 289 | |
| 290 | static std::string formatRegisterId(RegisterId Id) { |
| 291 | switch (Id) { |
Hans Wennborg | 6605310 | 2017-10-03 18:27:22 +0000 | [diff] [blame] | 292 | #define CV_REGISTER(name, val) RETURN_CASE(RegisterId, name, #name) |
| 293 | #include "llvm/DebugInfo/CodeView/CodeViewRegisters.def" |
| 294 | #undef CV_REGISTER |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 295 | } |
Hans Wennborg | dc8d6f2 | 2017-10-03 18:44:12 +0000 | [diff] [blame] | 296 | return formatUnknownEnum(Id); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 297 | } |
| 298 | |
| 299 | static std::string formatRange(LocalVariableAddrRange Range) { |
| 300 | return formatv("[{0},+{1})", |
| 301 | formatSegmentOffset(Range.ISectStart, Range.OffsetStart), |
| 302 | Range.Range) |
| 303 | .str(); |
| 304 | } |
| 305 | |
| 306 | static std::string formatGaps(uint32_t IndentLevel, |
| 307 | ArrayRef<LocalVariableAddrGap> Gaps) { |
| 308 | std::vector<std::string> GapStrs; |
| 309 | for (const auto &G : Gaps) { |
| 310 | GapStrs.push_back(formatv("({0},{1})", G.GapStartOffset, G.Range).str()); |
| 311 | } |
| 312 | return typesetItemList(GapStrs, 7, IndentLevel, ", "); |
| 313 | } |
| 314 | |
| 315 | Error MinimalSymbolDumper::visitSymbolBegin(codeview::CVSymbol &Record) { |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 316 | return visitSymbolBegin(Record, 0); |
| 317 | } |
| 318 | |
| 319 | Error MinimalSymbolDumper::visitSymbolBegin(codeview::CVSymbol &Record, |
| 320 | uint32_t Offset) { |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 321 | // formatLine puts the newline at the beginning, so we use formatLine here |
| 322 | // to start a new line, and then individual visit methods use format to |
| 323 | // append to the existing line. |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 324 | P.formatLine("{0} | {1} [size = {2}]", |
| 325 | fmt_align(Offset, AlignStyle::Right, 6), |
Zachary Turner | d1de2f4 | 2017-08-21 14:53:25 +0000 | [diff] [blame] | 326 | formatSymbolKind(Record.Type), Record.length()); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 327 | P.Indent(); |
| 328 | return Error::success(); |
| 329 | } |
| 330 | |
| 331 | Error MinimalSymbolDumper::visitSymbolEnd(CVSymbol &Record) { |
Zachary Turner | f401e11 | 2017-08-17 20:04:31 +0000 | [diff] [blame] | 332 | if (RecordBytes) { |
| 333 | AutoIndent Indent(P, 7); |
| 334 | P.formatBinary("bytes", Record.content(), 0); |
| 335 | } |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 336 | P.Unindent(); |
| 337 | return Error::success(); |
| 338 | } |
| 339 | |
Zachary Turner | 59e3ae8 | 2017-08-08 18:34:44 +0000 | [diff] [blame] | 340 | std::string MinimalSymbolDumper::typeOrIdIndex(codeview::TypeIndex TI, |
| 341 | bool IsType) const { |
Zachary Turner | a1eb943 | 2017-12-15 00:27:49 +0000 | [diff] [blame] | 342 | if (TI.isSimple() || TI.isDecoratedItemId()) |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 343 | return formatv("{0}", TI).str(); |
Zachary Turner | 59e3ae8 | 2017-08-08 18:34:44 +0000 | [diff] [blame] | 344 | auto &Container = IsType ? Types : Ids; |
| 345 | StringRef Name = Container.getTypeName(TI); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 346 | if (Name.size() > 32) { |
| 347 | Name = Name.take_front(32); |
| 348 | return formatv("{0} ({1}...)", TI, Name); |
| 349 | } else |
| 350 | return formatv("{0} ({1})", TI, Name); |
| 351 | } |
| 352 | |
Zachary Turner | 59e3ae8 | 2017-08-08 18:34:44 +0000 | [diff] [blame] | 353 | std::string MinimalSymbolDumper::idIndex(codeview::TypeIndex TI) const { |
| 354 | return typeOrIdIndex(TI, false); |
| 355 | } |
| 356 | |
| 357 | std::string MinimalSymbolDumper::typeIndex(TypeIndex TI) const { |
| 358 | return typeOrIdIndex(TI, true); |
| 359 | } |
| 360 | |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 361 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, BlockSym &Block) { |
| 362 | P.format(" `{0}`", Block.Name); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 363 | AutoIndent Indent(P, 7); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 364 | P.formatLine("parent = {0}, end = {1}", Block.Parent, Block.End); |
| 365 | P.formatLine("code size = {0}, addr = {1}", Block.CodeSize, |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 366 | formatSegmentOffset(Block.Segment, Block.CodeOffset)); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 367 | return Error::success(); |
| 368 | } |
| 369 | |
| 370 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, Thunk32Sym &Thunk) { |
| 371 | P.format(" `{0}`", Thunk.Name); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 372 | AutoIndent Indent(P, 7); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 373 | P.formatLine("parent = {0}, end = {1}, next = {2}", Thunk.Parent, Thunk.End, |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 374 | Thunk.Next); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 375 | P.formatLine("kind = {0}, size = {1}, addr = {2}", |
| 376 | formatThunkOrdinal(Thunk.Thunk), Thunk.Length, |
| 377 | formatSegmentOffset(Thunk.Segment, Thunk.Offset)); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 378 | |
| 379 | return Error::success(); |
| 380 | } |
| 381 | |
| 382 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 383 | TrampolineSym &Tramp) { |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 384 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 385 | P.formatLine("type = {0}, size = {1}, source = {2}, target = {3}", |
| 386 | formatTrampolineType(Tramp.Type), Tramp.Size, |
| 387 | formatSegmentOffset(Tramp.ThunkSection, Tramp.ThunkOffset), |
| 388 | formatSegmentOffset(Tramp.TargetSection, Tramp.ThunkOffset)); |
| 389 | |
| 390 | return Error::success(); |
| 391 | } |
| 392 | |
| 393 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 394 | SectionSym &Section) { |
| 395 | P.format(" `{0}`", Section.Name); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 396 | AutoIndent Indent(P, 7); |
Zachary Turner | 28e31ee | 2017-08-11 20:46:28 +0000 | [diff] [blame] | 397 | P.formatLine("length = {0}, alignment = {1}, rva = {2}, section # = {3}", |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 398 | Section.Length, Section.Alignment, Section.Rva, |
Zachary Turner | 28e31ee | 2017-08-11 20:46:28 +0000 | [diff] [blame] | 399 | Section.SectionNumber); |
| 400 | P.printLine("characteristics ="); |
| 401 | AutoIndent Indent2(P, 2); |
| 402 | P.printLine(formatSectionCharacteristics(P.getIndentLevel(), |
| 403 | Section.Characteristics, 1, "", |
| 404 | CharacteristicStyle::Descriptive)); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 405 | return Error::success(); |
| 406 | } |
| 407 | |
| 408 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, CoffGroupSym &CG) { |
| 409 | P.format(" `{0}`", CG.Name); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 410 | AutoIndent Indent(P, 7); |
Zachary Turner | 28e31ee | 2017-08-11 20:46:28 +0000 | [diff] [blame] | 411 | P.formatLine("length = {0}, addr = {1}", CG.Size, |
| 412 | formatSegmentOffset(CG.Segment, CG.Offset)); |
| 413 | P.printLine("characteristics ="); |
| 414 | AutoIndent Indent2(P, 2); |
| 415 | P.printLine(formatSectionCharacteristics(P.getIndentLevel(), |
| 416 | CG.Characteristics, 1, "", |
| 417 | CharacteristicStyle::Descriptive)); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 418 | return Error::success(); |
| 419 | } |
| 420 | |
| 421 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 422 | BPRelativeSym &BPRel) { |
| 423 | P.format(" `{0}`", BPRel.Name); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 424 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 425 | P.formatLine("type = {0}, offset = {1}", typeIndex(BPRel.Type), BPRel.Offset); |
| 426 | return Error::success(); |
| 427 | } |
| 428 | |
| 429 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 430 | BuildInfoSym &BuildInfo) { |
| 431 | P.format(" BuildId = `{0}`", BuildInfo.BuildId); |
| 432 | return Error::success(); |
| 433 | } |
| 434 | |
| 435 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 436 | CallSiteInfoSym &CSI) { |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 437 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 438 | P.formatLine("type = {0}, addr = {1}", typeIndex(CSI.Type), |
| 439 | formatSegmentOffset(CSI.Segment, CSI.CodeOffset)); |
| 440 | return Error::success(); |
| 441 | } |
| 442 | |
| 443 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 444 | EnvBlockSym &EnvBlock) { |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 445 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 446 | for (const auto &Entry : EnvBlock.Fields) { |
| 447 | P.formatLine("- {0}", Entry); |
| 448 | } |
| 449 | return Error::success(); |
| 450 | } |
| 451 | |
| 452 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, FileStaticSym &FS) { |
| 453 | P.format(" `{0}`", FS.Name); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 454 | AutoIndent Indent(P, 7); |
Zachary Turner | 6047858 | 2018-01-05 19:12:40 +0000 | [diff] [blame^] | 455 | if (SymGroup) { |
| 456 | Expected<StringRef> FileName = |
| 457 | SymGroup->getNameFromStringTable(FS.ModFilenameOffset); |
| 458 | if (FileName) { |
| 459 | P.formatLine("type = {0}, file name = {1} ({2}), flags = {3}", |
| 460 | typeIndex(FS.Index), FS.ModFilenameOffset, *FileName, |
| 461 | formatLocalSymFlags(P.getIndentLevel() + 9, FS.Flags)); |
| 462 | } |
| 463 | return Error::success(); |
| 464 | } |
| 465 | |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 466 | P.formatLine("type = {0}, file name offset = {1}, flags = {2}", |
| 467 | typeIndex(FS.Index), FS.ModFilenameOffset, |
| 468 | formatLocalSymFlags(P.getIndentLevel() + 9, FS.Flags)); |
| 469 | return Error::success(); |
| 470 | } |
| 471 | |
| 472 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, ExportSym &Export) { |
| 473 | P.format(" `{0}`", Export.Name); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 474 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 475 | P.formatLine("ordinal = {0}, flags = {1}", Export.Ordinal, |
| 476 | formatExportFlags(P.getIndentLevel() + 9, Export.Flags)); |
| 477 | return Error::success(); |
| 478 | } |
| 479 | |
| 480 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 481 | Compile2Sym &Compile2) { |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 482 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 483 | SourceLanguage Lang = static_cast<SourceLanguage>( |
| 484 | Compile2.Flags & CompileSym2Flags::SourceLanguageMask); |
| 485 | P.formatLine("machine = {0}, ver = {1}, language = {2}", |
| 486 | formatMachineType(Compile2.Machine), Compile2.Version, |
| 487 | formatSourceLanguage(Lang)); |
| 488 | P.formatLine("frontend = {0}.{1}.{2}, backend = {3}.{4}.{5}", |
| 489 | Compile2.VersionFrontendMajor, Compile2.VersionFrontendMinor, |
| 490 | Compile2.VersionFrontendBuild, Compile2.VersionBackendMajor, |
| 491 | Compile2.VersionBackendMinor, Compile2.VersionBackendBuild); |
| 492 | P.formatLine("flags = {0}", |
| 493 | formatCompileSym2Flags(P.getIndentLevel() + 9, Compile2.Flags)); |
| 494 | P.formatLine( |
| 495 | "extra strings = {0}", |
| 496 | typesetStringList(P.getIndentLevel() + 9 + 2, Compile2.ExtraStrings)); |
| 497 | return Error::success(); |
| 498 | } |
| 499 | |
| 500 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 501 | Compile3Sym &Compile3) { |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 502 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 503 | SourceLanguage Lang = static_cast<SourceLanguage>( |
| 504 | Compile3.Flags & CompileSym3Flags::SourceLanguageMask); |
| 505 | P.formatLine("machine = {0}, Ver = {1}, language = {2}", |
| 506 | formatMachineType(Compile3.Machine), Compile3.Version, |
| 507 | formatSourceLanguage(Lang)); |
| 508 | P.formatLine("frontend = {0}.{1}.{2}.{3}, backend = {4}.{5}.{6}.{7}", |
| 509 | Compile3.VersionFrontendMajor, Compile3.VersionFrontendMinor, |
| 510 | Compile3.VersionFrontendBuild, Compile3.VersionFrontendQFE, |
| 511 | Compile3.VersionBackendMajor, Compile3.VersionBackendMinor, |
| 512 | Compile3.VersionBackendBuild, Compile3.VersionBackendQFE); |
| 513 | P.formatLine("flags = {0}", |
| 514 | formatCompileSym3Flags(P.getIndentLevel() + 9, Compile3.Flags)); |
| 515 | return Error::success(); |
| 516 | } |
| 517 | |
| 518 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 519 | ConstantSym &Constant) { |
| 520 | P.format(" `{0}`", Constant.Name); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 521 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 522 | P.formatLine("type = {0}, value = {1}", typeIndex(Constant.Type), |
| 523 | Constant.Value.toString(10)); |
| 524 | return Error::success(); |
| 525 | } |
| 526 | |
| 527 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, DataSym &Data) { |
| 528 | P.format(" `{0}`", Data.Name); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 529 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 530 | P.formatLine("type = {0}, addr = {1}", typeIndex(Data.Type), |
| 531 | formatSegmentOffset(Data.Segment, Data.DataOffset)); |
| 532 | return Error::success(); |
| 533 | } |
| 534 | |
| 535 | Error MinimalSymbolDumper::visitKnownRecord( |
| 536 | CVSymbol &CVR, DefRangeFramePointerRelFullScopeSym &Def) { |
| 537 | P.format(" offset = {0}", Def.Offset); |
| 538 | return Error::success(); |
| 539 | } |
| 540 | |
| 541 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 542 | DefRangeFramePointerRelSym &Def) { |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 543 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 544 | P.formatLine("offset = {0}, range = {1}", Def.Offset, formatRange(Def.Range)); |
| 545 | P.formatLine("gaps = {2}", Def.Offset, |
| 546 | formatGaps(P.getIndentLevel() + 9, Def.Gaps)); |
| 547 | return Error::success(); |
| 548 | } |
| 549 | |
| 550 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 551 | DefRangeRegisterRelSym &Def) { |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 552 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 553 | P.formatLine("register = {0}, base ptr = {1}, offset in parent = {2}, has " |
| 554 | "spilled udt = {3}", |
| 555 | uint16_t(Def.Hdr.Register), int32_t(Def.Hdr.BasePointerOffset), |
| 556 | Def.offsetInParent(), Def.hasSpilledUDTMember()); |
| 557 | P.formatLine("range = {0}, gaps = {1}", formatRange(Def.Range), |
| 558 | formatGaps(P.getIndentLevel() + 9, Def.Gaps)); |
| 559 | return Error::success(); |
| 560 | } |
| 561 | |
| 562 | Error MinimalSymbolDumper::visitKnownRecord( |
| 563 | CVSymbol &CVR, DefRangeRegisterSym &DefRangeRegister) { |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 564 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 565 | P.formatLine("register = {0}, may have no name = {1}, range start = " |
| 566 | "{2}, length = {3}", |
| 567 | uint16_t(DefRangeRegister.Hdr.Register), |
| 568 | uint16_t(DefRangeRegister.Hdr.MayHaveNoName), |
| 569 | formatSegmentOffset(DefRangeRegister.Range.ISectStart, |
| 570 | DefRangeRegister.Range.OffsetStart), |
| 571 | DefRangeRegister.Range.Range); |
| 572 | P.formatLine("gaps = [{0}]", |
| 573 | formatGaps(P.getIndentLevel() + 9, DefRangeRegister.Gaps)); |
| 574 | return Error::success(); |
| 575 | } |
| 576 | |
| 577 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 578 | DefRangeSubfieldRegisterSym &Def) { |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 579 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 580 | bool NoName = !!(Def.Hdr.MayHaveNoName == 0); |
| 581 | P.formatLine("register = {0}, may have no name = {1}, offset in parent = {2}", |
| 582 | uint16_t(Def.Hdr.Register), NoName, |
| 583 | uint32_t(Def.Hdr.OffsetInParent)); |
| 584 | P.formatLine("range = {0}, gaps = {1}", formatRange(Def.Range), |
| 585 | formatGaps(P.getIndentLevel() + 9, Def.Gaps)); |
| 586 | return Error::success(); |
| 587 | } |
| 588 | |
| 589 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 590 | DefRangeSubfieldSym &Def) { |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 591 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 592 | P.formatLine("program = {0}, offset in parent = {1}, range = {2}", |
| 593 | Def.Program, Def.OffsetInParent, formatRange(Def.Range)); |
| 594 | P.formatLine("gaps = {0}", formatGaps(P.getIndentLevel() + 9, Def.Gaps)); |
| 595 | return Error::success(); |
| 596 | } |
| 597 | |
| 598 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, DefRangeSym &Def) { |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 599 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 600 | P.formatLine("program = {0}, range = {1}", Def.Program, |
| 601 | formatRange(Def.Range)); |
| 602 | P.formatLine("gaps = {0}", formatGaps(P.getIndentLevel() + 9, Def.Gaps)); |
| 603 | return Error::success(); |
| 604 | } |
| 605 | |
| 606 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, FrameCookieSym &FC) { |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 607 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 608 | P.formatLine("code offset = {0}, Register = {1}, kind = {2}, flags = {3}", |
| 609 | FC.CodeOffset, FC.Register, formatCookieKind(FC.CookieKind), |
| 610 | FC.Flags); |
| 611 | return Error::success(); |
| 612 | } |
| 613 | |
| 614 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, FrameProcSym &FP) { |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 615 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 616 | P.formatLine("size = {0}, padding size = {1}, offset to padding = {2}", |
| 617 | FP.TotalFrameBytes, FP.PaddingFrameBytes, FP.OffsetToPadding); |
| 618 | P.formatLine("bytes of callee saved registers = {0}, exception handler addr " |
| 619 | "= {1}", |
| 620 | FP.BytesOfCalleeSavedRegisters, |
| 621 | formatSegmentOffset(FP.SectionIdOfExceptionHandler, |
| 622 | FP.OffsetOfExceptionHandler)); |
| 623 | P.formatLine("flags = {0}", |
| 624 | formatFrameProcedureOptions(P.getIndentLevel() + 9, FP.Flags)); |
| 625 | return Error::success(); |
| 626 | } |
| 627 | |
| 628 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 629 | HeapAllocationSiteSym &HAS) { |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 630 | AutoIndent Indent(P, 7); |
Reid Kleckner | 8aa32ff | 2017-10-24 17:02:40 +0000 | [diff] [blame] | 631 | P.formatLine("type = {0}, addr = {1} call size = {2}", typeIndex(HAS.Type), |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 632 | formatSegmentOffset(HAS.Segment, HAS.CodeOffset), |
| 633 | HAS.CallInstructionSize); |
| 634 | return Error::success(); |
| 635 | } |
| 636 | |
| 637 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, InlineSiteSym &IS) { |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 638 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 639 | auto Bytes = makeArrayRef(IS.AnnotationData); |
| 640 | StringRef Annotations(reinterpret_cast<const char *>(Bytes.begin()), |
| 641 | Bytes.size()); |
| 642 | |
Zachary Turner | 96bcd6a | 2017-08-17 20:04:51 +0000 | [diff] [blame] | 643 | P.formatLine("inlinee = {0}, parent = {1}, end = {2}", idIndex(IS.Inlinee), |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 644 | IS.Parent, IS.End); |
| 645 | P.formatLine("annotations = {0}", toHex(Annotations)); |
| 646 | return Error::success(); |
| 647 | } |
| 648 | |
| 649 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 650 | RegisterSym &Register) { |
| 651 | P.format(" `{0}`", Register.Name); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 652 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 653 | P.formatLine("register = {0}, type = {1}", |
| 654 | formatRegisterId(Register.Register), typeIndex(Register.Index)); |
| 655 | return Error::success(); |
| 656 | } |
| 657 | |
| 658 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 659 | PublicSym32 &Public) { |
| 660 | P.format(" `{0}`", Public.Name); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 661 | AutoIndent Indent(P, 7); |
Reid Kleckner | 18d90e1 | 2017-06-19 16:54:51 +0000 | [diff] [blame] | 662 | P.formatLine("flags = {0}, addr = {1}", |
| 663 | formatPublicSymFlags(P.getIndentLevel() + 9, Public.Flags), |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 664 | formatSegmentOffset(Public.Segment, Public.Offset)); |
| 665 | return Error::success(); |
| 666 | } |
| 667 | |
| 668 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, ProcRefSym &PR) { |
| 669 | P.format(" `{0}`", PR.Name); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 670 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 671 | P.formatLine("module = {0}, sum name = {1}, offset = {2}", PR.Module, |
| 672 | PR.SumName, PR.SymOffset); |
| 673 | return Error::success(); |
| 674 | } |
| 675 | |
| 676 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, LabelSym &Label) { |
| 677 | P.format(" `{0}` (addr = {1})", Label.Name, |
| 678 | formatSegmentOffset(Label.Segment, Label.CodeOffset)); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 679 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 680 | P.formatLine("flags = {0}", |
| 681 | formatProcSymFlags(P.getIndentLevel() + 9, Label.Flags)); |
| 682 | return Error::success(); |
| 683 | } |
| 684 | |
| 685 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, LocalSym &Local) { |
| 686 | P.format(" `{0}`", Local.Name); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 687 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 688 | |
| 689 | std::string FlagStr = |
| 690 | formatLocalSymFlags(P.getIndentLevel() + 9, Local.Flags); |
| 691 | P.formatLine("type={0}, flags = {1}", typeIndex(Local.Type), FlagStr); |
| 692 | return Error::success(); |
| 693 | } |
| 694 | |
| 695 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 696 | ObjNameSym &ObjName) { |
| 697 | P.format(" sig={0}, `{1}`", ObjName.Signature, ObjName.Name); |
| 698 | return Error::success(); |
| 699 | } |
| 700 | |
| 701 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, ProcSym &Proc) { |
| 702 | P.format(" `{0}`", Proc.Name); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 703 | AutoIndent Indent(P, 7); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 704 | P.formatLine("parent = {0}, end = {1}, addr = {2}, code size = {3}", |
| 705 | Proc.Parent, Proc.End, |
| 706 | formatSegmentOffset(Proc.Segment, Proc.CodeOffset), |
| 707 | Proc.CodeSize); |
Zachary Turner | 59e3ae8 | 2017-08-08 18:34:44 +0000 | [diff] [blame] | 708 | bool IsType = true; |
| 709 | switch (Proc.getKind()) { |
| 710 | case SymbolRecordKind::GlobalProcIdSym: |
| 711 | case SymbolRecordKind::ProcIdSym: |
| 712 | case SymbolRecordKind::DPCProcIdSym: |
| 713 | IsType = false; |
| 714 | break; |
| 715 | default: |
| 716 | break; |
| 717 | } |
Reid Kleckner | af88a91 | 2017-07-15 18:10:39 +0000 | [diff] [blame] | 718 | P.formatLine("type = `{0}`, debug start = {1}, debug end = {2}, flags = {3}", |
Zachary Turner | 59e3ae8 | 2017-08-08 18:34:44 +0000 | [diff] [blame] | 719 | typeOrIdIndex(Proc.FunctionType, IsType), Proc.DbgStart, |
| 720 | Proc.DbgEnd, |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 721 | formatProcSymFlags(P.getIndentLevel() + 9, Proc.Flags)); |
| 722 | return Error::success(); |
| 723 | } |
| 724 | |
| 725 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 726 | ScopeEndSym &ScopeEnd) { |
| 727 | return Error::success(); |
| 728 | } |
| 729 | |
| 730 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, CallerSym &Caller) { |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 731 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 732 | for (const auto &I : Caller.Indices) { |
Zachary Turner | 96bcd6a | 2017-08-17 20:04:51 +0000 | [diff] [blame] | 733 | P.formatLine("callee: {0}", idIndex(I)); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 734 | } |
| 735 | return Error::success(); |
| 736 | } |
| 737 | |
| 738 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 739 | RegRelativeSym &RegRel) { |
| 740 | P.format(" `{0}`", RegRel.Name); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 741 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 742 | P.formatLine("type = {0}, register = {1}, offset = {2}", |
| 743 | typeIndex(RegRel.Type), formatRegisterId(RegRel.Register), |
| 744 | RegRel.Offset); |
| 745 | return Error::success(); |
| 746 | } |
| 747 | |
| 748 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, |
| 749 | ThreadLocalDataSym &Data) { |
| 750 | P.format(" `{0}`", Data.Name); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 751 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 752 | P.formatLine("type = {0}, addr = {1}", typeIndex(Data.Type), |
| 753 | formatSegmentOffset(Data.Segment, Data.DataOffset)); |
| 754 | return Error::success(); |
| 755 | } |
| 756 | |
| 757 | Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, UDTSym &UDT) { |
| 758 | P.format(" `{0}`", UDT.Name); |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 759 | AutoIndent Indent(P, 7); |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 760 | P.formatLine("original type = {0}", UDT.Type); |
| 761 | return Error::success(); |
| 762 | } |