CodeView.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- CodeView.h -----------------------------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // Defines constants and basic types describing CodeView debug information.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_DEBUGINFO_CODEVIEW_CODEVIEW_H
  18. #define LLVM_DEBUGINFO_CODEVIEW_CODEVIEW_H
  19. #include <cinttypes>
  20. #include <type_traits>
  21. #include "llvm/Support/Endian.h"
  22. namespace llvm {
  23. namespace codeview {
  24. /// Distinguishes individual records in .debug$T or .debug$P section or PDB type
  25. /// stream. The documentation and headers talk about this as the "leaf" type.
  26. enum class TypeRecordKind : uint16_t {
  27. #define TYPE_RECORD(lf_ename, value, name) name = value,
  28. #include "CodeViewTypes.def"
  29. };
  30. /// Duplicate copy of the above enum, but using the official CV names. Useful
  31. /// for reference purposes and when dealing with unknown record types.
  32. enum TypeLeafKind : uint16_t {
  33. #define CV_TYPE(name, val) name = val,
  34. #include "CodeViewTypes.def"
  35. };
  36. /// Distinguishes individual records in the Symbols subsection of a .debug$S
  37. /// section. Equivalent to SYM_ENUM_e in cvinfo.h.
  38. enum class SymbolRecordKind : uint16_t {
  39. #define SYMBOL_RECORD(lf_ename, value, name) name = value,
  40. #include "CodeViewSymbols.def"
  41. };
  42. /// Duplicate copy of the above enum, but using the official CV names. Useful
  43. /// for reference purposes and when dealing with unknown record types.
  44. enum SymbolKind : uint16_t {
  45. #define CV_SYMBOL(name, val) name = val,
  46. #include "CodeViewSymbols.def"
  47. };
  48. #define CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(Class) \
  49. inline Class operator|(Class a, Class b) { \
  50. return static_cast<Class>(static_cast<std::underlying_type_t<Class>>(a) | \
  51. static_cast<std::underlying_type_t<Class>>(b)); \
  52. } \
  53. inline Class operator&(Class a, Class b) { \
  54. return static_cast<Class>(static_cast<std::underlying_type_t<Class>>(a) & \
  55. static_cast<std::underlying_type_t<Class>>(b)); \
  56. } \
  57. inline Class operator~(Class a) { \
  58. return static_cast<Class>(~static_cast<std::underlying_type_t<Class>>(a)); \
  59. } \
  60. inline Class &operator|=(Class &a, Class b) { \
  61. a = a | b; \
  62. return a; \
  63. } \
  64. inline Class &operator&=(Class &a, Class b) { \
  65. a = a & b; \
  66. return a; \
  67. }
  68. /// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
  69. /// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
  70. enum class CPUType : uint16_t {
  71. Intel8080 = 0x0,
  72. Intel8086 = 0x1,
  73. Intel80286 = 0x2,
  74. Intel80386 = 0x3,
  75. Intel80486 = 0x4,
  76. Pentium = 0x5,
  77. PentiumPro = 0x6,
  78. Pentium3 = 0x7,
  79. MIPS = 0x10,
  80. MIPS16 = 0x11,
  81. MIPS32 = 0x12,
  82. MIPS64 = 0x13,
  83. MIPSI = 0x14,
  84. MIPSII = 0x15,
  85. MIPSIII = 0x16,
  86. MIPSIV = 0x17,
  87. MIPSV = 0x18,
  88. M68000 = 0x20,
  89. M68010 = 0x21,
  90. M68020 = 0x22,
  91. M68030 = 0x23,
  92. M68040 = 0x24,
  93. Alpha = 0x30,
  94. Alpha21164 = 0x31,
  95. Alpha21164A = 0x32,
  96. Alpha21264 = 0x33,
  97. Alpha21364 = 0x34,
  98. PPC601 = 0x40,
  99. PPC603 = 0x41,
  100. PPC604 = 0x42,
  101. PPC620 = 0x43,
  102. PPCFP = 0x44,
  103. PPCBE = 0x45,
  104. SH3 = 0x50,
  105. SH3E = 0x51,
  106. SH3DSP = 0x52,
  107. SH4 = 0x53,
  108. SHMedia = 0x54,
  109. ARM3 = 0x60,
  110. ARM4 = 0x61,
  111. ARM4T = 0x62,
  112. ARM5 = 0x63,
  113. ARM5T = 0x64,
  114. ARM6 = 0x65,
  115. ARM_XMAC = 0x66,
  116. ARM_WMMX = 0x67,
  117. ARM7 = 0x68,
  118. Omni = 0x70,
  119. Ia64 = 0x80,
  120. Ia64_2 = 0x81,
  121. CEE = 0x90,
  122. AM33 = 0xa0,
  123. M32R = 0xb0,
  124. TriCore = 0xc0,
  125. X64 = 0xd0,
  126. EBC = 0xe0,
  127. Thumb = 0xf0,
  128. ARMNT = 0xf4,
  129. ARM64 = 0xf6,
  130. HybridX86ARM64 = 0xf7,
  131. ARM64EC = 0xf8,
  132. ARM64X = 0xf9,
  133. D3D11_Shader = 0x100,
  134. };
  135. /// These values correspond to the CV_CFL_LANG enumeration, and are documented
  136. /// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
  137. enum SourceLanguage : uint8_t {
  138. C = 0x00,
  139. Cpp = 0x01,
  140. Fortran = 0x02,
  141. Masm = 0x03,
  142. Pascal = 0x04,
  143. Basic = 0x05,
  144. Cobol = 0x06,
  145. Link = 0x07,
  146. Cvtres = 0x08,
  147. Cvtpgd = 0x09,
  148. CSharp = 0x0a,
  149. VB = 0x0b,
  150. ILAsm = 0x0c,
  151. Java = 0x0d,
  152. JScript = 0x0e,
  153. MSIL = 0x0f,
  154. HLSL = 0x10,
  155. Rust = 0x15,
  156. /// The DMD & Swift compilers emit 'D' and 'S', respectively, for the CV
  157. /// source language. Microsoft does not have enumerators for them yet.
  158. D = 'D',
  159. Swift = 'S',
  160. };
  161. /// These values correspond to the CV_call_e enumeration, and are documented
  162. /// at the following locations:
  163. /// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
  164. /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
  165. ///
  166. enum class CallingConvention : uint8_t {
  167. NearC = 0x00, // near right to left push, caller pops stack
  168. FarC = 0x01, // far right to left push, caller pops stack
  169. NearPascal = 0x02, // near left to right push, callee pops stack
  170. FarPascal = 0x03, // far left to right push, callee pops stack
  171. NearFast = 0x04, // near left to right push with regs, callee pops stack
  172. FarFast = 0x05, // far left to right push with regs, callee pops stack
  173. NearStdCall = 0x07, // near standard call
  174. FarStdCall = 0x08, // far standard call
  175. NearSysCall = 0x09, // near sys call
  176. FarSysCall = 0x0a, // far sys call
  177. ThisCall = 0x0b, // this call (this passed in register)
  178. MipsCall = 0x0c, // Mips call
  179. Generic = 0x0d, // Generic call sequence
  180. AlphaCall = 0x0e, // Alpha call
  181. PpcCall = 0x0f, // PPC call
  182. SHCall = 0x10, // Hitachi SuperH call
  183. ArmCall = 0x11, // ARM call
  184. AM33Call = 0x12, // AM33 call
  185. TriCall = 0x13, // TriCore Call
  186. SH5Call = 0x14, // Hitachi SuperH-5 call
  187. M32RCall = 0x15, // M32R Call
  188. ClrCall = 0x16, // clr call
  189. Inline =
  190. 0x17, // Marker for routines always inlined and thus lacking a convention
  191. NearVector = 0x18 // near left to right push with regs, callee pops stack
  192. };
  193. enum class ClassOptions : uint16_t {
  194. None = 0x0000,
  195. Packed = 0x0001,
  196. HasConstructorOrDestructor = 0x0002,
  197. HasOverloadedOperator = 0x0004,
  198. Nested = 0x0008,
  199. ContainsNestedClass = 0x0010,
  200. HasOverloadedAssignmentOperator = 0x0020,
  201. HasConversionOperator = 0x0040,
  202. ForwardReference = 0x0080,
  203. Scoped = 0x0100,
  204. HasUniqueName = 0x0200,
  205. Sealed = 0x0400,
  206. Intrinsic = 0x2000
  207. };
  208. CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(ClassOptions)
  209. enum class FrameProcedureOptions : uint32_t {
  210. None = 0x00000000,
  211. HasAlloca = 0x00000001,
  212. HasSetJmp = 0x00000002,
  213. HasLongJmp = 0x00000004,
  214. HasInlineAssembly = 0x00000008,
  215. HasExceptionHandling = 0x00000010,
  216. MarkedInline = 0x00000020,
  217. HasStructuredExceptionHandling = 0x00000040,
  218. Naked = 0x00000080,
  219. SecurityChecks = 0x00000100,
  220. AsynchronousExceptionHandling = 0x00000200,
  221. NoStackOrderingForSecurityChecks = 0x00000400,
  222. Inlined = 0x00000800,
  223. StrictSecurityChecks = 0x00001000,
  224. SafeBuffers = 0x00002000,
  225. EncodedLocalBasePointerMask = 0x0000C000,
  226. EncodedParamBasePointerMask = 0x00030000,
  227. ProfileGuidedOptimization = 0x00040000,
  228. ValidProfileCounts = 0x00080000,
  229. OptimizedForSpeed = 0x00100000,
  230. GuardCfg = 0x00200000,
  231. GuardCfw = 0x00400000
  232. };
  233. CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(FrameProcedureOptions)
  234. enum class FunctionOptions : uint8_t {
  235. None = 0x00,
  236. CxxReturnUdt = 0x01,
  237. Constructor = 0x02,
  238. ConstructorWithVirtualBases = 0x04
  239. };
  240. CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(FunctionOptions)
  241. enum class HfaKind : uint8_t {
  242. None = 0x00,
  243. Float = 0x01,
  244. Double = 0x02,
  245. Other = 0x03
  246. };
  247. /// Source-level access specifier. (CV_access_e)
  248. enum class MemberAccess : uint8_t {
  249. None = 0,
  250. Private = 1,
  251. Protected = 2,
  252. Public = 3
  253. };
  254. /// Part of member attribute flags. (CV_methodprop_e)
  255. enum class MethodKind : uint8_t {
  256. Vanilla = 0x00,
  257. Virtual = 0x01,
  258. Static = 0x02,
  259. Friend = 0x03,
  260. IntroducingVirtual = 0x04,
  261. PureVirtual = 0x05,
  262. PureIntroducingVirtual = 0x06
  263. };
  264. /// Equivalent to CV_fldattr_t bitfield.
  265. enum class MethodOptions : uint16_t {
  266. None = 0x0000,
  267. AccessMask = 0x0003,
  268. MethodKindMask = 0x001c,
  269. Pseudo = 0x0020,
  270. NoInherit = 0x0040,
  271. NoConstruct = 0x0080,
  272. CompilerGenerated = 0x0100,
  273. Sealed = 0x0200
  274. };
  275. CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(MethodOptions)
  276. /// Equivalent to CV_LABEL_TYPE_e.
  277. enum class LabelType : uint16_t {
  278. Near = 0x0,
  279. Far = 0x4,
  280. };
  281. /// Equivalent to CV_modifier_t.
  282. /// TODO: Add flag for _Atomic modifier
  283. enum class ModifierOptions : uint16_t {
  284. None = 0x0000,
  285. Const = 0x0001,
  286. Volatile = 0x0002,
  287. Unaligned = 0x0004
  288. };
  289. CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(ModifierOptions)
  290. // If the subsection kind has this bit set, then the linker should ignore it.
  291. enum : uint32_t { SubsectionIgnoreFlag = 0x80000000 };
  292. enum class DebugSubsectionKind : uint32_t {
  293. None = 0,
  294. Symbols = 0xf1,
  295. Lines = 0xf2,
  296. StringTable = 0xf3,
  297. FileChecksums = 0xf4,
  298. FrameData = 0xf5,
  299. InlineeLines = 0xf6,
  300. CrossScopeImports = 0xf7,
  301. CrossScopeExports = 0xf8,
  302. // These appear to relate to .Net assembly info.
  303. ILLines = 0xf9,
  304. FuncMDTokenMap = 0xfa,
  305. TypeMDTokenMap = 0xfb,
  306. MergedAssemblyInput = 0xfc,
  307. CoffSymbolRVA = 0xfd,
  308. XfgHashType = 0xff,
  309. XfgHashVirtual = 0x100,
  310. };
  311. /// Equivalent to CV_ptrtype_e.
  312. enum class PointerKind : uint8_t {
  313. Near16 = 0x00, // 16 bit pointer
  314. Far16 = 0x01, // 16:16 far pointer
  315. Huge16 = 0x02, // 16:16 huge pointer
  316. BasedOnSegment = 0x03, // based on segment
  317. BasedOnValue = 0x04, // based on value of base
  318. BasedOnSegmentValue = 0x05, // based on segment value of base
  319. BasedOnAddress = 0x06, // based on address of base
  320. BasedOnSegmentAddress = 0x07, // based on segment address of base
  321. BasedOnType = 0x08, // based on type
  322. BasedOnSelf = 0x09, // based on self
  323. Near32 = 0x0a, // 32 bit pointer
  324. Far32 = 0x0b, // 16:32 pointer
  325. Near64 = 0x0c // 64 bit pointer
  326. };
  327. /// Equivalent to CV_ptrmode_e.
  328. enum class PointerMode : uint8_t {
  329. Pointer = 0x00, // "normal" pointer
  330. LValueReference = 0x01, // "old" reference
  331. PointerToDataMember = 0x02, // pointer to data member
  332. PointerToMemberFunction = 0x03, // pointer to member function
  333. RValueReference = 0x04 // r-value reference
  334. };
  335. /// Equivalent to misc lfPointerAttr bitfields.
  336. enum class PointerOptions : uint32_t {
  337. None = 0x00000000,
  338. Flat32 = 0x00000100,
  339. Volatile = 0x00000200,
  340. Const = 0x00000400,
  341. Unaligned = 0x00000800,
  342. Restrict = 0x00001000,
  343. WinRTSmartPointer = 0x00080000,
  344. LValueRefThisPointer = 0x00100000,
  345. RValueRefThisPointer = 0x00200000
  346. };
  347. CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(PointerOptions)
  348. /// Equivalent to CV_pmtype_e.
  349. enum class PointerToMemberRepresentation : uint16_t {
  350. Unknown = 0x00, // not specified (pre VC8)
  351. SingleInheritanceData = 0x01, // member data, single inheritance
  352. MultipleInheritanceData = 0x02, // member data, multiple inheritance
  353. VirtualInheritanceData = 0x03, // member data, virtual inheritance
  354. GeneralData = 0x04, // member data, most general
  355. SingleInheritanceFunction = 0x05, // member function, single inheritance
  356. MultipleInheritanceFunction = 0x06, // member function, multiple inheritance
  357. VirtualInheritanceFunction = 0x07, // member function, virtual inheritance
  358. GeneralFunction = 0x08 // member function, most general
  359. };
  360. enum class VFTableSlotKind : uint8_t {
  361. Near16 = 0x00,
  362. Far16 = 0x01,
  363. This = 0x02,
  364. Outer = 0x03,
  365. Meta = 0x04,
  366. Near = 0x05,
  367. Far = 0x06
  368. };
  369. enum class WindowsRTClassKind : uint8_t {
  370. None = 0x00,
  371. RefClass = 0x01,
  372. ValueClass = 0x02,
  373. Interface = 0x03
  374. };
  375. /// Corresponds to CV_LVARFLAGS bitfield.
  376. enum class LocalSymFlags : uint16_t {
  377. None = 0,
  378. IsParameter = 1 << 0,
  379. IsAddressTaken = 1 << 1,
  380. IsCompilerGenerated = 1 << 2,
  381. IsAggregate = 1 << 3,
  382. IsAggregated = 1 << 4,
  383. IsAliased = 1 << 5,
  384. IsAlias = 1 << 6,
  385. IsReturnValue = 1 << 7,
  386. IsOptimizedOut = 1 << 8,
  387. IsEnregisteredGlobal = 1 << 9,
  388. IsEnregisteredStatic = 1 << 10,
  389. };
  390. CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(LocalSymFlags)
  391. /// Corresponds to the CV_PUBSYMFLAGS bitfield.
  392. enum class PublicSymFlags : uint32_t {
  393. None = 0,
  394. Code = 1 << 0,
  395. Function = 1 << 1,
  396. Managed = 1 << 2,
  397. MSIL = 1 << 3,
  398. };
  399. CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(PublicSymFlags)
  400. /// Corresponds to the CV_PROCFLAGS bitfield.
  401. enum class ProcSymFlags : uint8_t {
  402. None = 0,
  403. HasFP = 1 << 0,
  404. HasIRET = 1 << 1,
  405. HasFRET = 1 << 2,
  406. IsNoReturn = 1 << 3,
  407. IsUnreachable = 1 << 4,
  408. HasCustomCallingConv = 1 << 5,
  409. IsNoInline = 1 << 6,
  410. HasOptimizedDebugInfo = 1 << 7,
  411. };
  412. CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(ProcSymFlags)
  413. /// Corresponds to COMPILESYM2::Flags bitfield.
  414. enum class CompileSym2Flags : uint32_t {
  415. None = 0,
  416. SourceLanguageMask = 0xFF,
  417. EC = 1 << 8,
  418. NoDbgInfo = 1 << 9,
  419. LTCG = 1 << 10,
  420. NoDataAlign = 1 << 11,
  421. ManagedPresent = 1 << 12,
  422. SecurityChecks = 1 << 13,
  423. HotPatch = 1 << 14,
  424. CVTCIL = 1 << 15,
  425. MSILModule = 1 << 16,
  426. };
  427. CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(CompileSym2Flags)
  428. /// Corresponds to COMPILESYM3::Flags bitfield.
  429. enum class CompileSym3Flags : uint32_t {
  430. None = 0,
  431. SourceLanguageMask = 0xFF,
  432. EC = 1 << 8,
  433. NoDbgInfo = 1 << 9,
  434. LTCG = 1 << 10,
  435. NoDataAlign = 1 << 11,
  436. ManagedPresent = 1 << 12,
  437. SecurityChecks = 1 << 13,
  438. HotPatch = 1 << 14,
  439. CVTCIL = 1 << 15,
  440. MSILModule = 1 << 16,
  441. Sdl = 1 << 17,
  442. PGO = 1 << 18,
  443. Exp = 1 << 19,
  444. };
  445. CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(CompileSym3Flags)
  446. enum class ExportFlags : uint16_t {
  447. None = 0,
  448. IsConstant = 1 << 0,
  449. IsData = 1 << 1,
  450. IsPrivate = 1 << 2,
  451. HasNoName = 1 << 3,
  452. HasExplicitOrdinal = 1 << 4,
  453. IsForwarder = 1 << 5
  454. };
  455. CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(ExportFlags)
  456. // Corresponds to BinaryAnnotationOpcode enum.
  457. enum class BinaryAnnotationsOpCode : uint32_t {
  458. Invalid,
  459. CodeOffset,
  460. ChangeCodeOffsetBase,
  461. ChangeCodeOffset,
  462. ChangeCodeLength,
  463. ChangeFile,
  464. ChangeLineOffset,
  465. ChangeLineEndDelta,
  466. ChangeRangeKind,
  467. ChangeColumnStart,
  468. ChangeColumnEndDelta,
  469. ChangeCodeOffsetAndLineOffset,
  470. ChangeCodeLengthAndCodeOffset,
  471. ChangeColumnEnd,
  472. };
  473. // Corresponds to CV_cookietype_e enum.
  474. enum class FrameCookieKind : uint8_t {
  475. Copy,
  476. XorStackPointer,
  477. XorFramePointer,
  478. XorR13,
  479. };
  480. // Corresponds to CV_HREG_e enum.
  481. enum class RegisterId : uint16_t {
  482. #define CV_REGISTERS_ALL
  483. #define CV_REGISTER(name, value) name = value,
  484. #include "CodeViewRegisters.def"
  485. #undef CV_REGISTER
  486. #undef CV_REGISTERS_ALL
  487. };
  488. // Register Ids are shared between architectures in CodeView. CPUType is needed
  489. // to map register Id to name.
  490. struct CPURegister {
  491. CPURegister() = delete;
  492. CPURegister(CPUType Cpu, codeview::RegisterId Reg) {
  493. this->Cpu = Cpu;
  494. this->Reg = Reg;
  495. }
  496. CPUType Cpu;
  497. RegisterId Reg;
  498. };
  499. /// Two-bit value indicating which register is the designated frame pointer
  500. /// register. Appears in the S_FRAMEPROC record flags.
  501. enum class EncodedFramePtrReg : uint8_t {
  502. None = 0,
  503. StackPtr = 1,
  504. FramePtr = 2,
  505. BasePtr = 3,
  506. };
  507. RegisterId decodeFramePtrReg(EncodedFramePtrReg EncodedReg, CPUType CPU);
  508. EncodedFramePtrReg encodeFramePtrReg(RegisterId Reg, CPUType CPU);
  509. /// These values correspond to the THUNK_ORDINAL enumeration.
  510. enum class ThunkOrdinal : uint8_t {
  511. Standard,
  512. ThisAdjustor,
  513. Vcall,
  514. Pcode,
  515. UnknownLoad,
  516. TrampIncremental,
  517. BranchIsland
  518. };
  519. enum class TrampolineType : uint16_t { TrampIncremental, BranchIsland };
  520. // These values correspond to the CV_SourceChksum_t enumeration.
  521. enum class FileChecksumKind : uint8_t { None, MD5, SHA1, SHA256 };
  522. enum LineFlags : uint16_t {
  523. LF_None = 0,
  524. LF_HaveColumns = 1, // CV_LINES_HAVE_COLUMNS
  525. };
  526. /// Data in the SUBSEC_FRAMEDATA subection.
  527. struct FrameData {
  528. support::ulittle32_t RvaStart;
  529. support::ulittle32_t CodeSize;
  530. support::ulittle32_t LocalSize;
  531. support::ulittle32_t ParamsSize;
  532. support::ulittle32_t MaxStackSize;
  533. support::ulittle32_t FrameFunc;
  534. support::ulittle16_t PrologSize;
  535. support::ulittle16_t SavedRegsSize;
  536. support::ulittle32_t Flags;
  537. enum : uint32_t {
  538. HasSEH = 1 << 0,
  539. HasEH = 1 << 1,
  540. IsFunctionStart = 1 << 2,
  541. };
  542. };
  543. // Corresponds to LocalIdAndGlobalIdPair structure.
  544. // This structure information allows cross-referencing between PDBs. For
  545. // example, when a PDB is being built during compilation it is not yet known
  546. // what other modules may end up in the PDB at link time. So certain types of
  547. // IDs may clash between the various compile time PDBs. For each affected
  548. // module, a subsection would be put into the PDB containing a mapping from its
  549. // local IDs to a single ID namespace for all items in the PDB file.
  550. struct CrossModuleExport {
  551. support::ulittle32_t Local;
  552. support::ulittle32_t Global;
  553. };
  554. struct CrossModuleImport {
  555. support::ulittle32_t ModuleNameOffset;
  556. support::ulittle32_t Count; // Number of elements
  557. // support::ulittle32_t ids[Count]; // id from referenced module
  558. };
  559. enum class CodeViewContainer { ObjectFile, Pdb };
  560. inline uint32_t alignOf(CodeViewContainer Container) {
  561. if (Container == CodeViewContainer::ObjectFile)
  562. return 1;
  563. return 4;
  564. }
  565. }
  566. }
  567. #endif
  568. #ifdef __GNUC__
  569. #pragma GCC diagnostic pop
  570. #endif