[llvm] [CodeView] Read and dump `S_ASSOCIATION` (PR #221034)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 07:10:50 PDT 2026


https://github.com/Nerixyz updated https://github.com/llvm/llvm-project/pull/221034

>From aade81281eec4e67fc206715b10e167d47974d35 Mon Sep 17 00:00:00 2001
From: Nerixyz <nerixdev at outlook.de>
Date: Thu, 3 Sep 2026 21:07:56 +0200
Subject: [PATCH 1/3] [CodeView] Read and dump `S_ASSOCIATION`

---
 .../llvm/DebugInfo/CodeView/CodeView.h        |  9 +++
 .../DebugInfo/CodeView/CodeViewSymbols.def    |  3 +-
 .../llvm/DebugInfo/CodeView/EnumTables.h      |  1 +
 .../llvm/DebugInfo/CodeView/SymbolRecord.h    | 20 +++++
 llvm/lib/DebugInfo/CodeView/EnumTables.cpp    | 10 +++
 llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp  | 10 +++
 .../CodeView/SymbolRecordMapping.cpp          |  9 +++
 .../DebugInfo/CodeView/TypeIndexDiscovery.cpp |  1 +
 llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp   | 16 ++++
 .../tools/llvm-pdbutil/s-association.yaml     | 77 +++++++++++++++++++
 .../llvm-pdbutil/MinimalSymbolDumper.cpp      | 17 ++++
 11 files changed, 172 insertions(+), 1 deletion(-)
 create mode 100644 llvm/test/tools/llvm-pdbutil/s-association.yaml

diff --git a/llvm/include/llvm/DebugInfo/CodeView/CodeView.h b/llvm/include/llvm/DebugInfo/CodeView/CodeView.h
index 7a1008689296d..e65d50cb8155a 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/CodeView.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/CodeView.h
@@ -619,6 +619,15 @@ enum class JumpTableEntrySize : uint16_t {
   Int8ShiftLeft = 9,
   Int16ShiftLeft = 10,
 };
+
+/// Type of associated symbol in S_ASSOCIATION.
+///
+/// From `CV_AssociationKind_e` (cvconst.h).
+enum class AssociationKind : uint16_t {
+  None,
+  /// Associated symbol is the primary coroutine function.
+  Coroutine,
+};
 }
 }
 
diff --git a/llvm/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def b/llvm/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def
index 9a3712f78fa50..55c92c42e2e3f 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def
+++ b/llvm/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def
@@ -195,7 +195,6 @@ CV_SYMBOL(S_BPREL32_ENCTMP, 0x1178)
 CV_SYMBOL(S_REGREL32_ENCTMP, 0x1179)
 CV_SYMBOL(S_BPREL32_INDIR_ENCTMP, 0x117a)
 CV_SYMBOL(S_REGREL32_INDIR_ENCTMP, 0x117b)
-CV_SYMBOL(S_ASSOCIATION, 0x117c)
 CV_SYMBOL(S_SOURCELINK, 0x117e)
 CV_SYMBOL(S_DEFRANGE_CONSTVAL_ON_ENTRY, 0x117f)
 CV_SYMBOL(S_DEFRANGE_GLOBALSYM_ON_ENTRY, 0x1180)
@@ -277,6 +276,8 @@ SYMBOL_RECORD(S_ANNOTATION    , 0x1019, AnnotationSym)
 
 SYMBOL_RECORD(S_HOTPATCHFUNC  , 0x1169, HotPatchFuncSym)
 
+SYMBOL_RECORD(S_ASSOCIATION, 0x117c, AssociationSym)
+
 #undef CV_SYMBOL
 #undef SYMBOL_RECORD
 #undef SYMBOL_RECORD_ALIAS
diff --git a/llvm/include/llvm/DebugInfo/CodeView/EnumTables.h b/llvm/include/llvm/DebugInfo/CodeView/EnumTables.h
index 0dfa3d5b0942a..3f5bdeba54431 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/EnumTables.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/EnumTables.h
@@ -49,6 +49,7 @@ LLVM_ABI EnumStrings<uint8_t, 1> getCallingConventions();
 LLVM_ABI EnumStrings<uint8_t, 1> getFunctionOptionEnum();
 LLVM_ABI EnumStrings<uint16_t, 1> getLabelTypeEnum();
 LLVM_ABI EnumStrings<uint16_t, 1> getJumpTableEntrySizeNames();
