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