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