[codeview] Some cleanup of Symbol Records.

* Reworks the CVSymbolTypes.def to work similarly to TypeRecords.def.
* Moves some enums from SymbolRecords.h to CodeView.h to maintain
  consistency with how we do type records.
* Generalize a few simple things like the record prefix
* Define the leaf enum and the kind enum similar to how we do with tyep
  records.

Differential Revision: http://reviews.llvm.org/D20342
Reviewed By: amccarth, rnk

llvm-svn: 269867
This commit is contained in:
Zachary Turner 2016-05-17 23:50:21 +00:00
parent 56a4c5b60b
commit d4ae961cf6
11 changed files with 408 additions and 382 deletions

View File

@ -11,227 +11,239 @@
//
//===----------------------------------------------------------------------===//
#ifndef SYMBOL_TYPE
#define SYMBOL_TYPE(ename, value)
#ifndef CV_SYMBOL
#define CV_SYMBOL(ename, value)
#endif
#ifndef SYMBOL_RECORD
#define SYMBOL_RECORD(lf_ename, value, name) CV_SYMBOL(lf_ename, value)
#endif
#ifndef SYMBOL_RECORD_ALIAS
#define SYMBOL_RECORD_ALIAS(lf_ename, value, name, alias_name) \
SYMBOL_RECORD(lf_ename, value, name)
#endif
// 16 bit symbol types. Not very useful, provided only for reference.
SYMBOL_TYPE(S_COMPILE , 0x0001)
SYMBOL_TYPE(S_REGISTER_16t , 0x0002)
SYMBOL_TYPE(S_CONSTANT_16t , 0x0003)
SYMBOL_TYPE(S_UDT_16t , 0x0004)
SYMBOL_TYPE(S_SSEARCH , 0x0005)
SYMBOL_TYPE(S_END , 0x0006)
SYMBOL_TYPE(S_SKIP , 0x0007)
SYMBOL_TYPE(S_CVRESERVE , 0x0008)
SYMBOL_TYPE(S_OBJNAME_ST , 0x0009)
SYMBOL_TYPE(S_ENDARG , 0x000a)
SYMBOL_TYPE(S_COBOLUDT_16t , 0x000b)
SYMBOL_TYPE(S_MANYREG_16t , 0x000c)
SYMBOL_TYPE(S_RETURN , 0x000d)
SYMBOL_TYPE(S_ENTRYTHIS , 0x000e)
SYMBOL_TYPE(S_BPREL16 , 0x0100)
SYMBOL_TYPE(S_LDATA16 , 0x0101)
SYMBOL_TYPE(S_GDATA16 , 0x0102)
SYMBOL_TYPE(S_PUB16 , 0x0103)
SYMBOL_TYPE(S_LPROC16 , 0x0104)
SYMBOL_TYPE(S_GPROC16 , 0x0105)
SYMBOL_TYPE(S_THUNK16 , 0x0106)
SYMBOL_TYPE(S_BLOCK16 , 0x0107)
SYMBOL_TYPE(S_WITH16 , 0x0108)
SYMBOL_TYPE(S_LABEL16 , 0x0109)
SYMBOL_TYPE(S_CEXMODEL16 , 0x010a)
SYMBOL_TYPE(S_VFTABLE16 , 0x010b)
SYMBOL_TYPE(S_REGREL16 , 0x010c)
SYMBOL_TYPE(S_BPREL32_16t , 0x0200)
SYMBOL_TYPE(S_LDATA32_16t , 0x0201)
SYMBOL_TYPE(S_GDATA32_16t , 0x0202)
SYMBOL_TYPE(S_PUB32_16t , 0x0203)
SYMBOL_TYPE(S_LPROC32_16t , 0x0204)
SYMBOL_TYPE(S_GPROC32_16t , 0x0205)
SYMBOL_TYPE(S_THUNK32_ST , 0x0206)
SYMBOL_TYPE(S_BLOCK32_ST , 0x0207)
SYMBOL_TYPE(S_WITH32_ST , 0x0208)
SYMBOL_TYPE(S_LABEL32_ST , 0x0209)
SYMBOL_TYPE(S_CEXMODEL32 , 0x020a)
SYMBOL_TYPE(S_VFTABLE32_16t , 0x020b)
SYMBOL_TYPE(S_REGREL32_16t , 0x020c)
SYMBOL_TYPE(S_LTHREAD32_16t , 0x020d)
SYMBOL_TYPE(S_GTHREAD32_16t , 0x020e)
SYMBOL_TYPE(S_SLINK32 , 0x020f)
SYMBOL_TYPE(S_LPROCMIPS_16t , 0x0300)
SYMBOL_TYPE(S_GPROCMIPS_16t , 0x0301)
SYMBOL_TYPE(S_PROCREF_ST , 0x0400)
SYMBOL_TYPE(S_DATAREF_ST , 0x0401)
SYMBOL_TYPE(S_ALIGN , 0x0402)
SYMBOL_TYPE(S_LPROCREF_ST , 0x0403)
SYMBOL_TYPE(S_OEM , 0x0404)
CV_SYMBOL(S_COMPILE , 0x0001)
CV_SYMBOL(S_REGISTER_16t , 0x0002)
CV_SYMBOL(S_CONSTANT_16t , 0x0003)
CV_SYMBOL(S_UDT_16t , 0x0004)
CV_SYMBOL(S_SSEARCH , 0x0005)
CV_SYMBOL(S_END , 0x0006)
CV_SYMBOL(S_SKIP , 0x0007)
CV_SYMBOL(S_CVRESERVE , 0x0008)
CV_SYMBOL(S_OBJNAME_ST , 0x0009)
CV_SYMBOL(S_ENDARG , 0x000a)
CV_SYMBOL(S_COBOLUDT_16t , 0x000b)
CV_SYMBOL(S_MANYREG_16t , 0x000c)
CV_SYMBOL(S_RETURN , 0x000d)
CV_SYMBOL(S_ENTRYTHIS , 0x000e)
CV_SYMBOL(S_BPREL16 , 0x0100)
CV_SYMBOL(S_LDATA16 , 0x0101)
CV_SYMBOL(S_GDATA16 , 0x0102)
CV_SYMBOL(S_PUB16 , 0x0103)
CV_SYMBOL(S_LPROC16 , 0x0104)
CV_SYMBOL(S_GPROC16 , 0x0105)
CV_SYMBOL(S_THUNK16 , 0x0106)
CV_SYMBOL(S_BLOCK16 , 0x0107)
CV_SYMBOL(S_WITH16 , 0x0108)
CV_SYMBOL(S_LABEL16 , 0x0109)
CV_SYMBOL(S_CEXMODEL16 , 0x010a)
CV_SYMBOL(S_VFTABLE16 , 0x010b)
CV_SYMBOL(S_REGREL16 , 0x010c)
CV_SYMBOL(S_BPREL32_16t , 0x0200)
CV_SYMBOL(S_LDATA32_16t , 0x0201)
CV_SYMBOL(S_GDATA32_16t , 0x0202)
CV_SYMBOL(S_PUB32_16t , 0x0203)
CV_SYMBOL(S_LPROC32_16t , 0x0204)
CV_SYMBOL(S_GPROC32_16t , 0x0205)
CV_SYMBOL(S_THUNK32_ST , 0x0206)
CV_SYMBOL(S_BLOCK32_ST , 0x0207)
CV_SYMBOL(S_WITH32_ST , 0x0208)
CV_SYMBOL(S_LABEL32_ST , 0x0209)
CV_SYMBOL(S_CEXMODEL32 , 0x020a)
CV_SYMBOL(S_VFTABLE32_16t , 0x020b)
CV_SYMBOL(S_REGREL32_16t , 0x020c)
CV_SYMBOL(S_LTHREAD32_16t , 0x020d)
CV_SYMBOL(S_GTHREAD32_16t , 0x020e)
CV_SYMBOL(S_SLINK32 , 0x020f)
CV_SYMBOL(S_LPROCMIPS_16t , 0x0300)
CV_SYMBOL(S_GPROCMIPS_16t , 0x0301)
CV_SYMBOL(S_PROCREF_ST , 0x0400)
CV_SYMBOL(S_DATAREF_ST , 0x0401)
CV_SYMBOL(S_ALIGN , 0x0402)
CV_SYMBOL(S_LPROCREF_ST , 0x0403)
CV_SYMBOL(S_OEM , 0x0404)
// All post 16 bit symbol types have the 0x1000 bit set.
SYMBOL_TYPE(S_TI16_MAX , 0x1000)
CV_SYMBOL(S_TI16_MAX , 0x1000)
// Mostly unused "start" symbol types.
SYMBOL_TYPE(S_REGISTER_ST , 0x1001)
SYMBOL_TYPE(S_CONSTANT_ST , 0x1002)
SYMBOL_TYPE(S_UDT_ST , 0x1003)
SYMBOL_TYPE(S_COBOLUDT_ST , 0x1004)
SYMBOL_TYPE(S_MANYREG_ST , 0x1005)
SYMBOL_TYPE(S_BPREL32_ST , 0x1006)
SYMBOL_TYPE(S_LDATA32_ST , 0x1007)
SYMBOL_TYPE(S_GDATA32_ST , 0x1008)
SYMBOL_TYPE(S_PUB32_ST , 0x1009)
SYMBOL_TYPE(S_LPROC32_ST , 0x100a)
SYMBOL_TYPE(S_GPROC32_ST , 0x100b)
SYMBOL_TYPE(S_VFTABLE32 , 0x100c)
SYMBOL_TYPE(S_REGREL32_ST , 0x100d)
SYMBOL_TYPE(S_LTHREAD32_ST , 0x100e)
SYMBOL_TYPE(S_GTHREAD32_ST , 0x100f)
SYMBOL_TYPE(S_LPROCMIPS_ST , 0x1010)
SYMBOL_TYPE(S_GPROCMIPS_ST , 0x1011)
CV_SYMBOL(S_REGISTER_ST , 0x1001)
CV_SYMBOL(S_CONSTANT_ST , 0x1002)
CV_SYMBOL(S_UDT_ST , 0x1003)
CV_SYMBOL(S_COBOLUDT_ST , 0x1004)
CV_SYMBOL(S_MANYREG_ST , 0x1005)
CV_SYMBOL(S_BPREL32_ST , 0x1006)
CV_SYMBOL(S_LDATA32_ST , 0x1007)
CV_SYMBOL(S_GDATA32_ST , 0x1008)
CV_SYMBOL(S_PUB32_ST , 0x1009)
CV_SYMBOL(S_LPROC32_ST , 0x100a)
CV_SYMBOL(S_GPROC32_ST , 0x100b)
CV_SYMBOL(S_VFTABLE32 , 0x100c)
CV_SYMBOL(S_REGREL32_ST , 0x100d)
CV_SYMBOL(S_LTHREAD32_ST , 0x100e)
CV_SYMBOL(S_GTHREAD32_ST , 0x100f)
CV_SYMBOL(S_LPROCMIPS_ST , 0x1010)
CV_SYMBOL(S_GPROCMIPS_ST , 0x1011)
// Information about the frame layout of a procedure.
SYMBOL_TYPE(S_FRAMEPROC , 0x1012)
SYMBOL_TYPE(S_COMPILE2_ST , 0x1013)
SYMBOL_TYPE(S_MANYREG2_ST , 0x1014)
SYMBOL_TYPE(S_LPROCIA64_ST , 0x1015)
SYMBOL_TYPE(S_GPROCIA64_ST , 0x1016)
SYMBOL_TYPE(S_LOCALSLOT_ST , 0x1017)
SYMBOL_TYPE(S_PARAMSLOT_ST , 0x1018)
SYMBOL_TYPE(S_ANNOTATION , 0x1019)
SYMBOL_TYPE(S_GMANPROC_ST , 0x101a)
SYMBOL_TYPE(S_LMANPROC_ST , 0x101b)
SYMBOL_TYPE(S_RESERVED1 , 0x101c)
SYMBOL_TYPE(S_RESERVED2 , 0x101d)
SYMBOL_TYPE(S_RESERVED3 , 0x101e)
SYMBOL_TYPE(S_RESERVED4 , 0x101f)
SYMBOL_TYPE(S_LMANDATA_ST , 0x1020)
SYMBOL_TYPE(S_GMANDATA_ST , 0x1021)
SYMBOL_TYPE(S_MANFRAMEREL_ST, 0x1022)
SYMBOL_TYPE(S_MANREGISTER_ST, 0x1023)
SYMBOL_TYPE(S_MANSLOT_ST , 0x1024)
SYMBOL_TYPE(S_MANMANYREG_ST , 0x1025)
SYMBOL_TYPE(S_MANREGREL_ST , 0x1026)
SYMBOL_TYPE(S_MANMANYREG2_ST, 0x1027)
SYMBOL_TYPE(S_MANTYPREF , 0x1028)
SYMBOL_TYPE(S_UNAMESPACE_ST , 0x1029)
CV_SYMBOL(S_COMPILE2_ST , 0x1013)
CV_SYMBOL(S_MANYREG2_ST , 0x1014)
CV_SYMBOL(S_LPROCIA64_ST , 0x1015)
CV_SYMBOL(S_GPROCIA64_ST , 0x1016)
CV_SYMBOL(S_LOCALSLOT_ST , 0x1017)
CV_SYMBOL(S_PARAMSLOT_ST , 0x1018)
CV_SYMBOL(S_ANNOTATION , 0x1019)
CV_SYMBOL(S_GMANPROC_ST , 0x101a)
CV_SYMBOL(S_LMANPROC_ST , 0x101b)
CV_SYMBOL(S_RESERVED1 , 0x101c)
CV_SYMBOL(S_RESERVED2 , 0x101d)
CV_SYMBOL(S_RESERVED3 , 0x101e)
CV_SYMBOL(S_RESERVED4 , 0x101f)
CV_SYMBOL(S_LMANDATA_ST , 0x1020)
CV_SYMBOL(S_GMANDATA_ST , 0x1021)
CV_SYMBOL(S_MANFRAMEREL_ST, 0x1022)
CV_SYMBOL(S_MANREGISTER_ST, 0x1023)
CV_SYMBOL(S_MANSLOT_ST , 0x1024)
CV_SYMBOL(S_MANMANYREG_ST , 0x1025)
CV_SYMBOL(S_MANREGREL_ST , 0x1026)
CV_SYMBOL(S_MANMANYREG2_ST, 0x1027)
CV_SYMBOL(S_MANTYPREF , 0x1028)
CV_SYMBOL(S_UNAMESPACE_ST , 0x1029)
// End of S_*_ST symbols, which do not appear to be generated by modern
// compilers.
SYMBOL_TYPE(S_ST_MAX , 0x1100)
CV_SYMBOL(S_ST_MAX , 0x1100)
SYMBOL_TYPE(S_OBJNAME , 0x1101)
SYMBOL_TYPE(S_THUNK32 , 0x1102)
SYMBOL_TYPE(S_BLOCK32 , 0x1103)
SYMBOL_TYPE(S_WITH32 , 0x1104)
SYMBOL_TYPE(S_LABEL32 , 0x1105)
SYMBOL_TYPE(S_REGISTER , 0x1106)
SYMBOL_TYPE(S_CONSTANT , 0x1107)
SYMBOL_TYPE(S_UDT , 0x1108)
SYMBOL_TYPE(S_COBOLUDT , 0x1109)
SYMBOL_TYPE(S_MANYREG , 0x110a)
SYMBOL_TYPE(S_BPREL32 , 0x110b)
SYMBOL_TYPE(S_LDATA32 , 0x110c)
SYMBOL_TYPE(S_GDATA32 , 0x110d)
SYMBOL_TYPE(S_PUB32 , 0x110e)
SYMBOL_TYPE(S_LPROC32 , 0x110f)
SYMBOL_TYPE(S_GPROC32 , 0x1110)
SYMBOL_TYPE(S_REGREL32 , 0x1111)
SYMBOL_TYPE(S_LTHREAD32 , 0x1112)
SYMBOL_TYPE(S_GTHREAD32 , 0x1113)
SYMBOL_TYPE(S_LPROCMIPS , 0x1114)
SYMBOL_TYPE(S_GPROCMIPS , 0x1115)
SYMBOL_TYPE(S_COMPILE2 , 0x1116)
SYMBOL_TYPE(S_MANYREG2 , 0x1117)
SYMBOL_TYPE(S_LPROCIA64 , 0x1118)
SYMBOL_TYPE(S_GPROCIA64 , 0x1119)
SYMBOL_TYPE(S_LOCALSLOT , 0x111a)
SYMBOL_TYPE(S_PARAMSLOT , 0x111b)
CV_SYMBOL(S_THUNK32 , 0x1102)
CV_SYMBOL(S_WITH32 , 0x1104)
CV_SYMBOL(S_REGISTER , 0x1106)
CV_SYMBOL(S_MANYREG , 0x110a)
CV_SYMBOL(S_PUB32 , 0x110e)
CV_SYMBOL(S_LPROCMIPS , 0x1114)
CV_SYMBOL(S_GPROCMIPS , 0x1115)
CV_SYMBOL(S_COMPILE2 , 0x1116)
CV_SYMBOL(S_MANYREG2 , 0x1117)
CV_SYMBOL(S_LPROCIA64 , 0x1118)
CV_SYMBOL(S_GPROCIA64 , 0x1119)
CV_SYMBOL(S_LOCALSLOT , 0x111a)
CV_SYMBOL(S_PARAMSLOT , 0x111b)
// Managed code symbols.
SYMBOL_TYPE(S_LMANDATA , 0x111c)
SYMBOL_TYPE(S_GMANDATA , 0x111d)
SYMBOL_TYPE(S_MANFRAMEREL , 0x111e)
SYMBOL_TYPE(S_MANREGISTER , 0x111f)
SYMBOL_TYPE(S_MANSLOT , 0x1120)
SYMBOL_TYPE(S_MANMANYREG , 0x1121)
SYMBOL_TYPE(S_MANREGREL , 0x1122)
SYMBOL_TYPE(S_MANMANYREG2 , 0x1123)
SYMBOL_TYPE(S_UNAMESPACE , 0x1124)
SYMBOL_TYPE(S_PROCREF , 0x1125)
SYMBOL_TYPE(S_DATAREF , 0x1126)
SYMBOL_TYPE(S_LPROCREF , 0x1127)
SYMBOL_TYPE(S_ANNOTATIONREF , 0x1128)
SYMBOL_TYPE(S_TOKENREF , 0x1129)
SYMBOL_TYPE(S_GMANPROC , 0x112a)
SYMBOL_TYPE(S_LMANPROC , 0x112b)
SYMBOL_TYPE(S_TRAMPOLINE , 0x112c)
SYMBOL_TYPE(S_MANCONSTANT , 0x112d)
SYMBOL_TYPE(S_ATTR_FRAMEREL , 0x112e)
SYMBOL_TYPE(S_ATTR_REGISTER , 0x112f)
SYMBOL_TYPE(S_ATTR_REGREL , 0x1130)
SYMBOL_TYPE(S_ATTR_MANYREG , 0x1131)
CV_SYMBOL(S_MANFRAMEREL , 0x111e)
CV_SYMBOL(S_MANREGISTER , 0x111f)
CV_SYMBOL(S_MANSLOT , 0x1120)
CV_SYMBOL(S_MANMANYREG , 0x1121)
CV_SYMBOL(S_MANREGREL , 0x1122)
CV_SYMBOL(S_MANMANYREG2 , 0x1123)
CV_SYMBOL(S_UNAMESPACE , 0x1124)
CV_SYMBOL(S_PROCREF , 0x1125)
CV_SYMBOL(S_DATAREF , 0x1126)
CV_SYMBOL(S_LPROCREF , 0x1127)
CV_SYMBOL(S_ANNOTATIONREF , 0x1128)
CV_SYMBOL(S_TOKENREF , 0x1129)
CV_SYMBOL(S_GMANPROC , 0x112a)
CV_SYMBOL(S_LMANPROC , 0x112b)
CV_SYMBOL(S_TRAMPOLINE , 0x112c)
CV_SYMBOL(S_ATTR_FRAMEREL , 0x112e)
CV_SYMBOL(S_ATTR_REGISTER , 0x112f)
CV_SYMBOL(S_ATTR_REGREL , 0x1130)
CV_SYMBOL(S_ATTR_MANYREG , 0x1131)
SYMBOL_TYPE(S_SEPCODE , 0x1132)
SYMBOL_TYPE(S_LOCAL_2005 , 0x1133)
SYMBOL_TYPE(S_DEFRANGE_2005 , 0x1134)
SYMBOL_TYPE(S_DEFRANGE2_2005, 0x1135)
SYMBOL_TYPE(S_SECTION , 0x1136)
SYMBOL_TYPE(S_COFFGROUP , 0x1137)
SYMBOL_TYPE(S_EXPORT , 0x1138)
SYMBOL_TYPE(S_CALLSITEINFO , 0x1139)
SYMBOL_TYPE(S_FRAMECOOKIE , 0x113a)
SYMBOL_TYPE(S_DISCARDED , 0x113b)
SYMBOL_TYPE(S_COMPILE3 , 0x113c)
SYMBOL_TYPE(S_ENVBLOCK , 0x113d)
SYMBOL_TYPE(S_LOCAL , 0x113e)
SYMBOL_TYPE(S_DEFRANGE , 0x113f)
SYMBOL_TYPE(S_DEFRANGE_SUBFIELD, 0x1140)
SYMBOL_TYPE(S_DEFRANGE_REGISTER, 0x1141)
SYMBOL_TYPE(S_DEFRANGE_FRAMEPOINTER_REL, 0x1142)
SYMBOL_TYPE(S_DEFRANGE_SUBFIELD_REGISTER, 0x1143)
SYMBOL_TYPE(S_DEFRANGE_FRAMEPOINTER_REL_FULL_SCOPE, 0x1144)
SYMBOL_TYPE(S_DEFRANGE_REGISTER_REL, 0x1145)
CV_SYMBOL(S_SEPCODE , 0x1132)
CV_SYMBOL(S_LOCAL_2005 , 0x1133)
CV_SYMBOL(S_DEFRANGE_2005 , 0x1134)
CV_SYMBOL(S_DEFRANGE2_2005, 0x1135)
CV_SYMBOL(S_SECTION , 0x1136)
CV_SYMBOL(S_COFFGROUP , 0x1137)
CV_SYMBOL(S_EXPORT , 0x1138)
CV_SYMBOL(S_DISCARDED , 0x113b)
CV_SYMBOL(S_ENVBLOCK , 0x113d)
// Current symbol types for most procedures as of this writing.
SYMBOL_TYPE(S_LPROC32_ID , 0x1146)
SYMBOL_TYPE(S_GPROC32_ID , 0x1147)
SYMBOL_TYPE(S_LPROCMIPS_ID , 0x1148)
SYMBOL_TYPE(S_GPROCMIPS_ID , 0x1149)
SYMBOL_TYPE(S_LPROCIA64_ID , 0x114a)
SYMBOL_TYPE(S_GPROCIA64_ID , 0x114b)
SYMBOL_TYPE(S_BUILDINFO , 0x114c)
CV_SYMBOL(S_LPROCMIPS_ID , 0x1148)
CV_SYMBOL(S_GPROCMIPS_ID , 0x1149)
CV_SYMBOL(S_LPROCIA64_ID , 0x114a)
CV_SYMBOL(S_GPROCIA64_ID , 0x114b)
// Inlined call site delimiters.
SYMBOL_TYPE(S_INLINESITE , 0x114d)
SYMBOL_TYPE(S_INLINESITE_END , 0x114e)
CV_SYMBOL(S_INLINESITE_END , 0x114e)
// Procedure info end delimiter.
SYMBOL_TYPE(S_PROC_ID_END , 0x114f)
CV_SYMBOL(S_PROC_ID_END , 0x114f)
SYMBOL_TYPE(S_DEFRANGE_HLSL , 0x1150)
SYMBOL_TYPE(S_GDATA_HLSL , 0x1151)
SYMBOL_TYPE(S_LDATA_HLSL , 0x1152)
SYMBOL_TYPE(S_FILESTATIC , 0x1153)
SYMBOL_TYPE(S_LOCAL_DPC_GROUPSHARED, 0x1154)
SYMBOL_TYPE(S_LPROC32_DPC , 0x1155)
SYMBOL_TYPE(S_LPROC32_DPC_ID , 0x1156)
SYMBOL_TYPE(S_DEFRANGE_DPC_PTR_TAG, 0x1157)
SYMBOL_TYPE(S_DPC_SYM_TAG_MAP, 0x1158)
SYMBOL_TYPE(S_ARMSWITCHTABLE , 0x1159)
SYMBOL_TYPE(S_CALLEES , 0x115a)
SYMBOL_TYPE(S_CALLERS , 0x115b)
SYMBOL_TYPE(S_POGODATA , 0x115c)
SYMBOL_TYPE(S_INLINESITE2 , 0x115d)
SYMBOL_TYPE(S_HEAPALLOCSITE , 0x115e)
SYMBOL_TYPE(S_MOD_TYPEREF , 0x115f)
SYMBOL_TYPE(S_REF_MINIPDB , 0x1160)
SYMBOL_TYPE(S_PDBMAP , 0x1161)
SYMBOL_TYPE(S_GDATA_HLSL32 , 0x1162)
SYMBOL_TYPE(S_LDATA_HLSL32 , 0x1163)
SYMBOL_TYPE(S_GDATA_HLSL32_EX, 0x1164)
SYMBOL_TYPE(S_LDATA_HLSL32_EX, 0x1165)
CV_SYMBOL(S_DEFRANGE_HLSL , 0x1150)
CV_SYMBOL(S_GDATA_HLSL , 0x1151)
CV_SYMBOL(S_LDATA_HLSL , 0x1152)
CV_SYMBOL(S_FILESTATIC , 0x1153)
CV_SYMBOL(S_LOCAL_DPC_GROUPSHARED, 0x1154)
CV_SYMBOL(S_DEFRANGE_DPC_PTR_TAG, 0x1157)
CV_SYMBOL(S_DPC_SYM_TAG_MAP, 0x1158)
CV_SYMBOL(S_ARMSWITCHTABLE , 0x1159)
CV_SYMBOL(S_CALLEES , 0x115a)
CV_SYMBOL(S_CALLERS , 0x115b)
CV_SYMBOL(S_POGODATA , 0x115c)
CV_SYMBOL(S_INLINESITE2 , 0x115d)
CV_SYMBOL(S_MOD_TYPEREF , 0x115f)
CV_SYMBOL(S_REF_MINIPDB , 0x1160)
CV_SYMBOL(S_PDBMAP , 0x1161)
CV_SYMBOL(S_GDATA_HLSL32 , 0x1162)
CV_SYMBOL(S_LDATA_HLSL32 , 0x1163)
CV_SYMBOL(S_GDATA_HLSL32_EX, 0x1164)
CV_SYMBOL(S_LDATA_HLSL32_EX, 0x1165)
#undef SYMBOL_TYPE
// Known symbol types
SYMBOL_RECORD(S_LPROC32 , 0x110f, ProcSym)
SYMBOL_RECORD_ALIAS(S_GPROC32 , 0x1110, GlobalProcSym, ProcSym)
SYMBOL_RECORD_ALIAS(S_LPROC32_ID , 0x1146, ProcIdSym, ProcSym)
SYMBOL_RECORD_ALIAS(S_GPROC32_ID , 0x1147, GlobalProcIdSym, ProcSym)
SYMBOL_RECORD_ALIAS(S_LPROC32_DPC , 0x1155, DPCProcSym, ProcSym)
SYMBOL_RECORD_ALIAS(S_LPROC32_DPC_ID , 0x1156, DPCProcIdSym, ProcSym)
SYMBOL_RECORD(S_INLINESITE , 0x114d, InlineSiteSym)
SYMBOL_RECORD(S_LOCAL , 0x113e, LocalSym)
SYMBOL_RECORD(S_DEFRANGE , 0x113f, DefRangeSym)
SYMBOL_RECORD(S_DEFRANGE_SUBFIELD, 0x1140, DefRangeSubfieldSym)
SYMBOL_RECORD(S_DEFRANGE_REGISTER, 0x1141, DefRangeRegisterSym)
SYMBOL_RECORD(S_DEFRANGE_FRAMEPOINTER_REL, 0x1142, DefRangeSubfieldRegisterSym)
SYMBOL_RECORD(S_DEFRANGE_SUBFIELD_REGISTER, 0x1143, DefRangeFramePointerRelSym)
SYMBOL_RECORD(S_DEFRANGE_FRAMEPOINTER_REL_FULL_SCOPE, 0x1144, DefRangeFramePointerRelFullScopeSym)
SYMBOL_RECORD(S_DEFRANGE_REGISTER_REL, 0x1145, DefRangeRegisterRelSym)
SYMBOL_RECORD(S_BLOCK32 , 0x1103, BlockSym)
SYMBOL_RECORD(S_LABEL32 , 0x1105, LabelSym)
SYMBOL_RECORD(S_OBJNAME , 0x1101, ObjNameSym)
SYMBOL_RECORD(S_COMPILE3 , 0x113c, Compile3Sym)
SYMBOL_RECORD(S_FRAMEPROC , 0x1012, FrameProcSym)
SYMBOL_RECORD(S_CALLSITEINFO , 0x1139, CallSiteInfoSym)
SYMBOL_RECORD(S_HEAPALLOCSITE , 0x115e, HeapAllocationSiteSym)
SYMBOL_RECORD(S_FRAMECOOKIE , 0x113a, FrameCookieSym)
SYMBOL_RECORD(S_UDT , 0x1108, UDTSym)
SYMBOL_RECORD_ALIAS(S_COBOLUDT , 0x1109, CobolUDT, UDTSym)
SYMBOL_RECORD(S_BUILDINFO , 0x114c, BuildInfoSym)
SYMBOL_RECORD(S_BPREL32 , 0x110b, BPRelativeSym)
SYMBOL_RECORD(S_REGREL32 , 0x1111, RegRelativeSym)
SYMBOL_RECORD(S_CONSTANT , 0x1107, ConstantSym)
SYMBOL_RECORD_ALIAS(S_MANCONSTANT , 0x112d, ManagedConstant, ConstantSym)
SYMBOL_RECORD(S_LDATA32 , 0x110c, DataSym)
SYMBOL_RECORD_ALIAS(S_GDATA32 , 0x110d, GlobalData, DataSym)
SYMBOL_RECORD_ALIAS(S_LMANDATA , 0x111c, ManagedLocalData, DataSym)
SYMBOL_RECORD_ALIAS(S_GMANDATA , 0x111d, ManagedGlobalData, DataSym)
SYMBOL_RECORD(S_LTHREAD32 , 0x1112, ThreadLocalDataSym)
SYMBOL_RECORD_ALIAS(S_GTHREAD32 , 0x1113, GlobalTLS, ThreadLocalDataSym)
#undef CV_SYMBOL
#undef SYMBOL_RECORD
#undef SYMBOL_RECORD_ALIAS