+LLVM_ABI EnumStrings<uint16_t, 1> getAssociationKindNames();
 
 } // end namespace codeview
 } // end namespace llvm
diff --git a/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h b/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h
index 9652e71b19e61..310b959a50fd3 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h
@@ -1098,6 +1098,26 @@ class AnnotationSym : public SymbolRecord {
   uint32_t RecordOffset = 0;
 };
 
+/// `S_ASSOCIATION` - Associates a symbol with another one.
+///
+/// For coroutines, the associated symbol is the primary coroutine function in
+/// case this symbol is contained in an init/resume/destroy coroutine. It's also
+/// present in the primary coroutine function where it points to one of the
+/// generated init/resume/destroy symbols.
+class AssociationSym : public SymbolRecord {
+public:
+  explicit AssociationSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
+  explicit AssociationSym(uint32_t RecordOffset)
+      : SymbolRecord(SymbolRecordKind::AssociationSym),
+        RecordOffset(RecordOffset) {}
+
+  AssociationKind AssociationKind = AssociationKind::None;
+  uint32_t CodeOffset = 0;
+  uint16_t Segment = 0;
+
+  uint32_t RecordOffset = 0;
+};
+
 LLVM_ABI Expected<CVSymbol> readSymbolFromStream(BinaryStreamRef Stream,
                                                  uint32_t Offset);
 
diff --git a/llvm/lib/DebugInfo/CodeView/EnumTables.cpp b/llvm/lib/DebugInfo/CodeView/EnumTables.cpp
index 383922d5c6ff7..318867733e6b2 100644
--- a/llvm/lib/DebugInfo/CodeView/EnumTables.cpp
+++ b/llvm/lib/DebugInfo/CodeView/EnumTables.cpp
@@ -622,5 +622,15 @@ EnumStrings<uint16_t> getJumpTableEntrySizeNames() {
   return JumpTableEntrySizeNames;
 }
 
+EnumStrings<uint16_t> getAssociationKindNames() {
+  constexpr EnumStringDef<uint16_t> AssociationKindNameDefs[] = {
+      CV_ENUM_CLASS_ENT(AssociationKind, None),
+      CV_ENUM_CLASS_ENT(AssociationKind, Coroutine),
+  };
+  static constexpr auto AssociationKindNames =
+      BUILD_ENUM_STRINGS(AssociationKindNameDefs);
+  return AssociationKindNames;
+}
+
 } // end namespace codeview
 } // end namespace llvm
diff --git a/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp b/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
index cb6e2089b8d1d..50a7ca8164542 100644
--- a/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
+++ b/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
@@ -706,6 +706,16 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
   return Error::success();
 }
 
+Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
+                                           AssociationSym &Assoc) {
+  W.printEnum("AssociationKind", static_cast<uint16_t>(Assoc.AssociationKind),
+              getAssociationKindNames());
+  W.printHex("Offset", Assoc.CodeOffset);
+  W.printHex("Segment", Assoc.Segment);
+
+  return Error::success();
+}
+
 Error CVSymbolDumperImpl::visitUnknownSymbol(CVSymbol &CVR) {
   W.printNumber("Length", CVR.length());
   return Error::success();
diff --git a/llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp b/llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp
index ecb279b59fb38..55f7088999a79 100644
--- a/llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp
+++ b/llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp
@@ -600,3 +600,12 @@ EncodedFramePtrReg codeview::encodeFramePtrReg(RegisterId Reg, CPUType CPU) {
   }
   return EncodedFramePtrReg::None;
 }
