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