LLVM  10.0.0svn
SymbolRecord.h
Go to the documentation of this file.
1 //===- SymbolRecord.h -------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLRECORD_H
10 #define LLVM_DEBUGINFO_CODEVIEW_SYMBOLRECORD_H
11 
12 #include "llvm/ADT/APSInt.h"
13 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/ADT/Optional.h"
15 #include "llvm/ADT/StringRef.h"
16 #include "llvm/ADT/iterator.h"
23 #include "llvm/Support/Endian.h"
24 #include <cstdint>
25 #include <vector>
26 
27 namespace llvm {
28 namespace codeview {
29 
30 class SymbolRecord {
31 protected:
32  explicit SymbolRecord(SymbolRecordKind Kind) : Kind(Kind) {}
33 
34 public:
35  SymbolRecordKind getKind() const { return Kind; }
36 
38 };
39 
40 // S_GPROC32, S_LPROC32, S_GPROC32_ID, S_LPROC32_ID, S_LPROC32_DPC or
41 // S_LPROC32_DPC_ID
42 class ProcSym : public SymbolRecord {
43  static constexpr uint32_t RelocationOffset = 32;
44 
45 public:
48  : SymbolRecord(Kind), RecordOffset(RecordOffset) {}
49 
51  return RecordOffset + RelocationOffset;
52  }
53 
54  uint32_t Parent = 0;
55  uint32_t End = 0;
56  uint32_t Next = 0;
57  uint32_t CodeSize = 0;
58  uint32_t DbgStart = 0;
59  uint32_t DbgEnd = 0;
62  uint16_t Segment = 0;
65 
66  uint32_t RecordOffset = 0;
67 };
68 
69 // S_THUNK32
70 class Thunk32Sym : public SymbolRecord {
71 public:
74  : SymbolRecord(Kind), RecordOffset(RecordOffset) {}
75 
76  uint32_t Parent = 0;
77  uint32_t End = 0;
78  uint32_t Next = 0;
80  uint16_t Segment = 0;
81  uint16_t Length = 0;
85 
86  uint32_t RecordOffset = 0;
87 };
88 
89 // S_TRAMPOLINE
90 class TrampolineSym : public SymbolRecord {
91 public:
94  : SymbolRecord(Kind), RecordOffset(RecordOffset) {}
95 
97  uint16_t Size = 0;
98  uint32_t ThunkOffset = 0;
99  uint32_t TargetOffset = 0;
100  uint16_t ThunkSection = 0;
101  uint16_t TargetSection = 0;
102 
103  uint32_t RecordOffset = 0;
104 };
105 
106 // S_SECTION
107 class SectionSym : public SymbolRecord {
108 public:
111  : SymbolRecord(Kind), RecordOffset(RecordOffset) {}
112 
113  uint16_t SectionNumber = 0;
114  uint8_t Alignment = 0;
115  uint32_t Rva = 0;
116  uint32_t Length = 0;
119 
120  uint32_t RecordOffset = 0;
121 };
122 
123 // S_COFFGROUP
124 class CoffGroupSym : public SymbolRecord {
125 public:
128  : SymbolRecord(Kind), RecordOffset(RecordOffset) {}
129 
133  uint16_t Segment = 0;
135 
136  uint32_t RecordOffset = 0;
137 };
138 
139 class ScopeEndSym : public SymbolRecord {
140 public:
143  : SymbolRecord(Kind), RecordOffset(RecordOffset) {}
144 
145  uint32_t RecordOffset = 0;
146 };
147 
148 class CallerSym : public SymbolRecord {
149 public:
152  : SymbolRecord(Kind), RecordOffset(RecordOffset) {}
153 
154  std::vector<TypeIndex> Indices;
155 
156  uint32_t RecordOffset = 0;
157 };
158 
163  uint32_t U1 = 0;
164  uint32_t U2 = 0;
165  int32_t S1 = 0;
166 };
167 
169  : public iterator_facade_base<BinaryAnnotationIterator,
170  std::forward_iterator_tag,
171  DecodedAnnotation> {
172  BinaryAnnotationIterator() = default;
175  : Data(Other.Data) {}
176 
178  return Data == Other.Data;
179  }
180 
182  Data = Other.Data;
183  return *this;
184  }
185 
187  if (!ParseCurrentAnnotation()) {
188  *this = BinaryAnnotationIterator();
189  return *this;
190  }
191  Data = Next;
192  Next = ArrayRef<uint8_t>();
193  Current.reset();
194  return *this;
195  }
196 
198  ParseCurrentAnnotation();
199  return Current.getValue();
200  }
201 
202 private:
203  static uint32_t GetCompressedAnnotation(ArrayRef<uint8_t> &Annotations) {
204  if (Annotations.empty())
205  return -1;
206 
207  uint8_t FirstByte = Annotations.front();
208  Annotations = Annotations.drop_front();
209 
210  if ((FirstByte & 0x80) == 0x00)
211  return FirstByte;
212 
213  if (Annotations.empty())
214  return -1;
215 
216  uint8_t SecondByte = Annotations.front();
217  Annotations = Annotations.drop_front();
218 
219  if ((FirstByte & 0xC0) == 0x80)
220  return ((FirstByte & 0x3F) << 8) | SecondByte;
221 
222  if (Annotations.empty())
223  return -1;
224 
225  uint8_t ThirdByte = Annotations.front();
226  Annotations = Annotations.drop_front();
227 
228  if (Annotations.empty())
229  return -1;
230 
231  uint8_t FourthByte = Annotations.front();
232  Annotations = Annotations.drop_front();
233 
234  if ((FirstByte & 0xE0) == 0xC0)
235  return ((FirstByte & 0x1F) << 24) | (SecondByte << 16) |
236  (ThirdByte << 8) | FourthByte;
237 
238  return -1;
239  }
240 
241  static int32_t DecodeSignedOperand(uint32_t Operand) {
242  if (Operand & 1)
243  return -(Operand >> 1);
244  return Operand >> 1;
245  }
246 
247  static int32_t DecodeSignedOperand(ArrayRef<uint8_t> &Annotations) {
248  return DecodeSignedOperand(GetCompressedAnnotation(Annotations));
249  }
250 
251  bool ParseCurrentAnnotation() {
252  if (Current.hasValue())
253  return true;
254 
255  Next = Data;
256  uint32_t Op = GetCompressedAnnotation(Next);
257  DecodedAnnotation Result;
258  Result.OpCode = static_cast<BinaryAnnotationsOpCode>(Op);
259  switch (Result.OpCode) {
261  Result.Name = "Invalid";
262  Next = ArrayRef<uint8_t>();
263  break;
265  Result.Name = "CodeOffset";
266  Result.U1 = GetCompressedAnnotation(Next);
267  break;
269  Result.Name = "ChangeCodeOffsetBase";
270  Result.U1 = GetCompressedAnnotation(Next);
271  break;
273  Result.Name = "ChangeCodeOffset";
274  Result.U1 = GetCompressedAnnotation(Next);
275  break;
277  Result.Name = "ChangeCodeLength";
278  Result.U1 = GetCompressedAnnotation(Next);
279  break;
281  Result.Name = "ChangeFile";
282  Result.U1 = GetCompressedAnnotation(Next);
283  break;
285  Result.Name = "ChangeLineEndDelta";
286  Result.U1 = GetCompressedAnnotation(Next);
287  break;
289  Result.Name = "ChangeRangeKind";
290  Result.U1 = GetCompressedAnnotation(Next);
291  break;
293  Result.Name = "ChangeColumnStart";
294  Result.U1 = GetCompressedAnnotation(Next);
295  break;
297  Result.Name = "ChangeColumnEnd";
298  Result.U1 = GetCompressedAnnotation(Next);
299  break;
301  Result.Name = "ChangeLineOffset";
302  Result.S1 = DecodeSignedOperand(Next);
303  break;
305  Result.Name = "ChangeColumnEndDelta";
306  Result.S1 = DecodeSignedOperand(Next);
307  break;
309  Result.Name = "ChangeCodeOffsetAndLineOffset";
310  uint32_t Annotation = GetCompressedAnnotation(Next);
311  Result.S1 = DecodeSignedOperand(Annotation >> 4);
312  Result.U1 = Annotation & 0xf;
313  break;
314  }
316  Result.Name = "ChangeCodeLengthAndCodeOffset";
317  Result.U1 = GetCompressedAnnotation(Next);
318  Result.U2 = GetCompressedAnnotation(Next);
319  break;
320  }
321  }
322  Result.Bytes = Data.take_front(Data.size() - Next.size());
323  Current = Result;
324  return true;
325  }
326 
329  ArrayRef<uint8_t> Next;
330 };
331 
332 // S_INLINESITE
333 class InlineSiteSym : public SymbolRecord {
334 public:
336  explicit InlineSiteSym(uint32_t RecordOffset)
338  RecordOffset(RecordOffset) {}
339 
341  return make_range(BinaryAnnotationIterator(AnnotationData),
343  }
344 
345  uint32_t Parent = 0;
346  uint32_t End = 0;
348  std::vector<uint8_t> AnnotationData;
349 
350  uint32_t RecordOffset = 0;
351 };
352 
353 // S_PUB32
354 class PublicSym32 : public SymbolRecord {
355 public:
358  explicit PublicSym32(uint32_t RecordOffset)
360  RecordOffset(RecordOffset) {}
361 
364  uint16_t Segment = 0;
366 
367  uint32_t RecordOffset = 0;
368 };
369 
370 // S_REGISTER
371 class RegisterSym : public SymbolRecord {
372 public:
374  explicit RegisterSym(uint32_t RecordOffset)
376  RecordOffset(RecordOffset) {}
377 
381 
382  uint32_t RecordOffset = 0;
383 };
384 
385 // S_PROCREF, S_LPROCREF
386 class ProcRefSym : public SymbolRecord {
387 public:
389  explicit ProcRefSym(uint32_t RecordOffset)
390  : SymbolRecord(SymbolRecordKind::ProcRefSym), RecordOffset(RecordOffset) {
391  }
392 
393  uint32_t SumName = 0;
394  uint32_t SymOffset = 0;
395  uint16_t Module = 0;
397 
398  uint16_t modi() const { return Module - 1; }
399  uint32_t RecordOffset = 0;
400 };
401 
402 // S_LOCAL
403 class LocalSym : public SymbolRecord {
404 public:
406  explicit LocalSym(uint32_t RecordOffset)
407  : SymbolRecord(SymbolRecordKind::LocalSym), RecordOffset(RecordOffset) {}
408 
412 
413  uint32_t RecordOffset = 0;
414 };
415 
418  uint16_t ISectStart;
419  uint16_t Range;
420 };
421 
423  uint16_t GapStartOffset;
424  uint16_t Range;
425 };
426 
427 enum : uint16_t { MaxDefRange = 0xf000 };
428 
429 // S_DEFRANGE
430 class DefRangeSym : public SymbolRecord {
431  static constexpr uint32_t RelocationOffset = 8;
432 
433 public:
435  explicit DefRangeSym(uint32_t RecordOffset)
437  RecordOffset(RecordOffset) {}
438 
440  return RecordOffset + RelocationOffset;
441  }
442 
443  uint32_t Program = 0;
445  std::vector<LocalVariableAddrGap> Gaps;
446 
447  uint32_t RecordOffset = 0;
448 };
449 
450 // S_DEFRANGE_SUBFIELD
452  static constexpr uint32_t RelocationOffset = 12;
453 
454 public:
456  explicit DefRangeSubfieldSym(uint32_t RecordOffset)
458  RecordOffset(RecordOffset) {}
459 
461  return RecordOffset + RelocationOffset;
462  }
463 
464  uint32_t Program = 0;
465  uint16_t OffsetInParent = 0;
467  std::vector<LocalVariableAddrGap> Gaps;
468 
469  uint32_t RecordOffset = 0;
470 };
471 
472 // S_DEFRANGE_REGISTER
474 public:
475  struct Header {
478  };
479 
481  explicit DefRangeRegisterSym(uint32_t RecordOffset)
483  RecordOffset(RecordOffset) {}
484 
485  uint32_t getRelocationOffset() const { return RecordOffset + sizeof(Header); }
486 
489  std::vector<LocalVariableAddrGap> Gaps;
490 
491  uint32_t RecordOffset = 0;
492 };
493 
494 // S_DEFRANGE_SUBFIELD_REGISTER
496 public:
497  struct Header {
501  };
502 
504  : SymbolRecord(Kind) {}
505  explicit DefRangeSubfieldRegisterSym(uint32_t RecordOffset)
507  RecordOffset(RecordOffset) {}
508 
509  uint32_t getRelocationOffset() const { return RecordOffset + sizeof(Header); }
510 
513  std::vector<LocalVariableAddrGap> Gaps;
514 
515  uint32_t RecordOffset = 0;
516 };
517 
518 // S_DEFRANGE_FRAMEPOINTER_REL
520  static constexpr uint32_t RelocationOffset = 8;
521 
522 public:
523  struct Header {
525  };
526 
528  : SymbolRecord(Kind) {}
529  explicit DefRangeFramePointerRelSym(uint32_t RecordOffset)
531  RecordOffset(RecordOffset) {}
532 
534  return RecordOffset + RelocationOffset;
535  }
536 
539  std::vector<LocalVariableAddrGap> Gaps;
540 
541  uint32_t RecordOffset = 0;
542 };
543 
544 // S_DEFRANGE_REGISTER_REL
546 public:
547  struct Header {
551  };
552 
554  explicit DefRangeRegisterRelSym(uint32_t RecordOffset)
556  RecordOffset(RecordOffset) {}
557 
558  // The flags implement this notional bitfield:
559  // uint16_t IsSubfield : 1;
560  // uint16_t Padding : 3;
561  // uint16_t OffsetInParent : 12;
562  enum : uint16_t {
563  IsSubfieldFlag = 1,
564  OffsetInParentShift = 4,
565  };
566 
567  bool hasSpilledUDTMember() const { return Hdr.Flags & IsSubfieldFlag; }
568  uint16_t offsetInParent() const { return Hdr.Flags >> OffsetInParentShift; }
569 
570  uint32_t getRelocationOffset() const { return RecordOffset + sizeof(Header); }
571 
574  std::vector<LocalVariableAddrGap> Gaps;
575 
576  uint32_t RecordOffset = 0;
577 };
578 
579 // S_DEFRANGE_FRAMEPOINTER_REL_FULL_SCOPE
581 public:
583  : SymbolRecord(Kind) {}
586  RecordOffset(RecordOffset) {}
587 
588  int32_t Offset = 0;
589 
590  uint32_t RecordOffset = 0;
591 };
592 
593 // S_BLOCK32
594 class BlockSym : public SymbolRecord {
595  static constexpr uint32_t RelocationOffset = 16;
596 
597 public:
599  explicit BlockSym(uint32_t RecordOffset)
600  : SymbolRecord(SymbolRecordKind::BlockSym), RecordOffset(RecordOffset) {}
601 
603  return RecordOffset + RelocationOffset;
604  }
605 
606  uint32_t Parent = 0;
607  uint32_t End = 0;
608  uint32_t CodeSize = 0;
610  uint16_t Segment = 0;
612 
613  uint32_t RecordOffset = 0;
614 };
615 
616 // S_LABEL32
617 class LabelSym : public SymbolRecord {
618  static constexpr uint32_t RelocationOffset = 4;
619 
620 public:
622  explicit LabelSym(uint32_t RecordOffset)
623  : SymbolRecord(SymbolRecordKind::LabelSym), RecordOffset(RecordOffset) {}
624 
626  return RecordOffset + RelocationOffset;
627  }
628 
630  uint16_t Segment = 0;
633 
634  uint32_t RecordOffset = 0;
635 };
636 
637 // S_OBJNAME
638 class ObjNameSym : public SymbolRecord {
639 public:
642  explicit ObjNameSym(uint32_t RecordOffset)
643  : SymbolRecord(SymbolRecordKind::ObjNameSym), RecordOffset(RecordOffset) {
644  }
645 
646  uint32_t Signature = 0;
648 
649  uint32_t RecordOffset = 0;
650 };
651 
652 // S_ENVBLOCK
653 class EnvBlockSym : public SymbolRecord {
654 public:
656  explicit EnvBlockSym(uint32_t RecordOffset)
658  RecordOffset(RecordOffset) {}
659 
660  std::vector<StringRef> Fields;
661 
662  uint32_t RecordOffset = 0;
663 };
664 
665 // S_EXPORT
666 class ExportSym : public SymbolRecord {
667 public:
669  explicit ExportSym(uint32_t RecordOffset)
670  : SymbolRecord(SymbolRecordKind::ExportSym), RecordOffset(RecordOffset) {}
671 
672  uint16_t Ordinal = 0;
675 
676  uint32_t RecordOffset = 0;
677 };
678 
679 // S_FILESTATIC
680 class FileStaticSym : public SymbolRecord {
681 public:
683  explicit FileStaticSym(uint32_t RecordOffset)
685  RecordOffset(RecordOffset) {}
686 
688  uint32_t ModFilenameOffset = 0;
691 
692  uint32_t RecordOffset = 0;
693 };
694 
695 // S_COMPILE2
696 class Compile2Sym : public SymbolRecord {
697 public:
699  explicit Compile2Sym(uint32_t RecordOffset)
701  RecordOffset(RecordOffset) {}
702 
705  uint16_t VersionFrontendMajor = 0;
706  uint16_t VersionFrontendMinor = 0;
707  uint16_t VersionFrontendBuild = 0;
708  uint16_t VersionBackendMajor = 0;
709  uint16_t VersionBackendMinor = 0;
710  uint16_t VersionBackendBuild = 0;
712  std::vector<StringRef> ExtraStrings;
713 
714  uint8_t getLanguage() const { return static_cast<uint32_t>(Flags) & 0xFF; }
715  uint32_t getFlags() const { return static_cast<uint32_t>(Flags) & ~0xFF; }
716 
717  uint32_t RecordOffset = 0;
718 };
719 
720 // S_COMPILE3
721 class Compile3Sym : public SymbolRecord {
722 public:
725  explicit Compile3Sym(uint32_t RecordOffset)
727  RecordOffset(RecordOffset) {}
728 
731  uint16_t VersionFrontendMajor = 0;
732  uint16_t VersionFrontendMinor = 0;
733  uint16_t VersionFrontendBuild = 0;
734  uint16_t VersionFrontendQFE = 0;
735  uint16_t VersionBackendMajor = 0;
736  uint16_t VersionBackendMinor = 0;
737  uint16_t VersionBackendBuild = 0;
738  uint16_t VersionBackendQFE = 0;
740 
742  Flags = CompileSym3Flags((uint32_t(Flags) & 0xFFFFFF00) | uint32_t(Lang));
743  }
744 
746  return static_cast<SourceLanguage>(static_cast<uint32_t>(Flags) & 0xFF);
747  }
749  return static_cast<CompileSym3Flags>(static_cast<uint32_t>(Flags) & ~0xFF);
750  }
751 
752  bool hasOptimizations() const {
753  return CompileSym3Flags::None !=
755  }
756 
757  uint32_t RecordOffset = 0;
758 };
759 
760 // S_FRAMEPROC
761 class FrameProcSym : public SymbolRecord {
762 public:
764  explicit FrameProcSym(uint32_t RecordOffset)
766  RecordOffset(RecordOffset) {}
767 
768  uint32_t TotalFrameBytes = 0;
769  uint32_t PaddingFrameBytes = 0;
770  uint32_t OffsetToPadding = 0;
771  uint32_t BytesOfCalleeSavedRegisters = 0;
772  uint32_t OffsetOfExceptionHandler = 0;
773  uint16_t SectionIdOfExceptionHandler = 0;
775 
776  /// Extract the register this frame uses to refer to local variables.
778  return decodeFramePtrReg(
779  EncodedFramePtrReg((uint32_t(Flags) >> 14U) & 0x3U), CPU);
780  }
781 
782  /// Extract the register this frame uses to refer to parameters.
784  return decodeFramePtrReg(
785  EncodedFramePtrReg((uint32_t(Flags) >> 16U) & 0x3U), CPU);
786  }
787 
788  uint32_t RecordOffset = 0;
789 
790 private:
791 };
792 
793 // S_CALLSITEINFO
795  static constexpr uint32_t RelocationOffset = 4;
796 
797 public:
799  explicit CallSiteInfoSym(uint32_t RecordOffset)
801 
803  return RecordOffset + RelocationOffset;
804  }
805 
807  uint16_t Segment = 0;
809 
810  uint32_t RecordOffset = 0;
811 };
812 
813 // S_HEAPALLOCSITE
815  static constexpr uint32_t RelocationOffset = 4;
816 
817 public:
819  explicit HeapAllocationSiteSym(uint32_t RecordOffset)
821  RecordOffset(RecordOffset) {}
822 
824  return RecordOffset + RelocationOffset;
825  }
826 
828  uint16_t Segment = 0;
829  uint16_t CallInstructionSize = 0;
831 
832  uint32_t RecordOffset = 0;
833 };
834 
835 // S_FRAMECOOKIE
836 class FrameCookieSym : public SymbolRecord {
837  static constexpr uint32_t RelocationOffset = 4;
838 
839 public:
841  explicit FrameCookieSym(uint32_t RecordOffset)
843 
845  return RecordOffset + RelocationOffset;
846  }
847 
849  uint16_t Register = 0;
851  uint8_t Flags = 0;
852 
853  uint32_t RecordOffset = 0;
854 };
855 
856 // S_UDT, S_COBOLUDT
857 class UDTSym : public SymbolRecord {
858 public:
860  explicit UDTSym(uint32_t RecordOffset)
862 
865 
866  uint32_t RecordOffset = 0;
867 };
868 
869 // S_BUILDINFO
870 class BuildInfoSym : public SymbolRecord {
871 public:
873  explicit BuildInfoSym(uint32_t RecordOffset)
875  RecordOffset(RecordOffset) {}
876 
878 
879  uint32_t RecordOffset = 0;
880 };
881 
882 // S_BPREL32
883 class BPRelativeSym : public SymbolRecord {
884 public:
886  explicit BPRelativeSym(uint32_t RecordOffset)
888  RecordOffset(RecordOffset) {}
889 
890  int32_t Offset = 0;
893 
894  uint32_t RecordOffset = 0;
895 };
896 
897 // S_REGREL32
898 class RegRelativeSym : public SymbolRecord {
899 public:
901  explicit RegRelativeSym(uint32_t RecordOffset)
903  RecordOffset(RecordOffset) {}
904 
909 
910  uint32_t RecordOffset = 0;
911 };
912 
913 // S_CONSTANT, S_MANCONSTANT
914 class ConstantSym : public SymbolRecord {
915 public:
917  explicit ConstantSym(uint32_t RecordOffset)
919  RecordOffset(RecordOffset) {}
920 
924 
925  uint32_t RecordOffset = 0;
926 };
927 
928 // S_LDATA32, S_GDATA32, S_LMANDATA, S_GMANDATA
929 class DataSym : public SymbolRecord {
930  static constexpr uint32_t RelocationOffset = 8;
931 
932 public:
934  explicit DataSym(uint32_t RecordOffset)
935  : SymbolRecord(SymbolRecordKind::DataSym), RecordOffset(RecordOffset) {}
936 
938  return RecordOffset + RelocationOffset;
939  }
940 
942  uint32_t DataOffset = 0;
943  uint16_t Segment = 0;
945 
946  uint32_t RecordOffset = 0;
947 };
948 
949 // S_LTHREAD32, S_GTHREAD32
951  static constexpr uint32_t RelocationOffset = 8;
952 
953 public:
955  explicit ThreadLocalDataSym(uint32_t RecordOffset)
957  RecordOffset(RecordOffset) {}
958 
960  return RecordOffset + RelocationOffset;
961  }
962 
964  uint32_t DataOffset = 0;
965  uint16_t Segment = 0;
967 
968  uint32_t RecordOffset = 0;
969 };
970 
971 // S_UNAMESPACE
973 public:
975  explicit UsingNamespaceSym(uint32_t RecordOffset)
977  RecordOffset(RecordOffset) {}
978 
980 
981  uint32_t RecordOffset = 0;
982 };
983 
984 // S_ANNOTATION
985 class AnnotationSym : public SymbolRecord {
986 public:
988  explicit AnnotationSym(uint32_t RecordOffset)
990  RecordOffset(RecordOffset) {}
991 
993  uint16_t Segment = 0;
994  std::vector<StringRef> Strings;
995 
996  uint32_t RecordOffset = 0;
997 };
998 
1001 
1003  uint32_t Offset);
1004 
1005 } // end namespace codeview
1006 } // end namespace llvm
1007 
1008 #endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLRECORD_H
const T & front() const
front - Get the first element.
Definition: ArrayRef.h:151
DefRangeFramePointerRelSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:527
uint32_t getRelocationOffset() const
Definition: SymbolRecord.h:802
SymbolRecordKind
Distinguishes individual records in the Symbols subsection of a .debug$S section. ...
Definition: CodeView.h:40
This class represents lattice values for constants.
Definition: AllocatorList.h:23
uint32_t getRelocationOffset() const
Definition: SymbolRecord.h:844
ObjNameSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:642
Thunk32Sym(SymbolRecordKind Kind, uint32_t RecordOffset)
Definition: SymbolRecord.h:73
CompileSym3Flags
Corresponds to COMPILESYM3::Flags bitfield.
Definition: CodeView.h:458
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:65
DefRangeSubfieldRegisterSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:503
UDTSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:859
BPRelativeSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:885
CompileSym3Flags getFlags() const
Definition: SymbolRecord.h:748
LocalSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:405
PublicSym32(SymbolRecordKind Kind)
Definition: SymbolRecord.h:357
FrameProcedureOptions Flags
Definition: SymbolRecord.h:774
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
static DecodeStatus DecodeSignedOperand(MCInst &Inst, unsigned InsnS, uint64_t Address=0, const void *Decoder=nullptr)
UsingNamespaceSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:974
ProcRefSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:389
ScopeEndSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:141
detail::packed_endian_specific_integral< uint16_t, little, unaligned > ulittle16_t
Definition: Endian.h:272
BlockSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:599
BinaryAnnotationsOpCode OpCode
Definition: SymbolRecord.h:162
ConstantSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:917
RegRelativeSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:900
ConstantSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:916
std::vector< LocalVariableAddrGap > Gaps
Definition: SymbolRecord.h:513
EnvBlockSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:655
ArrayRef< uint8_t > VariantData
Definition: SymbolRecord.h:84
void setLanguage(SourceLanguage Lang)
Definition: SymbolRecord.h:741
UDTSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:860
CallerSym(SymbolRecordKind Kind, uint32_t RecordOffset)
Definition: SymbolRecord.h:151
std::vector< LocalVariableAddrGap > Gaps
Definition: SymbolRecord.h:574
std::vector< uint8_t > AnnotationData
Definition: SymbolRecord.h:348
DefRangeRegisterSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:481
RegisterId getParamFramePtrReg(CPUType CPU) const
Extract the register this frame uses to refer to parameters.
Definition: SymbolRecord.h:783
ProcRefSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:388
Tagged union holding either a T or a Error.
Definition: yaml2obj.h:21
ThreadLocalDataSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:955
DefRangeRegisterRelSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:554
AnnotationSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:988
LabelSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:621
uint8_t getLanguage() const
Definition: SymbolRecord.h:714
EnvBlockSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:656
std::vector< StringRef > ExtraStrings
Definition: SymbolRecord.h:712
BinaryAnnotationIterator(const BinaryAnnotationIterator &Other)
Definition: SymbolRecord.h:174
PublicSymFlags
Corresponds to the CV_PUBSYMFLAGS bitfield.
Definition: CodeView.h:418
A 32-bit type reference.
Definition: TypeIndex.h:95
CallSiteInfoSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:798
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition: iterator.h:67
RegisterSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:373
InlineSiteSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:336
uint32_t getRelocationOffset() const
Definition: SymbolRecord.h:439
BinaryAnnotationIterator(ArrayRef< uint8_t > Annotations)
Definition: SymbolRecord.h:173
BlockSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:598
EncodedFramePtrReg
Two-bit value indicating which register is the designated frame pointer register. ...
Definition: CodeView.h:536
FrameCookieSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:840
DataSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:934
std::vector< LocalVariableAddrGap > Gaps
Definition: SymbolRecord.h:489
ExportSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:669
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
Definition: Endian.h:274
FrameProcSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:763
RegRelativeSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:901
HeapAllocationSiteSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:819
std::vector< StringRef > Fields
Definition: SymbolRecord.h:660
AnnotationSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:987
LocalVariableAddrRange Range
Definition: SymbolRecord.h:444
BPRelativeSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:886
DefRangeSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:435
DefRangeRegisterSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:480
DataSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:933
uint32_t getFlags() const
Definition: SymbolRecord.h:715
SectionSym(SymbolRecordKind Kind, uint32_t RecordOffset)
Definition: SymbolRecord.h:110
std::vector< TypeIndex > Indices
Definition: SymbolRecord.h:154
LocalVariableAddrRange Range
Definition: SymbolRecord.h:488
ProcSym(SymbolRecordKind Kind, uint32_t RecordOffset)
Definition: SymbolRecord.h:47
DefRangeSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:434
std::vector< LocalVariableAddrGap > Gaps
Definition: SymbolRecord.h:445
BinaryAnnotationIterator & operator=(const BinaryAnnotationIterator Other)
Definition: SymbolRecord.h:181
PublicSym32(uint32_t RecordOffset)
Definition: SymbolRecord.h:358
BinaryAnnotationIterator & operator++()
Definition: SymbolRecord.h:186
LocalVariableAddrRange Range
Definition: SymbolRecord.h:466
const DecodedAnnotation & operator*()
Definition: SymbolRecord.h:197
ThreadLocalDataSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:954
Expected< CVSymbol > readSymbolFromStream(BinaryStreamRef Stream, uint32_t Offset)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
SourceLanguage
These values correspond to the CV_CFL_LANG enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx.
Definition: CodeView.h:143
uint32_t getRelocationOffset() const
Definition: SymbolRecord.h:937
SymbolRecordKind getKind() const
Definition: SymbolRecord.h:35
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn...
Definition: CodeView.h:78
static uint32_t getFlags(const Symbol *Sym)
Definition: TapiFile.cpp:28
std::vector< StringRef > Strings
Definition: SymbolRecord.h:994
TrampolineSym(SymbolRecordKind Kind, uint32_t RecordOffset)
Definition: SymbolRecord.h:93
Compile3Sym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:724
FrameProcSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:764
A range adaptor for a pair of iterators.
Thunk32Sym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:72
FrameCookieSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:841
ScopeEndSym(SymbolRecordKind Kind, uint32_t RecordOffset)
Definition: SymbolRecord.h:142
CoffGroupSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:126
bool operator==(BinaryAnnotationIterator Other) const
Definition: SymbolRecord.h:177
std::vector< LocalVariableAddrGap > Gaps
Definition: SymbolRecord.h:539
DefRangeFramePointerRelSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:529
UsingNamespaceSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:975
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
Definition: ArrayRef.h:187
SourceLanguage getLanguage() const
Definition: SymbolRecord.h:745
LabelSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:622
detail::packed_endian_specific_integral< int32_t, little, unaligned > little32_t
Definition: Endian.h:281
HeapAllocationSiteSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:818
COFFYAML::WeakExternalCharacteristics Characteristics
Definition: COFFYAML.cpp:325
InlineSiteSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:335
SectionSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:109
uint32_t getRelocationOffset() const
Definition: SymbolRecord.h:50
CallerSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:150
uint32_t Size
Definition: Profile.cpp:46
LocalSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:406
RegisterId getLocalFramePtrReg(CPUType CPU) const
Extract the register this frame uses to refer to local variables.
Definition: SymbolRecord.h:777
uint32_t getRelocationOffset() const
Definition: SymbolRecord.h:625
FileStaticSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:682
ThunkOrdinal
These values correspond to the THUNK_ORDINAL enumeration.
Definition: CodeView.h:548
RegisterSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:374
iterator_range< BinaryAnnotationIterator > annotations() const
Definition: SymbolRecord.h:340
CoffGroupSym(SymbolRecordKind Kind, uint32_t RecordOffset)
Definition: SymbolRecord.h:127
TrampolineSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:92
std::vector< LocalVariableAddrGap > Gaps
Definition: SymbolRecord.h:467
Compile3Sym(uint32_t RecordOffset)
Definition: SymbolRecord.h:725
BuildInfoSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:872
DefRangeRegisterRelSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:553
BuildInfoSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:873
CallSiteInfoSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:799
ObjNameSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:641
uint32_t getRelocationOffset() const
Definition: SymbolRecord.h:602
ProcSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:46
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
ProcSymFlags
Corresponds to the CV_PROCFLAGS bitfield.
Definition: CodeView.h:428
LocalSymFlags
Corresponds to CV_LVARFLAGS bitfield.
Definition: CodeView.h:401
CVRecord is a fat pointer (base + size pair) to a symbol or type record.
Definition: CVRecord.h:30
Annotations lets you mark points and ranges inside source code, for tests:
Definition: Annotations.h:46
Compile2Sym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:698
DefRangeSubfieldRegisterSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:505
FileStaticSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:683
DefRangeSubfieldSym(uint32_t RecordOffset)
Definition: SymbolRecord.h:456
RegisterId decodeFramePtrReg(EncodedFramePtrReg EncodedReg, CPUType CPU)
CompileSym2Flags
Corresponds to COMPILESYM2::Flags bitfield.
Definition: CodeView.h:442
ExportSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:668
DefRangeSubfieldSym(SymbolRecordKind Kind)
Definition: SymbolRecord.h:455
SymbolRecord(SymbolRecordKind Kind)
Definition: SymbolRecord.h:32
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
bool empty() const
empty - Check if the array is empty.
Definition: ArrayRef.h:143
Compile2Sym(uint32_t RecordOffset)
Definition: SymbolRecord.h:699