+
+Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
+                                            AssociationSym &Assoc) {
+  error(IO.mapEnum(Assoc.AssociationKind));
+  error(IO.mapInteger(Assoc.CodeOffset));
+  error(IO.mapInteger(Assoc.Segment));
+
+  return Error::success();
+}
diff --git a/llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp b/llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp
index c19e72187fc9c..745c53a8de32a 100644
--- a/llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp
+++ b/llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp
@@ -445,6 +445,7 @@ static bool discoverTypeIndices(ArrayRef<uint8_t> Content, SymbolKind Kind,
   case SymbolKind::S_FRAMECOOKIE:
   case SymbolKind::S_UNAMESPACE:
   case SymbolKind::S_ARMSWITCHTABLE:
+  case SymbolKind::S_ASSOCIATION:
     break;
   // Scope ending symbols.
   case SymbolKind::S_END:
diff --git a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
index b985adaea9cee..52fbd905b04c8 100644
--- a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
+++ b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
@@ -62,6 +62,7 @@ LLVM_YAML_DECLARE_ENUM_TRAITS(RegisterId)
 LLVM_YAML_DECLARE_ENUM_TRAITS(TrampolineType)
 LLVM_YAML_DECLARE_ENUM_TRAITS(ThunkOrdinal)
 LLVM_YAML_DECLARE_ENUM_TRAITS(JumpTableEntrySize)
+LLVM_YAML_DECLARE_ENUM_TRAITS(AssociationKind)
 
 LLVM_YAML_STRONG_TYPEDEF(StringRef, TypeName)
 
@@ -206,6 +207,15 @@ void ScalarEnumerationTraits<JumpTableEntrySize>::enumeration(
   }
 }
 
+void ScalarEnumerationTraits<AssociationKind>::enumeration(
+    IO &IO, AssociationKind &Kind) {
+  auto Names = getAssociationKindNames();
+  for (const auto &E : Names)
+    IO.enumCase(Kind, E.name(), static_cast<AssociationKind>(E.value()));
+
+  IO.enumFallback<Hex16>(Kind);
+}
+
 namespace llvm {
 namespace yaml {
 template <> struct MappingTraits<LocalVariableAddrRange> {
@@ -616,6 +626,12 @@ template <> void SymbolRecordImpl<HotPatchFuncSym>::map(IO &IO) {
   IO.mapRequired("Name", Symbol.Name);
 }
 
+template <> void SymbolRecordImpl<AssociationSym>::map(IO &IO) {
+  IO.mapRequired("AssociationKind", Symbol.AssociationKind);
+  IO.mapOptional("Segment", Symbol.Segment, uint16_t(0));
+  IO.mapOptional("Offset", Symbol.CodeOffset, 0U);
+}
+
 } // end namespace detail
 } // end namespace CodeViewYAML
 } // end namespace llvm
