Skip to content

Commit eeef5f3

Browse files
committed
fix(variant): support DIA PDB
1 parent e6fda6a commit eeef5f3

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lldb/source/Plugins/Language/CPlusPlus/MsvcStlVariant.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ namespace {
4242
// }
4343

4444
ValueObjectSP GetStorageMember(ValueObject &valobj, llvm::StringRef name) {
45-
// Find the union
45+
// DIA PDB flattens the union into the storage
46+
if (valobj.GetNumChildrenIgnoringErrors(3) >= 2)
47+
return valobj.GetChildMemberWithName(name);
48+
49+
// DWARF and NativePDB: Find the union
4650
ValueObjectSP union_sp = valobj.GetChildAtIndex(0);
4751
if (!union_sp)
4852
return nullptr;
@@ -119,8 +123,12 @@ bool formatters::MsvcStlVariantSummaryProvider(
119123
storage_type = storage_type.GetTypedefedType();
120124

121125
CompilerType active_type = storage_type.GetTypeTemplateArgument(1, true);
122-
if (!active_type)
123-
return false;
126+
if (!active_type) {
127+
ValueObjectSP head = GetHead(*storage);
128+
active_type = head->GetCompilerType();
129+
if (!active_type)
130+
return false;
131+
}
124132

125133
stream << " Active Type = " << active_type.GetDisplayTypeName() << " ";
126134
return true;

0 commit comments

Comments
 (0)