View File

@ -326,23 +326,6 @@ enum class PointerToMemberRepresentation : uint16_t {
GeneralFunction = 0x08 // member function, most general
};
/// Distinguishes individual records in .debug$T section or PDB type stream. The
/// documentation and headers talk about this as the "leaf" type.
enum class TypeRecordKind : uint16_t {
#define TYPE_RECORD(lf_ename, value, name) name = value,
#include "TypeRecords.def"
// FIXME: Add serialization support
FieldList = 0x1203,
BitField = 0x1205,
};
/// Duplicate copy of the above enum, but using the official CV names. Useful
/// for reference purposes and when dealing with unknown record types.
enum TypeLeafKind : uint16_t {
#define CV_TYPE(name, val) name = val,
#include "TypeRecords.def"
};
enum class VFTableSlotKind : uint8_t {
Near16 = 0x00,
Far16 = 0x01,
@ -359,6 +342,79 @@ enum class WindowsRTClassKind : uint8_t {
ValueClass = 0x02,
Interface = 0x03
};
/// Corresponds to CV_LVARFLAGS bitfield.
enum class LocalSymFlags : uint16_t {
None = 0,
IsParameter = 1 << 0,
IsAddressTaken = 1 << 1,
IsCompilerGenerated = 1 << 2,
IsAggregate = 1 << 3,
IsAggregated = 1 << 4,
IsAliased = 1 << 5,
IsAlias = 1 << 6,
IsReturnValue = 1 << 7,
IsOptimizedOut = 1 << 8,
IsEnregisteredGlobal = 1 << 9,
IsEnregisteredStatic = 1 << 10,
};
CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(LocalSymFlags)
/// Corresponds to the CV_PROCFLAGS bitfield.
enum class ProcSymFlags : uint8_t {
None = 0,
HasFP = 1 << 0,
HasIRET = 1 << 1,
HasFRET = 1 << 2,
IsNoReturn = 1 << 3,
IsUnreachable = 1 << 4,
HasCustomCallingConv = 1 << 5,
IsNoInline = 1 << 6,
HasOptimizedDebugInfo = 1 << 7,
};
CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(ProcSymFlags)
/// Corresponds to COMPILESYM3::Flags bitfield.
enum CompileSym3Flags : uint32_t {
EC = 1 << 8,
NoDbgInfo = 1 << 9,
LTCG = 1 << 10,
NoDataAlign = 1 << 11,
ManagedPresent = 1 << 12,
SecurityChecks = 1 << 13,
HotPatch = 1 << 14,
CVTCIL = 1 << 15,
MSILModule = 1 << 16,
Sdl = 1 << 17,
PGO = 1 << 18,
Exp = 1 << 19,
};
// Corresponds to BinaryAnnotationOpcode enum.
enum class BinaryAnnotationsOpCode : uint32_t {
Invalid,
CodeOffset,
ChangeCodeOffsetBase,
ChangeCodeOffset,
ChangeCodeLength,
ChangeFile,
ChangeLineOffset,
ChangeLineEndDelta,
ChangeRangeKind,
ChangeColumnStart,
ChangeColumnEndDelta,
ChangeCodeOffsetAndLineOffset,
ChangeCodeLengthAndCodeOffset,
ChangeColumnEnd,
};
// Corresponds to CV_cookietype_e enum.
enum class FrameCookieKind : uint32_t {
Copy,
XorStackPointer,
XorFramePointer,
XorR13,
};
}
}