diff --git a/llvm/test/tools/llvm-pdbutil/s-association.yaml b/llvm/test/tools/llvm-pdbutil/s-association.yaml
new file mode 100644
index 0000000000000..1f2fbccab81ca
--- /dev/null
+++ b/llvm/test/tools/llvm-pdbutil/s-association.yaml
@@ -0,0 +1,77 @@
+# RUN: llvm-pdbutil yaml2pdb %s --pdb=%t.pdb
+# RUN: llvm-pdbutil dump --symbols --sym-data %t.pdb | FileCheck --check-prefix=YAML2PDB %s
+
+# RUN: llvm-pdbutil pdb2yaml --module-syms %t.pdb > %t.yaml
+# RUN: FileCheck --input-file=%t.yaml --check-prefix=PDB2YAML %s
+
+# YAML2PDB:       Mod 0000 | `/tmp/test.obj`: 
+# YAML2PDB-NEXT:       4 | S_ASSOCIATION [size = 12]
+# YAML2PDB-NEXT:           kind = coroutine, addr = 0001:0000
+# YAML2PDB-NEXT:           bytes (
+# YAML2PDB-NEXT:             0000: 01000000 00000100                                                        |........|
+# YAML2PDB-NEXT:           )
+# YAML2PDB-NEXT:      16 | S_ASSOCIATION [size = 12]
+# YAML2PDB-NEXT:           kind = unknown (987), addr = 0002:1234
+# YAML2PDB-NEXT:           bytes (
+# YAML2PDB-NEXT:             0000: DB03D204 00000200                                                        |........|
+# YAML2PDB-NEXT:           )
+# YAML2PDB-NEXT:      28 | S_ASSOCIATION [size = 12]
+# YAML2PDB-NEXT:           kind = none, addr = 1234:0042
+# YAML2PDB-NEXT:           bytes (
+# YAML2PDB-NEXT:             0000: 00002A00 0000D204                                                        |..*.....|
+# YAML2PDB-NEXT:           )
+
+# PDB2YAML:      DbiStream:
+# PDB2YAML:        Modules:
+# PDB2YAML:          - Module:          '/tmp/test.obj'
+# PDB2YAML:            Modi:
+# PDB2YAML-NEXT:         Signature:       4
+# PDB2YAML-NEXT:         Records:
+# PDB2YAML-NEXT:           - Kind:            S_ASSOCIATION
+# PDB2YAML-NEXT:             AssociationSym:
+# PDB2YAML-NEXT:               AssociationKind: Coroutine
+# PDB2YAML-NEXT:               Segment:         1
+# PDB2YAML-NEXT:               Offset:          0
+# PDB2YAML-NEXT:           - Kind:            S_ASSOCIATION
+# PDB2YAML-NEXT:             AssociationSym:
+# PDB2YAML-NEXT:               AssociationKind: 0x3DB
+# PDB2YAML-NEXT:               Segment:         2
+# PDB2YAML-NEXT:               Offset:          1234
+# PDB2YAML-NEXT:           - Kind:            S_ASSOCIATION
+# PDB2YAML-NEXT:             AssociationSym:
+# PDB2YAML-NEXT:               AssociationKind: None
+# PDB2YAML-NEXT:               Segment:         1234
+# PDB2YAML-NEXT:               Offset:          42
+
+---
+DbiStream:
+  VerHeader:       V70
+  Age:             1
+  BuildNumber:     36363
+  PdbDllVersion:   0
+  PdbDllRbld:      0
+  Flags:           0
+  MachineType:     Amd64
+  Modules:
+    - Module:          '/tmp/test.obj'
+      ObjFile:         '/tmp/test.obj'
+      SourceFiles:
+        - '/tmp/test.cpp'
+      Modi:
+        Signature:       4
+        Records:
+          - Kind:            S_ASSOCIATION
+            AssociationSym:
+              AssociationKind: Coroutine
+              Segment:         1
+              Offset:          0
+          - Kind:            S_ASSOCIATION
+            AssociationSym:
+              AssociationKind: 987
+              Segment:         2
+              Offset:          1234
+          - Kind:            S_ASSOCIATION
+            AssociationSym:
+              AssociationKind: 0
+              Segment:         1234
+              Offset:          42
diff --git a/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp b/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
index 291d117a79539..9241ccc132f78 100644
--- a/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
+++ b/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
@@ -379,6 +379,14 @@ static std::string formatJumpTableEntrySize(JumpTableEntrySize EntrySize) {
   return formatUnknownEnum(EntrySize);
 }
 
+static std::string formatAssociationKind(AssociationKind Kind) {
+  switch (Kind) {
+    RETURN_CASE(AssociationKind, None, "none");
+    RETURN_CASE(AssociationKind, Coroutine, "coroutine");
+  }
+  return formatUnknownEnum(Kind);
+}
+
 Error MinimalSymbolDumper::visitSymbolBegin(codeview::CVSymbol &Record) {
   return visitSymbolBegin(Record, 0);
 }
@@ -997,3 +1005,12 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
                JumpTable.Name);
   return Error::success();
 }
+
+Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
+                                            AssociationSym &Assoc) {
+  AutoIndent Indent(P, 7);
+  P.formatLine("kind = {0}, addr = {1}",
+               formatAssociationKind(Assoc.AssociationKind),
+               formatSegmentOffset(Assoc.Segment, Assoc.CodeOffset));
+  return Error::success();
+}

>From e1f4cfcb8cd0fd5ad6fbc3770fa82fcfc350a301 Mon Sep 17 00:00:00 2001
From: Nerixyz <nerixdev at outlook.de>
Date: Wed, 9 Sep 2026 18:26:26 +0200
Subject: [PATCH 2/3] fix: `AssociationKind` -> `AssocKind`

---
 llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h |  2 +-
 llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp        |  2 +-
 llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp |  2 +-
 llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp         |  2 +-
 llvm/test/tools/llvm-pdbutil/s-association.yaml     | 12 ++++++------
 llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp     |  3 +--
 6 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h b/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h
