LLVM  4.0.0
SymbolDumper.cpp
Go to the documentation of this file.
1 //===-- SymbolDumper.cpp - CodeView symbol info dumper ----------*- 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 
11 #include "llvm/ADT/DenseMap.h"
12 #include "llvm/ADT/SmallString.h"
22 #include "llvm/Support/Error.h"
24 
25 #include <system_error>
26 
27 using namespace llvm;
28 using namespace llvm::codeview;
29 
30 namespace {
31 /// Use this private dumper implementation to keep implementation details about
32 /// the visitor out of SymbolDumper.h.
33 class CVSymbolDumperImpl : public SymbolVisitorCallbacks {
34 public:
35  CVSymbolDumperImpl(TypeDatabase &TypeDB, SymbolDumpDelegate *ObjDelegate,
36  ScopedPrinter &W, bool PrintRecordBytes)
37  : TypeDB(TypeDB), ObjDelegate(ObjDelegate), W(W),
38  PrintRecordBytes(PrintRecordBytes), InFunctionScope(false) {}
39 
40 /// CVSymbolVisitor overrides.
41 #define SYMBOL_RECORD(EnumName, EnumVal, Name) \
42  Error visitKnownRecord(CVSymbol &CVR, Name &Record) override;
43 #define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
44 #include "llvm/DebugInfo/CodeView/CVSymbolTypes.def"
45 
46  Error visitSymbolBegin(CVSymbol &Record) override;
47  Error visitSymbolEnd(CVSymbol &Record) override;
48  Error visitUnknownSymbol(CVSymbol &Record) override;
49 
50 private:
51  void printLocalVariableAddrRange(const LocalVariableAddrRange &Range,
52  uint32_t RelocationOffset);
53  void printLocalVariableAddrGap(ArrayRef<LocalVariableAddrGap> Gaps);
54  void printTypeIndex(StringRef FieldName, TypeIndex TI);
55 
56  TypeDatabase &TypeDB;
57  SymbolDumpDelegate *ObjDelegate;
58  ScopedPrinter &W;
59 
60  bool PrintRecordBytes;
61  bool InFunctionScope;
62 };
63 }
64 
65 void CVSymbolDumperImpl::printLocalVariableAddrRange(
66  const LocalVariableAddrRange &Range, uint32_t RelocationOffset) {
67  DictScope S(W, "LocalVariableAddrRange");
68  if (ObjDelegate)
69  ObjDelegate->printRelocatedField("OffsetStart", RelocationOffset,
70  Range.OffsetStart);
71  W.printHex("ISectStart", Range.ISectStart);
72  W.printHex("Range", Range.Range);
73 }
74 
75 void CVSymbolDumperImpl::printLocalVariableAddrGap(
77  for (auto &Gap : Gaps) {
78  ListScope S(W, "LocalVariableAddrGap");
79  W.printHex("GapStartOffset", Gap.GapStartOffset);
80  W.printHex("Range", Gap.Range);
81  }
82 }
83 
84 void CVSymbolDumperImpl::printTypeIndex(StringRef FieldName, TypeIndex TI) {
85  CVTypeDumper::printTypeIndex(W, FieldName, TI, TypeDB);
86 }
87 
88 Error CVSymbolDumperImpl::visitSymbolBegin(CVSymbol &CVR) {
89  return Error::success();
90 }
91 
92 Error CVSymbolDumperImpl::visitSymbolEnd(CVSymbol &CVR) {
93  if (PrintRecordBytes && ObjDelegate)
94  ObjDelegate->printBinaryBlockWithRelocs("SymData", CVR.content());
95  return Error::success();
96 }
97 
99  DictScope S(W, "BlockStart");
100 
102  W.printHex("PtrParent", Block.Parent);
103  W.printHex("PtrEnd", Block.End);
104  W.printHex("CodeSize", Block.CodeSize);
105  if (ObjDelegate) {
106  ObjDelegate->printRelocatedField("CodeOffset", Block.getRelocationOffset(),
107  Block.CodeOffset, &LinkageName);
108  }
109  W.printHex("Segment", Block.Segment);
110  W.printString("BlockName", Block.Name);
111  W.printString("LinkageName", LinkageName);
112  return Error::success();
113 }
114 
116  DictScope S(W, "Thunk32");
117  W.printNumber("Parent", Thunk.Parent);
118  W.printNumber("End", Thunk.End);
119  W.printNumber("Next", Thunk.Next);
120  W.printNumber("Off", Thunk.Offset);
121  W.printNumber("Seg", Thunk.Segment);
122  W.printNumber("Len", Thunk.Length);
123  W.printEnum("Ordinal", uint8_t(Thunk.Thunk), getThunkOrdinalNames());
124  return Error::success();
125 }
126 
128  TrampolineSym &Tramp) {
129  DictScope S(W, "Trampoline");
130  W.printEnum("Type", uint16_t(Tramp.Type), getTrampolineNames());
131  W.printNumber("Size", Tramp.Size);
132  W.printNumber("ThunkOff", Tramp.ThunkOffset);
133  W.printNumber("TargetOff", Tramp.TargetOffset);
134  W.printNumber("ThunkSection", Tramp.ThunkSection);
135  W.printNumber("TargetSection", Tramp.TargetSection);
136  return Error::success();
137 }
138 
140  DictScope S(W, "Section");
141  W.printNumber("SectionNumber", Section.SectionNumber);
142  W.printNumber("Alignment", Section.Alignment);
143  W.printNumber("Rva", Section.Rva);
144  W.printNumber("Length", Section.Length);
145  W.printFlags("Characteristics", Section.Characteristics,
147  COFF::SectionCharacteristics(0x00F00000));
148 
149  W.printString("Name", Section.Name);
150  return Error::success();
151 }
152 
154  CoffGroupSym &CoffGroup) {
155  DictScope S(W, "COFF Group");
156  W.printNumber("Size", CoffGroup.Size);
157  W.printFlags("Characteristics", CoffGroup.Characteristics,
159  COFF::SectionCharacteristics(0x00F00000));
160  W.printNumber("Offset", CoffGroup.Offset);
161  W.printNumber("Segment", CoffGroup.Segment);
162  W.printString("Name", CoffGroup.Name);
163  return Error::success();
164 }
165 
167  BPRelativeSym &BPRel) {
168  DictScope S(W, "BPRelativeSym");
169 
170  W.printNumber("Offset", BPRel.Offset);
171  printTypeIndex("Type", BPRel.Type);
172  W.printString("VarName", BPRel.Name);
173  return Error::success();
174 }
175 
177  BuildInfoSym &BuildInfo) {
178  DictScope S(W, "BuildInfo");
179 
180  W.printNumber("BuildId", BuildInfo.BuildId);
181  return Error::success();
182 }
183 
185  CallSiteInfoSym &CallSiteInfo) {
186  DictScope S(W, "CallSiteInfo");
187 
188  StringRef LinkageName;
189  if (ObjDelegate) {
190  ObjDelegate->printRelocatedField("CodeOffset",
191  CallSiteInfo.getRelocationOffset(),
192  CallSiteInfo.CodeOffset, &LinkageName);
193  }
194  W.printHex("Segment", CallSiteInfo.Segment);
195  printTypeIndex("Type", CallSiteInfo.Type);
196  if (!LinkageName.empty())
197  W.printString("LinkageName", LinkageName);
198  return Error::success();
199 }
200 
202  EnvBlockSym &EnvBlock) {
203  DictScope S(W, "EnvBlock");
204 
205  ListScope L(W, "Entries");
206  for (auto Entry : EnvBlock.Fields) {
207  W.printString(Entry);
208  }
209  return Error::success();
210 }
211 
213  FileStaticSym &FileStatic) {
214  DictScope S(W, "FileStatic");
215  W.printNumber("Index", FileStatic.Index);
216  W.printNumber("ModFilenameOffset", FileStatic.ModFilenameOffset);
217  W.printFlags("Flags", uint16_t(FileStatic.Flags), getLocalFlagNames());
218  W.printString("Name", FileStatic.Name);
219  return Error::success();
220 }
221 
223  DictScope S(W, "Export");
224  W.printNumber("Ordinal", Export.Ordinal);
225  W.printFlags("Flags", uint16_t(Export.Flags), getExportSymFlagNames());
226  W.printString("Name", Export.Name);
227  return Error::success();
228 }
229 
231  Compile2Sym &Compile2) {
232  DictScope S(W, "CompilerFlags2");
233 
234  W.printEnum("Language", Compile2.getLanguage(), getSourceLanguageNames());
235  W.printFlags("Flags", Compile2.getFlags(), getCompileSym2FlagNames());
236  W.printEnum("Machine", unsigned(Compile2.Machine), getCPUTypeNames());
237  std::string FrontendVersion;
238  {
239  raw_string_ostream Out(FrontendVersion);
240  Out << Compile2.VersionFrontendMajor << '.' << Compile2.VersionFrontendMinor
241  << '.' << Compile2.VersionFrontendBuild;
242  }
243  std::string BackendVersion;
244  {
245  raw_string_ostream Out(BackendVersion);
246  Out << Compile2.VersionBackendMajor << '.' << Compile2.VersionBackendMinor
247  << '.' << Compile2.VersionBackendBuild;
248  }
249  W.printString("FrontendVersion", FrontendVersion);
250  W.printString("BackendVersion", BackendVersion);
251  W.printString("VersionName", Compile2.Version);
252  return Error::success();
253 }
254 
256  Compile3Sym &Compile3) {
257  DictScope S(W, "CompilerFlags3");
258 
259  W.printEnum("Language", Compile3.getLanguage(), getSourceLanguageNames());
260  W.printFlags("Flags", Compile3.getFlags(), getCompileSym3FlagNames());
261  W.printEnum("Machine", unsigned(Compile3.Machine), getCPUTypeNames());
262  std::string FrontendVersion;
263  {
264  raw_string_ostream Out(FrontendVersion);
265  Out << Compile3.VersionFrontendMajor << '.' << Compile3.VersionFrontendMinor
266  << '.' << Compile3.VersionFrontendBuild << '.'
267  << Compile3.VersionFrontendQFE;
268  }
269  std::string BackendVersion;
270  {
271  raw_string_ostream Out(BackendVersion);
272  Out << Compile3.VersionBackendMajor << '.' << Compile3.VersionBackendMinor
273  << '.' << Compile3.VersionBackendBuild << '.'
274  << Compile3.VersionBackendQFE;
275  }
276  W.printString("FrontendVersion", FrontendVersion);
277  W.printString("BackendVersion", BackendVersion);
278  W.printString("VersionName", Compile3.Version);
279  return Error::success();
280 }
281 
284  DictScope S(W, "Constant");
285 
286  printTypeIndex("Type", Constant.Type);
287  W.printNumber("Value", Constant.Value);
288  W.printString("Name", Constant.Name);
289  return Error::success();
290 }
291 
293  DictScope S(W, "DataSym");
294 
295  W.printEnum("Kind", uint16_t(CVR.kind()), getSymbolTypeNames());
296  StringRef LinkageName;
297  if (ObjDelegate) {
298  ObjDelegate->printRelocatedField("DataOffset", Data.getRelocationOffset(),
299  Data.DataOffset, &LinkageName);
300  }
301  printTypeIndex("Type", Data.Type);
302  W.printString("DisplayName", Data.Name);
303  if (!LinkageName.empty())
304  W.printString("LinkageName", LinkageName);
305  return Error::success();
306 }
307 
309  CVSymbol &CVR,
310  DefRangeFramePointerRelFullScopeSym &DefRangeFramePointerRelFullScope) {
311  DictScope S(W, "DefRangeFramePointerRelFullScope");
312  W.printNumber("Offset", DefRangeFramePointerRelFullScope.Offset);
313  return Error::success();
314 }
315 
317  CVSymbol &CVR, DefRangeFramePointerRelSym &DefRangeFramePointerRel) {
318  DictScope S(W, "DefRangeFramePointerRel");
319 
320  W.printNumber("Offset", DefRangeFramePointerRel.Offset);
321  printLocalVariableAddrRange(DefRangeFramePointerRel.Range,
322  DefRangeFramePointerRel.getRelocationOffset());
323  printLocalVariableAddrGap(DefRangeFramePointerRel.Gaps);
324  return Error::success();
325 }
326 
328  CVSymbol &CVR, DefRangeRegisterRelSym &DefRangeRegisterRel) {
329  DictScope S(W, "DefRangeRegisterRel");
330 
331  W.printNumber("BaseRegister", DefRangeRegisterRel.Hdr.Register);
332  W.printBoolean("HasSpilledUDTMember",
333  DefRangeRegisterRel.hasSpilledUDTMember());
334  W.printNumber("OffsetInParent", DefRangeRegisterRel.offsetInParent());
335  W.printNumber("BasePointerOffset", DefRangeRegisterRel.Hdr.BasePointerOffset);
336  printLocalVariableAddrRange(DefRangeRegisterRel.Range,
337  DefRangeRegisterRel.getRelocationOffset());
338  printLocalVariableAddrGap(DefRangeRegisterRel.Gaps);
339  return Error::success();
340 }
341 
343  CVSymbol &CVR, DefRangeRegisterSym &DefRangeRegister) {
344  DictScope S(W, "DefRangeRegister");
345 
346  W.printNumber("Register", DefRangeRegister.Hdr.Register);
347  W.printNumber("MayHaveNoName", DefRangeRegister.Hdr.MayHaveNoName);
348  printLocalVariableAddrRange(DefRangeRegister.Range,
349  DefRangeRegister.getRelocationOffset());
350  printLocalVariableAddrGap(DefRangeRegister.Gaps);
351  return Error::success();
352 }
353 
355  CVSymbol &CVR, DefRangeSubfieldRegisterSym &DefRangeSubfieldRegister) {
356  DictScope S(W, "DefRangeSubfieldRegister");
357 
358  W.printNumber("Register", DefRangeSubfieldRegister.Hdr.Register);
359  W.printNumber("MayHaveNoName", DefRangeSubfieldRegister.Hdr.MayHaveNoName);
360  W.printNumber("OffsetInParent", DefRangeSubfieldRegister.Hdr.OffsetInParent);
361  printLocalVariableAddrRange(DefRangeSubfieldRegister.Range,
362  DefRangeSubfieldRegister.getRelocationOffset());
363  printLocalVariableAddrGap(DefRangeSubfieldRegister.Gaps);
364  return Error::success();
365 }
366 
368  CVSymbol &CVR, DefRangeSubfieldSym &DefRangeSubfield) {
369  DictScope S(W, "DefRangeSubfield");
370 
371  if (ObjDelegate) {
372  StringRef StringTable = ObjDelegate->getStringTable();
373  auto ProgramStringTableOffset = DefRangeSubfield.Program;
374  if (ProgramStringTableOffset >= StringTable.size())
375  return llvm::make_error<CodeViewError>(
376  "String table offset outside of bounds of String Table!");
377  StringRef Program =
378  StringTable.drop_front(ProgramStringTableOffset).split('\0').first;
379  W.printString("Program", Program);
380  }
381  W.printNumber("OffsetInParent", DefRangeSubfield.OffsetInParent);
382  printLocalVariableAddrRange(DefRangeSubfield.Range,
383  DefRangeSubfield.getRelocationOffset());
384  printLocalVariableAddrGap(DefRangeSubfield.Gaps);
385  return Error::success();
386 }
387 
389  DefRangeSym &DefRange) {
390  DictScope S(W, "DefRange");
391 
392  if (ObjDelegate) {
393  StringRef StringTable = ObjDelegate->getStringTable();
394  auto ProgramStringTableOffset = DefRange.Program;
395  if (ProgramStringTableOffset >= StringTable.size())
396  return llvm::make_error<CodeViewError>(
397  "String table offset outside of bounds of String Table!");
398  StringRef Program =
399  StringTable.drop_front(ProgramStringTableOffset).split('\0').first;
400  W.printString("Program", Program);
401  }
402  printLocalVariableAddrRange(DefRange.Range, DefRange.getRelocationOffset());
403  printLocalVariableAddrGap(DefRange.Gaps);
404  return Error::success();
405 }
406 
408  FrameCookieSym &FrameCookie) {
409  DictScope S(W, "FrameCookie");
410 
411  StringRef LinkageName;
412  if (ObjDelegate) {
413  ObjDelegate->printRelocatedField("CodeOffset",
414  FrameCookie.getRelocationOffset(),
415  FrameCookie.CodeOffset, &LinkageName);
416  }
417  W.printHex("Register", FrameCookie.Register);
418  W.printEnum("CookieKind", uint16_t(FrameCookie.CookieKind),
420  W.printHex("Flags", FrameCookie.Flags);
421  return Error::success();
422 }
423 
425  FrameProcSym &FrameProc) {
426  DictScope S(W, "FrameProc");
427 
428  W.printHex("TotalFrameBytes", FrameProc.TotalFrameBytes);
429  W.printHex("PaddingFrameBytes", FrameProc.PaddingFrameBytes);
430  W.printHex("OffsetToPadding", FrameProc.OffsetToPadding);
431  W.printHex("BytesOfCalleeSavedRegisters",
432  FrameProc.BytesOfCalleeSavedRegisters);
433  W.printHex("OffsetOfExceptionHandler", FrameProc.OffsetOfExceptionHandler);
434  W.printHex("SectionIdOfExceptionHandler",
435  FrameProc.SectionIdOfExceptionHandler);
436  W.printFlags("Flags", static_cast<uint32_t>(FrameProc.Flags),
438  return Error::success();
439 }
440 
442  CVSymbol &CVR, HeapAllocationSiteSym &HeapAllocSite) {
443  DictScope S(W, "HeapAllocationSite");
444 
445  StringRef LinkageName;
446  if (ObjDelegate) {
447  ObjDelegate->printRelocatedField("CodeOffset",
448  HeapAllocSite.getRelocationOffset(),
449  HeapAllocSite.CodeOffset, &LinkageName);
450  }
451  W.printHex("Segment", HeapAllocSite.Segment);
452  W.printHex("CallInstructionSize", HeapAllocSite.CallInstructionSize);
453  printTypeIndex("Type", HeapAllocSite.Type);
454  if (!LinkageName.empty())
455  W.printString("LinkageName", LinkageName);
456  return Error::success();
457 }
458 
460  InlineSiteSym &InlineSite) {
461  DictScope S(W, "InlineSite");
462 
463  W.printHex("PtrParent", InlineSite.Parent);
464  W.printHex("PtrEnd", InlineSite.End);
465  printTypeIndex("Inlinee", InlineSite.Inlinee);
466 
467  ListScope BinaryAnnotations(W, "BinaryAnnotations");
468  for (auto &Annotation : InlineSite.annotations()) {
469  switch (Annotation.OpCode) {
471  return llvm::make_error<CodeViewError>(
472  "Invalid binary annotation opcode!");
476  W.printHex(Annotation.Name, Annotation.U1);
477  break;
483  W.printNumber(Annotation.Name, Annotation.U1);
484  break;
487  W.printNumber(Annotation.Name, Annotation.S1);
488  break;
490  if (ObjDelegate) {
491  W.printHex("ChangeFile",
492  ObjDelegate->getFileNameForFileOffset(Annotation.U1),
493  Annotation.U1);
494  } else {
495  W.printHex("ChangeFile", Annotation.U1);
496  }
497 
498  break;
500  W.startLine() << "ChangeCodeOffsetAndLineOffset: {CodeOffset: "
501  << W.hex(Annotation.U1) << ", LineOffset: " << Annotation.S1
502  << "}\n";
503  break;
504  }
506  W.startLine() << "ChangeCodeLengthAndCodeOffset: {CodeOffset: "
507  << W.hex(Annotation.U2)
508  << ", Length: " << W.hex(Annotation.U1) << "}\n";
509  break;
510  }
511  }
512  }
513  return Error::success();
514 }
515 
518  DictScope S(W, "RegisterSym");
519  W.printNumber("Type", Register.Index);
520  W.printEnum("Seg", uint16_t(Register.Register), getRegisterNames());
521  W.printString("Name", Register.Name);
522  return Error::success();
523 }
524 
526  DictScope S(W, "PublicSym");
527  W.printNumber("Type", Public.Index);
528  W.printNumber("Seg", Public.Segment);
529  W.printNumber("Off", Public.Offset);
530  W.printString("Name", Public.Name);
531  return Error::success();
532 }
533 
535  DictScope S(W, "ProcRef");
536  W.printNumber("SumName", ProcRef.SumName);
537  W.printNumber("SymOffset", ProcRef.SymOffset);
538  W.printNumber("Mod", ProcRef.Module);
539  W.printString("Name", ProcRef.Name);
540  return Error::success();
541 }
542 
544  DictScope S(W, "Label");
545 
546  StringRef LinkageName;
547  if (ObjDelegate) {
548  ObjDelegate->printRelocatedField("CodeOffset", Label.getRelocationOffset(),
549  Label.CodeOffset, &LinkageName);
550  }
551  W.printHex("Segment", Label.Segment);
552  W.printHex("Flags", uint8_t(Label.Flags));
553  W.printFlags("Flags", uint8_t(Label.Flags), getProcSymFlagNames());
554  W.printString("DisplayName", Label.Name);
555  if (!LinkageName.empty())
556  W.printString("LinkageName", LinkageName);
557  return Error::success();
558 }
559 
561  DictScope S(W, "Local");
562 
563  printTypeIndex("Type", Local.Type);
564  W.printFlags("Flags", uint16_t(Local.Flags), getLocalFlagNames());
565  W.printString("VarName", Local.Name);
566  return Error::success();
567 }
568 
570  DictScope S(W, "ObjectName");
571 
572  W.printHex("Signature", ObjName.Signature);
573  W.printString("ObjectName", ObjName.Name);
574  return Error::success();
575 }
576 
578  DictScope S(W, "ProcStart");
579 
580  if (InFunctionScope)
581  return llvm::make_error<CodeViewError>(
582  "Visiting a ProcSym while inside function scope!");
583 
584  InFunctionScope = true;
585 
586  StringRef LinkageName;
587  W.printEnum("Kind", uint16_t(CVR.kind()), getSymbolTypeNames());
588  W.printHex("PtrParent", Proc.Parent);
589  W.printHex("PtrEnd", Proc.End);
590  W.printHex("PtrNext", Proc.Next);
591  W.printHex("CodeSize", Proc.CodeSize);
592  W.printHex("DbgStart", Proc.DbgStart);
593  W.printHex("DbgEnd", Proc.DbgEnd);
594  printTypeIndex("FunctionType", Proc.FunctionType);
595  if (ObjDelegate) {
596  ObjDelegate->printRelocatedField("CodeOffset", Proc.getRelocationOffset(),
597  Proc.CodeOffset, &LinkageName);
598  }
599  W.printHex("Segment", Proc.Segment);
600  W.printFlags("Flags", static_cast<uint8_t>(Proc.Flags),
602  W.printString("DisplayName", Proc.Name);
603  if (!LinkageName.empty())
604  W.printString("LinkageName", LinkageName);
605  return Error::success();
606 }
607 
609  ScopeEndSym &ScopeEnd) {
610  if (CVR.kind() == SymbolKind::S_END)
611  DictScope S(W, "BlockEnd");
612  else if (CVR.kind() == SymbolKind::S_PROC_ID_END)
613  DictScope S(W, "ProcEnd");
614  else if (CVR.kind() == SymbolKind::S_INLINESITE_END)
615  DictScope S(W, "InlineSiteEnd");
616 
617  InFunctionScope = false;
618  return Error::success();
619 }
620 
622  ListScope S(W, CVR.kind() == S_CALLEES ? "Callees" : "Callers");
623  for (auto FuncID : Caller.Indices)
624  printTypeIndex("FuncID", FuncID);
625  return Error::success();
626 }
627 
629  RegRelativeSym &RegRel) {
630  DictScope S(W, "RegRelativeSym");
631 
632  W.printHex("Offset", RegRel.Offset);
633  printTypeIndex("Type", RegRel.Type);
634  W.printHex("Register", RegRel.Register);
635  W.printString("VarName", RegRel.Name);
636  return Error::success();
637 }
638 
640  ThreadLocalDataSym &Data) {
641  DictScope S(W, "ThreadLocalDataSym");
642 
643  StringRef LinkageName;
644  if (ObjDelegate) {
645  ObjDelegate->printRelocatedField("DataOffset", Data.getRelocationOffset(),
646  Data.DataOffset, &LinkageName);
647  }
648  printTypeIndex("Type", Data.Type);
649  W.printString("DisplayName", Data.Name);
650  if (!LinkageName.empty())
651  W.printString("LinkageName", LinkageName);
652  return Error::success();
653 }
654 
656  DictScope S(W, "UDT");
657  printTypeIndex("Type", UDT.Type);
658  W.printString("UDTName", UDT.Name);
659  return Error::success();
660 }
661 
662 Error CVSymbolDumperImpl::visitUnknownSymbol(CVSymbol &CVR) {
663  DictScope S(W, "UnknownSym");
664  W.printEnum("Kind", uint16_t(CVR.kind()), getSymbolTypeNames());
665  W.printNumber("Length", CVR.length());
666  return Error::success();
667 }
668 
671  SymbolDeserializer Deserializer(ObjDelegate.get());
672  CVSymbolDumperImpl Dumper(TypeDB, ObjDelegate.get(), W, PrintRecordBytes);
673 
674  Pipeline.addCallbackToPipeline(Deserializer);
675  Pipeline.addCallbackToPipeline(Dumper);
676  CVSymbolVisitor Visitor(Pipeline);
677  return Visitor.visitSymbolRecord(Record);
678 }
679 
682  SymbolDeserializer Deserializer(ObjDelegate.get());
683  CVSymbolDumperImpl Dumper(TypeDB, ObjDelegate.get(), W, PrintRecordBytes);
684 
685  Pipeline.addCallbackToPipeline(Deserializer);
686  Pipeline.addCallbackToPipeline(Dumper);
687  CVSymbolVisitor Visitor(Pipeline);
688  return Visitor.visitSymbolStream(Symbols);
689 }
MachineLoop * L
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
Definition: StringRef.h:634
ArrayRef< EnumEntry< uint16_t > > getExportSymFlagNames()
ArrayRef< EnumEntry< uint32_t > > getCompileSym3FlagNames()
uint32_t getRelocationOffset() const
Definition: SymbolRecord.h:53
FrameProcedureOptions Flags
Definition: SymbolRecord.h:757
uint32_t getRelocationOffset() const
Definition: SymbolRecord.h:813
ArrayRef< EnumEntry< uint16_t > > getRegisterNames()
uint32_t getRelocationOffset() const
Definition: SymbolRecord.h:928
Error visitSymbolRecord(CVSymbol &Record)
llvm::iterator_range< BinaryAnnotationIterator > annotations() const
Definition: SymbolRecord.h:347
std::vector< LocalVariableAddrGap > Gaps
Definition: SymbolRecord.h:516
std::vector< LocalVariableAddrGap > Gaps
Definition: SymbolRecord.h:572
ArrayRef< EnumEntry< uint8_t > > getThunkOrdinalNames()
ArrayRef< EnumEntry< uint8_t > > getFrameCookieKindNames()
static Error visitKnownRecord(CVSymbol &Record, SymbolVisitorCallbacks &Callbacks)
Function Alias Analysis false
A 32-bit type reference.
Definition: TypeIndex.h:89
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
uint32_t getRelocationOffset() const
Definition: SymbolRecord.h:600
uint32_t getRelocationOffset() const
Definition: SymbolRecord.h:623
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
Definition: StringRef.h:135
ArrayRef< EnumEntry< COFF::SectionCharacteristics > > getImageSectionCharacteristicNames()
Kind kind() const
Definition: CVRecord.h:33
uint32_t getRelocationOffset() const
Definition: SymbolRecord.h:906
ArrayRef< EnumEntry< unsigned > > getCPUTypeNames()
std::vector< LocalVariableAddrGap > Gaps
Definition: SymbolRecord.h:493
void addCallbackToPipeline(SymbolVisitorCallbacks &Callbacks)
This is an important base class in LLVM.
Definition: Constant.h:42
std::vector< StringRef > Fields
Definition: SymbolRecord.h:657
LocalVariableAddrRange Range
Definition: SymbolRecord.h:449
uint32_t getRelocationOffset() const
Definition: SymbolRecord.h:771
std::vector< TypeIndex > Indices
Definition: SymbolRecord.h:157
LocalVariableAddrRange Range
Definition: SymbolRecord.h:492
std::vector< LocalVariableAddrGap > Gaps
Definition: SymbolRecord.h:450
LocalVariableAddrRange Range
Definition: SymbolRecord.h:471
uint32_t getFlags() const
Definition: SymbolRecord.h:738
Error dump(CVRecord< SymbolKind > &Record)
Dumps one type record.
ArrayRef< EnumEntry< uint32_t > > getFrameProcSymFlagNames()
static ErrorSuccess success()
Create a success value.
ArrayRef< EnumEntry< SymbolKind > > getSymbolTypeNames()
ArrayRef< uint8_t > content() const
Definition: CVRecord.h:36
Promote Memory to Register
Definition: Mem2Reg.cpp:100
ArrayRef< EnumEntry< uint8_t > > getProcSymFlagNames()
uint8_t getLanguage() const
Definition: SymbolRecord.h:711
ArrayRef< EnumEntry< SourceLanguage > > getSourceLanguageNames()
uint8_t getLanguage() const
Definition: SymbolRecord.h:737
ArrayRef< EnumEntry< uint32_t > > getCompileSym2FlagNames()
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
Definition: StringRef.h:716
ArrayRef< EnumEntry< uint16_t > > getTrampolineNames()
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:130
Error visitSymbolStream(const CVSymbolArray &Symbols)
uint32_t length() const
Definition: CVRecord.h:32
std::vector< LocalVariableAddrGap > Gaps
Definition: SymbolRecord.h:538
static void printTypeIndex(ScopedPrinter &Printer, StringRef FieldName, TypeIndex TI, TypeDatabase &DB)
uint32_t getFlags() const
Definition: SymbolRecord.h:712
std::vector< LocalVariableAddrGap > Gaps
Definition: SymbolRecord.h:472
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:463
Lightweight error class with error context and mandatory checking.
ArrayRef< EnumEntry< uint16_t > > getLocalFlagNames()
uint32_t getRelocationOffset() const
Definition: SymbolRecord.h:444
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47