View File

@ -12,18 +12,14 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
#include "llvm/Support/Endian.h"
namespace llvm {
namespace codeview {
// A const input iterator interface to the CodeView record stream.
template <typename Kind> class RecordIterator {
private:
struct RecordPrefix {
support::ulittle16_t RecordLen; // Record length, starting from &Leaf.
support::ulittle16_t RecordKind; // Record kind (from the `Kind` enum).
};
public:
struct Record {
std::size_t Length;

View File

@ -24,6 +24,11 @@ using llvm::support::little32_t;
using llvm::support::ulittle16_t;
using llvm::support::ulittle32_t;
struct RecordPrefix {
ulittle16_t RecordLen; // Record length, starting from &Leaf.
ulittle16_t RecordKind; // Record kind enum (SymRecordKind or TypeRecordKind)
};
/// Reinterpret a byte array as an array of characters. Does not interpret as
/// a C string, as StringRef has several helpers (split) that make that easy.
StringRef getBytesAsCharacters(ArrayRef<uint8_t> LeafData);

View File

@ -24,32 +24,16 @@ using llvm::support::little32_t;
/// Distinguishes individual records in the Symbols subsection of a .debug$S
/// section. Equivalent to SYM_ENUM_e in cvinfo.h.
enum SymbolRecordKind : uint16_t {
#define SYMBOL_TYPE(ename, value) ename = value,
enum class SymbolRecordKind : uint16_t {
#define SYMBOL_RECORD(lf_ename, value, name) name = value,
#include "CVSymbolTypes.def"
};
/// Data preceding all symbol records.
struct SymRecord {
ulittle16_t RecordLength; // Record length, starting from the next field
ulittle16_t RecordKind; // Record kind (SymbolRecordKind)
// Symbol data follows.
SymbolRecordKind getKind() const {
return SymbolRecordKind(uint16_t(RecordKind));
}
};
/// Corresponds to the CV_PROCFLAGS bitfield.
enum ProcFlags : uint8_t {
HasFP = 1 << 0,
HasIRET = 1 << 1,
HasFRET = 1 << 2,
IsNoReturn = 1 << 3,
IsUnreachable = 1 << 4,
HasCustomCallingConv = 1 << 5,
IsNoInline = 1 << 6,
HasOptimizedDebugInfo = 1 << 7,
/// Duplicate copy of the above enum, but using the official CV names. Useful
/// for reference purposes and when dealing with unknown record types.
enum SymbolKind : uint16_t {
#define CV_SYMBOL(name, val) name = val,
#include "CVSymbolTypes.def"
};
// S_GPROC32, S_LPROC32, S_GPROC32_ID, S_LPROC32_ID, S_LPROC32_DPC or
@ -64,27 +48,10 @@ struct ProcSym {
TypeIndex FunctionType;
ulittle32_t CodeOffset;
ulittle16_t Segment;
uint8_t Flags; // CV_PROCFLAGS
uint8_t Flags; // ProcSymFlags enum
// Name: The null-terminated name follows.
};
enum BinaryAnnotationsOpCode : uint32_t {
Invalid,
CodeOffset,
ChangeCodeOffsetBase,
ChangeCodeOffset,
ChangeCodeLength,
ChangeFile,
ChangeLineOffset,
ChangeLineEndDelta,
ChangeRangeKind,
ChangeColumnStart,
ChangeColumnEndDelta,
ChangeCodeOffsetAndLineOffset,
ChangeCodeLengthAndCodeOffset,
ChangeColumnEnd,
};
// S_INLINESITE
struct InlineSiteSym {
ulittle32_t PtrParent;
@ -96,20 +63,7 @@ struct InlineSiteSym {
// S_LOCAL
struct LocalSym {
TypeIndex Type;
ulittle16_t Flags;
enum : uint16_t {
IsParameter = 1 << 0,
IsAddressTaken = 1 << 1,
IsCompilerGenerated = 1 << 2,
IsAggregate = 1 << 3,
IsAggregated = 1 << 4,
IsAliased = 1 << 5,
IsAlias = 1 << 6,
IsReturnValue = 1 << 7,
IsOptimizedOut = 1 << 8,
IsEnregisteredGlobal = 1 << 9,
IsEnregisteredStatic = 1 << 10,
};
ulittle16_t Flags; // LocalSymFlags enum
// Name: The null-terminated name follows.
};
@ -208,22 +162,8 @@ struct ObjNameSym {
// S_COMPILE3
struct CompileSym3 {
ulittle32_t flags;
ulittle32_t flags; // CompileSym3Flags enum
uint8_t getLanguage() const { return flags & 0xff; }
enum Flags : uint32_t {
EC = 1 << 8,
NoDbgInfo = 1 << 9,
LTCG = 1 << 10,
NoDataAlign = 1 << 11,
ManagedPresent = 1 << 12,
SecurityChecks = 1 << 13,
HotPatch = 1 << 14,
CVTCIL = 1 << 15,
MSILModule = 1 << 16,
Sdl = 1 << 17,
PGO = 1 << 18,
Exp = 1 << 19,
};
ulittle16_t Machine; // CPUType
ulittle16_t VersionFrontendMajor;
ulittle16_t VersionFrontendMinor;
@ -267,14 +207,7 @@ struct HeapAllocationSiteSym {
struct FrameCookieSym {
ulittle32_t CodeOffset;
ulittle16_t Register;
ulittle16_t CookieKind;
enum : uint16_t {
Copy,
XorStackPointer,
XorFramePointer,
XorR13,
};
ulittle32_t CookieKind;
};
// S_UDT, S_COBOLUDT

View File

@ -26,6 +26,22 @@ using llvm::support::little32_t;
using llvm::support::ulittle16_t;
using llvm::support::ulittle32_t;
/// Distinguishes individual records in .debug$T section or PDB type stream. The
/// documentation and headers talk about this as the "leaf" type.
enum class TypeRecordKind : uint16_t {
#define TYPE_RECORD(lf_ename, value, name) name = value,
#include "TypeRecords.def"
// FIXME: Add serialization support
FieldList = 0x1203,
BitField = 0x1205,
};
/// Duplicate copy of the above enum, but using the official CV names. Useful
/// for reference purposes and when dealing with unknown record types.
enum TypeLeafKind : uint16_t {
#define CV_TYPE(name, val) name = val,
#include "TypeRecords.def"
};
/// Equvalent to CV_fldattr_t in cvinfo.h.
struct MemberAttributes {

View File

@ -10,9 +10,10 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPERECORDBUILDER_H
#define LLVM_DEBUGINFO_CODEVIEW_TYPERECORDBUILDER_H
#include "llvm/ADT/SmallVector.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/raw_ostream.h"

View File

@ -11,10 +11,10 @@
#define LLVM_DEBUGINFO_CODEVIEW_TYPESTREAM_H
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/CodeView/RecordIterator.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/Support/Endian.h"
#include <cstdint>
#include <system_error>

View File

@ -379,7 +379,7 @@ void CodeViewDebug::emitInlinedCallSite(const FunctionInfo &FI,
OS.emitAbsoluteSymbolDiff(InlineEnd, InlineBegin, 2); // RecordLength
OS.EmitLabel(InlineBegin);
OS.AddComment("Record kind: S_INLINESITE");
OS.EmitIntValue(SymbolRecordKind::S_INLINESITE, 2); // RecordKind
OS.EmitIntValue(SymbolKind::S_INLINESITE, 2); // RecordKind
OS.AddComment("PtrParent");
OS.EmitIntValue(0, 4);
@ -413,7 +413,7 @@ void CodeViewDebug::emitInlinedCallSite(const FunctionInfo &FI,
OS.AddComment("Record length");
OS.EmitIntValue(2, 2); // RecordLength
OS.AddComment("Record kind: S_INLINESITE_END");
OS.EmitIntValue(SymbolRecordKind::S_INLINESITE_END, 2); // RecordKind
OS.EmitIntValue(SymbolKind::S_INLINESITE_END, 2); // RecordKind
}
void CodeViewDebug::emitDebugInfoForFunction(const Function *GV,
@ -447,7 +447,7 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV,
OS.EmitLabel(ProcRecordBegin);
OS.AddComment("Record kind: S_GPROC32_ID");
OS.EmitIntValue(unsigned(SymbolRecordKind::S_GPROC32_ID), 2);
OS.EmitIntValue(unsigned(SymbolKind::S_GPROC32_ID), 2);
// These fields are filled in by tools like CVPACK which run after the fact.
OS.AddComment("PtrParent");
@ -495,7 +495,7 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV,
OS.AddComment("Record length");
OS.EmitIntValue(0x0002, 2);
OS.AddComment("Record kind: S_PROC_ID_END");
OS.EmitIntValue(unsigned(SymbolRecordKind::S_PROC_ID_END), 2);
OS.EmitIntValue(unsigned(SymbolKind::S_PROC_ID_END), 2);
}
OS.EmitLabel(SymbolsEnd);
// Every subsection must be aligned to a 4-byte boundary.
@ -707,18 +707,18 @@ void CodeViewDebug::emitLocalVariable(const LocalVariable &Var) {
OS.EmitLabel(LocalBegin);
OS.AddComment("Record kind: S_LOCAL");
OS.EmitIntValue(unsigned(SymbolRecordKind::S_LOCAL), 2);
OS.EmitIntValue(unsigned(SymbolKind::S_LOCAL), 2);
uint16_t Flags = 0;
LocalSymFlags Flags = LocalSymFlags::None;
if (Var.DIVar->isParameter())
Flags |= LocalSym::IsParameter;
Flags |= LocalSymFlags::IsParameter;
if (Var.DefRanges.empty())
Flags |= LocalSym::IsOptimizedOut;
Flags |= LocalSymFlags::IsOptimizedOut;
OS.AddComment("TypeIndex");
OS.EmitIntValue(TypeIndex::Int32().getIndex(), 4);
OS.AddComment("Flags");
OS.EmitIntValue(Flags, 2);
OS.EmitIntValue(static_cast<uint16_t>(Flags), 2);
// Truncate the name so we won't overflow the record length field.
emitNullTerminatedSymbolName(OS, Var.DIVar->getName());
OS.EmitLabel(LocalEnd);

View File

@ -220,6 +220,11 @@ static bool compressAnnotation(uint32_t Data, SmallVectorImpl<char> &Buffer) {
return false;
}
static bool compressAnnotation(BinaryAnnotationsOpCode Annotation,
SmallVectorImpl<char> &Buffer) {
return compressAnnotation(static_cast<uint32_t>(Annotation), Buffer);
}
static uint32_t encodeSignedNumber(uint32_t Data) {
if (Data >> 31)
return ((-Data) << 1) | 1;
@ -302,7 +307,7 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout,
if (WithinFunction) {
unsigned Length =
computeLabelDiff(Layout, LastLoc->getLabel(), Loc.getLabel());
compressAnnotation(ChangeCodeLength, Buffer);
compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeLength, Buffer);
compressAnnotation(Length, Buffer);
}
WithinFunction = false;
@ -314,7 +319,7 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout,
// File ids are 1 based, and each file checksum table entry is 8 bytes
// long. See emitFileChecksums above.
unsigned FileOffset = 8 * (Loc.getFileNum() - 1);
compressAnnotation(ChangeFile, Buffer);
compressAnnotation(BinaryAnnotationsOpCode::ChangeFile, Buffer);
compressAnnotation(FileOffset, Buffer);
}
@ -326,20 +331,21 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout,
unsigned CodeDelta =
computeLabelDiff(Layout, LastLoc->getLabel(), Loc.getLabel());
if (CodeDelta == 0) {
compressAnnotation(ChangeLineOffset, Buffer);
compressAnnotation(BinaryAnnotationsOpCode::ChangeLineOffset, Buffer);
compressAnnotation(EncodedLineDelta, Buffer);
} else if (EncodedLineDelta < 0x8 && CodeDelta <= 0xf) {
// The ChangeCodeOffsetAndLineOffset combination opcode is used when the
// encoded line delta uses 3 or fewer set bits and the code offset fits
// in one nibble.
unsigned Operand = (EncodedLineDelta << 4) | CodeDelta;
compressAnnotation(ChangeCodeOffsetAndLineOffset, Buffer);
compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeOffsetAndLineOffset,
Buffer);
compressAnnotation(Operand, Buffer);
} else {
// Otherwise use the separate line and code deltas.
compressAnnotation(ChangeLineOffset, Buffer);
compressAnnotation(BinaryAnnotationsOpCode::ChangeLineOffset, Buffer);
compressAnnotation(EncodedLineDelta, Buffer);
compressAnnotation(ChangeCodeOffset, Buffer);
compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeOffset, Buffer);
compressAnnotation(CodeDelta, Buffer);
}
@ -362,7 +368,7 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout,
}
}
compressAnnotation(ChangeCodeLength, Buffer);
compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeLength, Buffer);
compressAnnotation(std::min(EndSymLength, LocAfterLength), Buffer);
}

View File

@ -425,19 +425,19 @@ WeakExternalCharacteristics[] = {
{ "Alias" , COFF::IMAGE_WEAK_EXTERN_SEARCH_ALIAS }
};
static const EnumEntry<CompileSym3::Flags> CompileSym3Flags[] = {
LLVM_READOBJ_ENUM_ENT(CompileSym3, EC),
LLVM_READOBJ_ENUM_ENT(CompileSym3, NoDbgInfo),
LLVM_READOBJ_ENUM_ENT(CompileSym3, LTCG),
LLVM_READOBJ_ENUM_ENT(CompileSym3, NoDataAlign),
LLVM_READOBJ_ENUM_ENT(CompileSym3, ManagedPresent),
LLVM_READOBJ_ENUM_ENT(CompileSym3, SecurityChecks),
LLVM_READOBJ_ENUM_ENT(CompileSym3, HotPatch),
LLVM_READOBJ_ENUM_ENT(CompileSym3, CVTCIL),
LLVM_READOBJ_ENUM_ENT(CompileSym3, MSILModule),
LLVM_READOBJ_ENUM_ENT(CompileSym3, Sdl),
LLVM_READOBJ_ENUM_ENT(CompileSym3, PGO),
LLVM_READOBJ_ENUM_ENT(CompileSym3, Exp),
static const EnumEntry<uint32_t> CompileSym3FlagNames[] = {
LLVM_READOBJ_ENUM_CLASS_ENT(CompileSym3Flags, EC),
LLVM_READOBJ_ENUM_CLASS_ENT(CompileSym3Flags, NoDbgInfo),
LLVM_READOBJ_ENUM_CLASS_ENT(CompileSym3Flags, LTCG),
LLVM_READOBJ_ENUM_CLASS_ENT(CompileSym3Flags, NoDataAlign),
LLVM_READOBJ_ENUM_CLASS_ENT(CompileSym3Flags, ManagedPresent),
LLVM_READOBJ_ENUM_CLASS_ENT(CompileSym3Flags, SecurityChecks),
LLVM_READOBJ_ENUM_CLASS_ENT(CompileSym3Flags, HotPatch),
LLVM_READOBJ_ENUM_CLASS_ENT(CompileSym3Flags, CVTCIL),
LLVM_READOBJ_ENUM_CLASS_ENT(CompileSym3Flags, MSILModule),
LLVM_READOBJ_ENUM_CLASS_ENT(CompileSym3Flags, Sdl),
LLVM_READOBJ_ENUM_CLASS_ENT(CompileSym3Flags, PGO),
LLVM_READOBJ_ENUM_CLASS_ENT(CompileSym3Flags, Exp),
};
static const EnumEntry<codeview::SourceLanguage> SourceLanguages[] = {
@ -538,15 +538,15 @@ static const EnumEntry<unsigned> CPUTypeNames[] = {
LLVM_READOBJ_ENUM_CLASS_ENT(CPUType, D3D11_Shader),
};
static const EnumEntry<uint8_t> ProcSymFlags[] = {
LLVM_READOBJ_ENUM_ENT(ProcFlags, HasFP),
LLVM_READOBJ_ENUM_ENT(ProcFlags, HasIRET),
LLVM_READOBJ_ENUM_ENT(ProcFlags, HasFRET),
LLVM_READOBJ_ENUM_ENT(ProcFlags, IsNoReturn),
LLVM_READOBJ_ENUM_ENT(ProcFlags, IsUnreachable),
LLVM_READOBJ_ENUM_ENT(ProcFlags, HasCustomCallingConv),
LLVM_READOBJ_ENUM_ENT(ProcFlags, IsNoInline),
LLVM_READOBJ_ENUM_ENT(ProcFlags, HasOptimizedDebugInfo),
static const EnumEntry<uint8_t> ProcSymFlagNames[] = {
LLVM_READOBJ_ENUM_CLASS_ENT(ProcSymFlags, HasFP),
LLVM_READOBJ_ENUM_CLASS_ENT(ProcSymFlags, HasIRET),
LLVM_READOBJ_ENUM_CLASS_ENT(ProcSymFlags, HasFRET),
LLVM_READOBJ_ENUM_CLASS_ENT(ProcSymFlags, IsNoReturn),
LLVM_READOBJ_ENUM_CLASS_ENT(ProcSymFlags, IsUnreachable),
LLVM_READOBJ_ENUM_CLASS_ENT(ProcSymFlags, HasCustomCallingConv),
LLVM_READOBJ_ENUM_CLASS_ENT(ProcSymFlags, IsNoInline),
LLVM_READOBJ_ENUM_CLASS_ENT(ProcSymFlags, HasOptimizedDebugInfo),
};
static const EnumEntry<uint32_t> FrameProcSymFlags[] = {
@ -582,24 +582,24 @@ static const EnumEntry<uint32_t> FrameDataFlags[] = {
};
static const EnumEntry<uint16_t> LocalFlags[] = {
LLVM_READOBJ_ENUM_ENT(LocalSym, IsParameter),
LLVM_READOBJ_ENUM_ENT(LocalSym, IsAddressTaken),
LLVM_READOBJ_ENUM_ENT(LocalSym, IsCompilerGenerated),
LLVM_READOBJ_ENUM_ENT(LocalSym, IsAggregate),
LLVM_READOBJ_ENUM_ENT(LocalSym, IsAggregated),
LLVM_READOBJ_ENUM_ENT(LocalSym, IsAliased),
LLVM_READOBJ_ENUM_ENT(LocalSym, IsAlias),
LLVM_READOBJ_ENUM_ENT(LocalSym, IsReturnValue),
LLVM_READOBJ_ENUM_ENT(LocalSym, IsOptimizedOut),
LLVM_READOBJ_ENUM_ENT(LocalSym, IsEnregisteredGlobal),
LLVM_READOBJ_ENUM_ENT(LocalSym, IsEnregisteredStatic),
LLVM_READOBJ_ENUM_CLASS_ENT(LocalSymFlags, IsParameter),
LLVM_READOBJ_ENUM_CLASS_ENT(LocalSymFlags, IsAddressTaken),
LLVM_READOBJ_ENUM_CLASS_ENT(LocalSymFlags, IsCompilerGenerated),
LLVM_READOBJ_ENUM_CLASS_ENT(LocalSymFlags, IsAggregate),
LLVM_READOBJ_ENUM_CLASS_ENT(LocalSymFlags, IsAggregated),
LLVM_READOBJ_ENUM_CLASS_ENT(LocalSymFlags, IsAliased),
LLVM_READOBJ_ENUM_CLASS_ENT(LocalSymFlags, IsAlias),
LLVM_READOBJ_ENUM_CLASS_ENT(LocalSymFlags, IsReturnValue),
LLVM_READOBJ_ENUM_CLASS_ENT(LocalSymFlags, IsOptimizedOut),
LLVM_READOBJ_ENUM_CLASS_ENT(LocalSymFlags, IsEnregisteredGlobal),
LLVM_READOBJ_ENUM_CLASS_ENT(LocalSymFlags, IsEnregisteredStatic),
};
static const EnumEntry<uint16_t> FrameCookieKinds[] = {
LLVM_READOBJ_ENUM_ENT(FrameCookieSym, Copy),
LLVM_READOBJ_ENUM_ENT(FrameCookieSym, XorStackPointer),
LLVM_READOBJ_ENUM_ENT(FrameCookieSym, XorFramePointer),
LLVM_READOBJ_ENUM_ENT(FrameCookieSym, XorR13),
static const EnumEntry<uint32_t> FrameCookieKinds[] = {
LLVM_READOBJ_ENUM_CLASS_ENT(FrameCookieKind, Copy),
LLVM_READOBJ_ENUM_CLASS_ENT(FrameCookieKind, XorStackPointer),
LLVM_READOBJ_ENUM_CLASS_ENT(FrameCookieKind, XorFramePointer),
LLVM_READOBJ_ENUM_CLASS_ENT(FrameCookieKind, XorR13),
};
static const EnumEntry<uint8_t> FileChecksumKindNames[] = {
@ -994,7 +994,7 @@ void COFFDumper::printCodeViewSymbolSection(StringRef SectionName,
void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection,
const SectionRef &Section,
StringRef SectionContents) {
if (Subsection.size() < sizeof(SymRecord))
if (Subsection.size() < sizeof(RecordPrefix))
return error(object_error::parse_failed);
const coff_section *Sec = Obj->getCOFFSection(Section);
@ -1004,15 +1004,15 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection,
bool InFunctionScope = false;
while (!Data.empty()) {
const SymRecord *Rec;
const RecordPrefix *Rec;
error(consumeObject(Data, Rec));
StringRef SymData = Data.substr(0, Rec->RecordLength - 2);
StringRef SymData = Data.substr(0, Rec->RecordLen - 2);
StringRef OrigSymData = SymData;
Data = Data.drop_front(Rec->RecordLength - 2);
Data = Data.drop_front(Rec->RecordLen - 2);
SymbolRecordKind Kind = Rec->getKind();
SymbolKind Kind = static_cast<SymbolKind>(uint16_t(Rec->RecordKind));
switch (Kind) {
case S_LPROC32:
case S_GPROC32:
@ -1039,7 +1039,7 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection,
printRelocatedField("CodeOffset", Sec, SectionContents, &Proc->CodeOffset,
&LinkageName);
W.printHex("Segment", Proc->Segment);
W.printFlags("Flags", Proc->Flags, makeArrayRef(ProcSymFlags));
W.printFlags("Flags", Proc->Flags, makeArrayRef(ProcSymFlagNames));
W.printString("DisplayName", DisplayName);
W.printString("LinkageName", LinkageName);
break;
@ -1086,7 +1086,7 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection,
&Label->CodeOffset, &LinkageName);
W.printHex("Segment", Label->Segment);
W.printHex("Flags", Label->Flags);
W.printFlags("Flags", Label->Flags, makeArrayRef(ProcSymFlags));
W.printFlags("Flags", Label->Flags, makeArrayRef(ProcSymFlagNames));
W.printString("DisplayName", DisplayName);
W.printString("LinkageName", LinkageName);
break;
@ -1145,44 +1145,45 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection,
ListScope BinaryAnnotations(W, "BinaryAnnotations");
while (!SymData.empty()) {
uint32_t OpCode = GetCompressedAnnotation();
auto OpCode =
static_cast<BinaryAnnotationsOpCode>(GetCompressedAnnotation());
switch (OpCode) {
default:
case Invalid:
case BinaryAnnotationsOpCode::Invalid:
return error(object_error::parse_failed);
case CodeOffset:
case BinaryAnnotationsOpCode::CodeOffset:
W.printHex("CodeOffset", GetCompressedAnnotation());
break;
case ChangeCodeOffsetBase:
case BinaryAnnotationsOpCode::ChangeCodeOffsetBase:
W.printNumber("ChangeCodeOffsetBase", GetCompressedAnnotation());
break;
case ChangeCodeOffset:
case BinaryAnnotationsOpCode::ChangeCodeOffset:
W.printHex("ChangeCodeOffset", GetCompressedAnnotation());
break;
case ChangeCodeLength:
case BinaryAnnotationsOpCode::ChangeCodeLength:
W.printHex("ChangeCodeLength", GetCompressedAnnotation());
break;
case ChangeFile:
case BinaryAnnotationsOpCode::ChangeFile:
printFileNameForOffset("ChangeFile", GetCompressedAnnotation());
break;
case ChangeLineOffset:
case BinaryAnnotationsOpCode::ChangeLineOffset:
W.printNumber("ChangeLineOffset",
DecodeSignedOperand(GetCompressedAnnotation()));
break;
case ChangeLineEndDelta:
case BinaryAnnotationsOpCode::ChangeLineEndDelta:
W.printNumber("ChangeLineEndDelta", GetCompressedAnnotation());
break;
case ChangeRangeKind:
case BinaryAnnotationsOpCode::ChangeRangeKind:
W.printNumber("ChangeRangeKind", GetCompressedAnnotation());
break;
case ChangeColumnStart:
case BinaryAnnotationsOpCode::ChangeColumnStart:
W.printNumber("ChangeColumnStart", GetCompressedAnnotation());
break;
case ChangeColumnEndDelta:
case BinaryAnnotationsOpCode::ChangeColumnEndDelta:
W.printNumber("ChangeColumnEndDelta",
DecodeSignedOperand(GetCompressedAnnotation()));
break;
case ChangeCodeOffsetAndLineOffset: {
case BinaryAnnotationsOpCode::ChangeCodeOffsetAndLineOffset: {
uint32_t Annotation = GetCompressedAnnotation();
int32_t LineOffset = DecodeSignedOperand(Annotation >> 4);
uint32_t CodeOffset = Annotation & 0xf;
@ -1191,7 +1192,7 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection,
<< "}\n";
break;
}
case ChangeCodeLengthAndCodeOffset: {
case BinaryAnnotationsOpCode::ChangeCodeLengthAndCodeOffset: {
uint32_t Length = GetCompressedAnnotation();
uint32_t CodeOffset = GetCompressedAnnotation();
W.startLine() << "ChangeCodeLengthAndCodeOffset: {CodeOffset: "
@ -1199,7 +1200,7 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection,
<< "}\n";
break;
}
case ChangeColumnEnd:
case BinaryAnnotationsOpCode::ChangeColumnEnd:
W.printNumber("ChangeColumnEnd", GetCompressedAnnotation());
break;
}
@ -1416,7 +1417,7 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection,
W.printEnum("Language", CompFlags->getLanguage(),
makeArrayRef(SourceLanguages));
W.printFlags("Flags", CompFlags->flags & ~0xff,
makeArrayRef(CompileSym3Flags));
makeArrayRef(CompileSym3FlagNames));
W.printEnum("Machine", unsigned(CompFlags->Machine),
makeArrayRef(CPUTypeNames));
std::string FrontendVersion;
@ -1516,7 +1517,7 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection,
default: {
DictScope S(W, "UnknownSym");
W.printHex("Kind", unsigned(Kind));
W.printHex("Size", Rec->RecordLength);
W.printHex("Size", Rec->RecordLen);
break;
}
}