index 310b959a50fd3..49e05dca80ff0 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h
@@ -1111,7 +1111,7 @@ class AssociationSym : public SymbolRecord {
       : SymbolRecord(SymbolRecordKind::AssociationSym),
         RecordOffset(RecordOffset) {}
 
-  AssociationKind AssociationKind = AssociationKind::None;
+  AssociationKind AssocKind = AssociationKind::None;
   uint32_t CodeOffset = 0;
   uint16_t Segment = 0;
 
diff --git a/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp b/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
index 50a7ca8164542..df1018381edd4 100644
--- a/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
+++ b/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
@@ -708,7 +708,7 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
 
 Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
                                            AssociationSym &Assoc) {
-  W.printEnum("AssociationKind", static_cast<uint16_t>(Assoc.AssociationKind),
+  W.printEnum("AssocKind", static_cast<uint16_t>(Assoc.AssocKind),
               getAssociationKindNames());
   W.printHex("Offset", Assoc.CodeOffset);
   W.printHex("Segment", Assoc.Segment);
diff --git a/llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp b/llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp
index 55f7088999a79..a773872e8b306 100644
--- a/llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp
+++ b/llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp
@@ -603,7 +603,7 @@ EncodedFramePtrReg codeview::encodeFramePtrReg(RegisterId Reg, CPUType CPU) {
 
 Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
                                             AssociationSym &Assoc) {
-  error(IO.mapEnum(Assoc.AssociationKind));
+  error(IO.mapEnum(Assoc.AssocKind));
   error(IO.mapInteger(Assoc.CodeOffset));
   error(IO.mapInteger(Assoc.Segment));
 
diff --git a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
index 52fbd905b04c8..9dc8ab7f801e6 100644
--- a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
+++ b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
@@ -627,7 +627,7 @@ template <> void SymbolRecordImpl<HotPatchFuncSym>::map(IO &IO) {
 }
 
 template <> void SymbolRecordImpl<AssociationSym>::map(IO &IO) {
-  IO.mapRequired("AssociationKind", Symbol.AssociationKind);
+  IO.mapRequired("AssocKind", Symbol.AssocKind);
   IO.mapOptional("Segment", Symbol.Segment, uint16_t(0));
   IO.mapOptional("Offset", Symbol.CodeOffset, 0U);
 }
diff --git a/llvm/test/tools/llvm-pdbutil/s-association.yaml b/llvm/test/tools/llvm-pdbutil/s-association.yaml
index 1f2fbccab81ca..eb6007fe72336 100644
--- a/llvm/test/tools/llvm-pdbutil/s-association.yaml
+++ b/llvm/test/tools/llvm-pdbutil/s-association.yaml
@@ -29,17 +29,17 @@
 # PDB2YAML-NEXT:         Records:
 # PDB2YAML-NEXT:           - Kind:            S_ASSOCIATION
 # PDB2YAML-NEXT:             AssociationSym:
-# PDB2YAML-NEXT:               AssociationKind: Coroutine
+# PDB2YAML-NEXT:               AssocKind:       Coroutine
 # PDB2YAML-NEXT:               Segment:         1
 # PDB2YAML-NEXT:               Offset:          0
 # PDB2YAML-NEXT:           - Kind:            S_ASSOCIATION
 # PDB2YAML-NEXT:             AssociationSym:
-# PDB2YAML-NEXT:               AssociationKind: 0x3DB
+# PDB2YAML-NEXT:               AssocKind:       0x3DB
 # PDB2YAML-NEXT:               Segment:         2
 # PDB2YAML-NEXT:               Offset:          1234
 # PDB2YAML-NEXT:           - Kind:            S_ASSOCIATION
 # PDB2YAML-NEXT:             AssociationSym:
-# PDB2YAML-NEXT:               AssociationKind: None
+# PDB2YAML-NEXT:               AssocKind:       None
 # PDB2YAML-NEXT:               Segment:         1234
 # PDB2YAML-NEXT:               Offset:          42
 
@@ -62,16 +62,16 @@ DbiStream:
         Records:
           - Kind:            S_ASSOCIATION
             AssociationSym:
-              AssociationKind: Coroutine
+              AssocKind:       Coroutine
               Segment:         1
               Offset:          0
           - Kind:            S_ASSOCIATION
             AssociationSym:
-              AssociationKind: 987
+              AssocKind:       987
               Segment:         2
               Offset:          1234
           - Kind:            S_ASSOCIATION
             AssociationSym:
-              AssociationKind: 0
+              AssocKind:       0
               Segment:         1234
               Offset:          42
diff --git a/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp b/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
index 9241ccc132f78..f3abc000430e2 100644
--- a/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
+++ b/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
@@ -1009,8 +1009,7 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
 Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
                                             AssociationSym &Assoc) {
   AutoIndent Indent(P, 7);
-  P.formatLine("kind = {0}, addr = {1}",
-               formatAssociationKind(Assoc.AssociationKind),
+  P.formatLine("kind = {0}, addr = {1}", formatAssociationKind(Assoc.AssocKind),
                formatSegmentOffset(Assoc.Segment, Assoc.CodeOffset));
   return Error::success();
 }

>From 937a8d0324fb9a4867ed541fda3c2cea7311f251 Mon Sep 17 00:00:00 2001
From: Nerixyz <nerixdev at outlook.de>
Date: Wed, 9 Sep 2026 21:39:26 +0200
Subject: [PATCH 3/3] fix: use `AssociationKind` in user facing text

---
 llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp    |  2 +-
 llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp     |  2 +-
 llvm/test/tools/llvm-pdbutil/s-association.yaml | 12 ++++++------
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp b/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
index df1018381edd4..18f17962fe003 100644
--- a/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
+++ b/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
@@ -708,7 +708,7 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
 
 Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
                                            AssociationSym &Assoc) {
-  W.printEnum("AssocKind", static_cast<uint16_t>(Assoc.AssocKind),
+  W.printEnum("AssociationKind", static_cast<uint16_t>(Assoc.AssocKind),
               getAssociationKindNames());
   W.printHex("Offset", Assoc.CodeOffset);
   W.printHex("Segment", Assoc.Segment);
diff --git a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
index 9dc8ab7f801e6..7b145fa6d4ae7 100644
--- a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
+++ b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
@@ -627,7 +627,7 @@ template <> void SymbolRecordImpl<HotPatchFuncSym>::map(IO &IO) {
 }
 
 template <> void SymbolRecordImpl<AssociationSym>::map(IO &IO) {
-  IO.mapRequired("AssocKind", Symbol.AssocKind);
+  IO.mapRequired("AssociationKind", Symbol.AssocKind);
   IO.mapOptional("Segment", Symbol.Segment, uint16_t(0));
   IO.mapOptional("Offset", Symbol.CodeOffset, 0U);
 }
diff --git a/llvm/test/tools/llvm-pdbutil/s-association.yaml b/llvm/test/tools/llvm-pdbutil/s-association.yaml
index eb6007fe72336..1f2fbccab81ca 100644
--- a/llvm/test/tools/llvm-pdbutil/s-association.yaml
+++ b/llvm/test/tools/llvm-pdbutil/s-association.yaml
@@ -29,17 +29,17 @@
 # PDB2YAML-NEXT:         Records:
 # PDB2YAML-NEXT:           - Kind:            S_ASSOCIATION
 # PDB2YAML-NEXT:             AssociationSym:
-# PDB2YAML-NEXT:               AssocKind:       Coroutine
+# PDB2YAML-NEXT:               AssociationKind: Coroutine
 # PDB2YAML-NEXT:               Segment:         1
 # PDB2YAML-NEXT:               Offset:          0
 # PDB2YAML-NEXT:           - Kind:            S_ASSOCIATION
 # PDB2YAML-NEXT:             AssociationSym:
-# PDB2YAML-NEXT:               AssocKind:       0x3DB
+# PDB2YAML-NEXT:               AssociationKind: 0x3DB
 # PDB2YAML-NEXT:               Segment:         2
 # PDB2YAML-NEXT:               Offset:          1234
 # PDB2YAML-NEXT:           - Kind:            S_ASSOCIATION
 # PDB2YAML-NEXT:             AssociationSym:
-# PDB2YAML-NEXT:               AssocKind:       None
+# PDB2YAML-NEXT:               AssociationKind: None
 # PDB2YAML-NEXT:               Segment:         1234
 # PDB2YAML-NEXT:               Offset:          42
 
@@ -62,16 +62,16 @@ DbiStream:
         Records:
           - Kind:            S_ASSOCIATION
             AssociationSym:
-              AssocKind:       Coroutine
+              AssociationKind: Coroutine
               Segment:         1
               Offset:          0
           - Kind:            S_ASSOCIATION
             AssociationSym:
-              AssocKind:       987
+              AssociationKind: 987
               Segment:         2
               Offset:          1234
           - Kind:            S_ASSOCIATION
             AssociationSym:
-              AssocKind:       0
+              AssociationKind: 0
               Segment:         1234
               Offset:          42



More information about the llvm-commits mailing list