diff options
| -rw-r--r-- | llvm/include/llvm/DebugInfo/CodeView/CodeView.h | 10 | ||||
| -rw-r--r-- | llvm/include/llvm/DebugInfo/CodeView/EnumTables.h | 1 | ||||
| -rw-r--r-- | llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h | 2 | ||||
| -rw-r--r-- | llvm/lib/DebugInfo/CodeView/EnumTables.cpp | 10 | ||||
| -rw-r--r-- | llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp | 11 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/PDB/pdbdump-headers.test | 4 | ||||
| -rw-r--r-- | llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp | 16 | 
9 files changed, 51 insertions, 7 deletions
diff --git a/llvm/include/llvm/DebugInfo/CodeView/CodeView.h b/llvm/include/llvm/DebugInfo/CodeView/CodeView.h index 6820e26b754..b7a7e33abad 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/CodeView.h +++ b/llvm/include/llvm/DebugInfo/CodeView/CodeView.h @@ -402,6 +402,16 @@ enum class LocalSymFlags : uint16_t {  };  CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(LocalSymFlags) +/// Corresponds to the CV_PUBSYMFLAGS bitfield. +enum class PublicSymFlags : uint32_t { +  None = 0, +  Code = 1 << 0, +  Function = 1 << 1, +  Managed = 1 << 2, +  MSIL = 1 << 3, +}; +CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(PublicSymFlags) +  /// Corresponds to the CV_PROCFLAGS bitfield.  enum class ProcSymFlags : uint8_t {    None = 0, diff --git a/llvm/include/llvm/DebugInfo/CodeView/EnumTables.h b/llvm/include/llvm/DebugInfo/CodeView/EnumTables.h index 013e440613f..5d54bb4cca8 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/EnumTables.h +++ b/llvm/include/llvm/DebugInfo/CodeView/EnumTables.h @@ -22,6 +22,7 @@ namespace codeview {  ArrayRef<EnumEntry<SymbolKind>> getSymbolTypeNames();  ArrayRef<EnumEntry<TypeLeafKind>> getTypeLeafNames();  ArrayRef<EnumEntry<uint16_t>> getRegisterNames(); +ArrayRef<EnumEntry<uint32_t>> getPublicSymFlagNames();  ArrayRef<EnumEntry<uint8_t>> getProcSymFlagNames();  ArrayRef<EnumEntry<uint16_t>> getLocalFlagNames();  ArrayRef<EnumEntry<uint8_t>> getFrameCookieKindNames(); diff --git a/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h b/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h index 5f85ed28cb3..1cf77fcdecb 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h +++ b/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h @@ -363,7 +363,7 @@ public:        : SymbolRecord(SymbolRecordKind::PublicSym32),          RecordOffset(RecordOffset) {} -  TypeIndex Index; +  PublicSymFlags Flags;    uint32_t Offset;    uint16_t Segment;    StringRef Name; diff --git a/llvm/lib/DebugInfo/CodeView/EnumTables.cpp b/llvm/lib/DebugInfo/CodeView/EnumTables.cpp index 01d8ccf2d31..ec00af28395 100644 --- a/llvm/lib/DebugInfo/CodeView/EnumTables.cpp +++ b/llvm/lib/DebugInfo/CodeView/EnumTables.cpp @@ -82,6 +82,13 @@ static const EnumEntry<uint16_t> RegisterNames[] = {      CV_ENUM_CLASS_ENT(RegisterId, R15),  }; +static const EnumEntry<uint32_t> PublicSymFlagNames[] = { +    CV_ENUM_CLASS_ENT(PublicSymFlags, Code), +    CV_ENUM_CLASS_ENT(PublicSymFlags, Function), +    CV_ENUM_CLASS_ENT(PublicSymFlags, Managed), +    CV_ENUM_CLASS_ENT(PublicSymFlags, MSIL), +}; +  static const EnumEntry<uint8_t> ProcSymFlagNames[] = {      CV_ENUM_CLASS_ENT(ProcSymFlags, HasFP),      CV_ENUM_CLASS_ENT(ProcSymFlags, HasIRET), @@ -338,6 +345,9 @@ ArrayRef<EnumEntry<uint16_t>> getRegisterNames() {    return makeArrayRef(RegisterNames);  } +ArrayRef<EnumEntry<uint32_t>> getPublicSymFlagNames() { +  return makeArrayRef(PublicSymFlagNames); +}  ArrayRef<EnumEntry<uint8_t>> getProcSymFlagNames() {    return makeArrayRef(ProcSymFlagNames);  } diff --git a/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp b/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp index 36abafc079e..b9fa9b6a6ad 100644 --- a/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp +++ b/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp @@ -524,7 +524,7 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,  Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, PublicSym32 &Public) {    DictScope S(W, "PublicSym"); -  printTypeIndex("Type", Public.Index); +  W.printFlags("Flags", uint32_t(Public.Flags), getPublicSymFlagNames());    W.printNumber("Seg", Public.Segment);    W.printNumber("Off", Public.Offset);    W.printString("Name", Public.Name); diff --git a/llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp b/llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp index d731dc1b0a3..923837a45d9 100644 --- a/llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp +++ b/llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp @@ -361,7 +361,7 @@ Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,  Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,                                              PublicSym32 &Public) { -  error(IO.mapInteger(Public.Index)); +  error(IO.mapEnum(Public.Flags));    error(IO.mapInteger(Public.Offset));    error(IO.mapInteger(Public.Segment));    error(IO.mapStringZ(Public.Name)); diff --git a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp index ba3a2abe209..2f78676c6c8 100644 --- a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp +++ b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp @@ -40,6 +40,7 @@ LLVM_YAML_DECLARE_ENUM_TRAITS(FrameCookieKind)  LLVM_YAML_DECLARE_BITSET_TRAITS(CompileSym2Flags)  LLVM_YAML_DECLARE_BITSET_TRAITS(CompileSym3Flags)  LLVM_YAML_DECLARE_BITSET_TRAITS(ExportFlags) +LLVM_YAML_DECLARE_BITSET_TRAITS(PublicSymFlags)  LLVM_YAML_DECLARE_BITSET_TRAITS(LocalSymFlags)  LLVM_YAML_DECLARE_BITSET_TRAITS(ProcSymFlags)  LLVM_YAML_DECLARE_BITSET_TRAITS(FrameProcedureOptions) @@ -93,6 +94,14 @@ void ScalarBitSetTraits<ExportFlags>::bitset(IO &io, ExportFlags &Flags) {    }  } +void ScalarBitSetTraits<PublicSymFlags>::bitset(IO &io, PublicSymFlags &Flags) { +  auto FlagNames = getProcSymFlagNames(); +  for (const auto &E : FlagNames) { +    io.bitSetCase(Flags, E.Name.str().c_str(), +                  static_cast<PublicSymFlags>(E.Value)); +  } +} +  void ScalarBitSetTraits<LocalSymFlags>::bitset(IO &io, LocalSymFlags &Flags) {    auto FlagNames = getLocalFlagNames();    for (const auto &E : FlagNames) { @@ -298,7 +307,7 @@ template <> void SymbolRecordImpl<RegisterSym>::map(IO &IO) {  }  template <> void SymbolRecordImpl<PublicSym32>::map(IO &IO) { -  IO.mapRequired("Type", Symbol.Index); +  IO.mapRequired("Flags", Symbol.Flags);    IO.mapRequired("Seg", Symbol.Segment);    IO.mapRequired("Off", Symbol.Offset);    IO.mapRequired("Name", Symbol.Name); diff --git a/llvm/test/DebugInfo/PDB/pdbdump-headers.test b/llvm/test/DebugInfo/PDB/pdbdump-headers.test index fa9a25108fa..afedbb5c257 100644 --- a/llvm/test/DebugInfo/PDB/pdbdump-headers.test +++ b/llvm/test/DebugInfo/PDB/pdbdump-headers.test @@ -458,9 +458,9 @@ ALL:        Hash Adjusters:  ALL:                             Public Symbols  ALL-NEXT: ============================================================  ALL-NEXT:   - S_PUB32 [size = 36] `?__purecall@@3PAXA` -ALL-NEXT:       type = <no type>, addr = 0003:0000 +ALL-NEXT:       flags = none, addr = 0003:0000  ALL-NEXT:   - S_PUB32 [size = 20] `_main` -ALL-NEXT:       type = 0x0002 (<unknown simple type>), addr = 0001:0016 +ALL-NEXT:       flags = function, addr = 0001:0016  ALL-NEXT:   - S_PROCREF [size = 20] `main`  ALL-NEXT:       module = 1, sum name = 0, offset = 120  ALL-NEXT:   - S_GDATA32 [size = 28] `__purecall` diff --git a/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp b/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp index 8b36de0b715..7f5412d5988 100644 --- a/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp +++ b/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp @@ -146,6 +146,19 @@ static std::string formatFrameProcedureOptions(uint32_t IndentLevel,    return typesetItemList(Opts, 4, IndentLevel, " | ");  } +static std::string formatPublicSymFlags(uint32_t IndentLevel, +                                        PublicSymFlags Flags) { +  std::vector<std::string> Opts; +  if (Flags == PublicSymFlags::None) +    return "none"; + +  PUSH_FLAG(PublicSymFlags, Code, Flags, "code"); +  PUSH_FLAG(PublicSymFlags, Function, Flags, "function"); +  PUSH_FLAG(PublicSymFlags, Managed, Flags, "managed"); +  PUSH_FLAG(PublicSymFlags, MSIL, Flags, "msil"); +  return typesetItemList(Opts, 4, IndentLevel, " | "); +} +  static std::string formatProcSymFlags(uint32_t IndentLevel,                                        ProcSymFlags Flags) {    std::vector<std::string> Opts; @@ -659,7 +672,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,                                              PublicSym32 &Public) {    P.format(" `{0}`", Public.Name);    AutoIndent Indent(P); -  P.formatLine("type = {0}, addr = {1}", typeIndex(Public.Index), +  P.formatLine("flags = {0}, addr = {1}", +               formatPublicSymFlags(P.getIndentLevel() + 9, Public.Flags),                 formatSegmentOffset(Public.Segment, Public.Offset));    return Error::success();  }  | 

