Skip to content

Commit 23b1a5c

Browse files
committed
fix msvc enum summary
1 parent f957826 commit 23b1a5c

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/etc/lldb_providers.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,19 @@ def get_type_name(self) -> str:
651651

652652
return name
653653

654+
def StructSummaryProvider(valobj: SBValue, _dict: LLDBOpaque) -> str:
655+
output = []
656+
for i in range(valobj.GetNumChildren()):
657+
child: SBValue = valobj.GetChildAtIndex(i)
658+
summary = child.summary
659+
if summary is None:
660+
summary = child.value
661+
if summary is None:
662+
summary = StructSummaryProvider(child, _dict)
663+
summary = child.GetName() + ":" + summary
664+
output.append(summary)
665+
666+
return "{" + ", ".join(output) + "}"
654667

655668
def MSVCEnumSummaryProvider(valobj: SBValue, _dict: LLDBOpaque) -> str:
656669
enum_synth = MSVCEnumSyntheticProvider(valobj.GetNonSyntheticValue(), _dict)
@@ -695,16 +708,7 @@ def MSVCEnumSummaryProvider(valobj: SBValue, _dict: LLDBOpaque) -> str:
695708
return name + TupleSummaryProvider(enum_synth.value, _dict)
696709
else:
697710
# enum variant is a regular struct
698-
var_list = (
699-
str(enum_synth.value.GetNonSyntheticValue()).split("= ", 1)[1].splitlines()
700-
)
701-
vars = [x.strip() for x in var_list if x not in ("{", "}")]
702-
if vars[0][0] == "(":
703-
vars[0] = vars[0][1:]
704-
if vars[-1][-1] == ")":
705-
vars[-1] = vars[-1][:-1]
706-
707-
return f"{name}{{{', '.join(vars)}}}"
711+
return name + StructSummaryProvider(enum_synth.value, _dict)
708712

709713

710714
class TupleSyntheticProvider:

0 commit comments

Comments
 (0)