1+ from __future__ import annotations
2+ from typing import Dict
3+
14import lldb
25
36from lldb_providers import *
@@ -9,7 +12,7 @@ def is_hashbrown_hashmap(hash_map: lldb.SBValue) -> bool:
912 return len (hash_map .type .fields ) == 1
1013
1114
12- def classify_rust_type (type : lldb .SBType ) -> str :
15+ def classify_rust_type (type : lldb .SBType ) -> RustType :
1316 if type .IsPointerType ():
1417 type = type .GetPointeeType ()
1518
@@ -19,50 +22,50 @@ def classify_rust_type(type: lldb.SBType) -> str:
1922 if type_class == lldb .eTypeClassUnion :
2023 return classify_union (type .fields )
2124
22- return RustType .OTHER
25+ return RustType .Other
2326
2427
2528def summary_lookup (valobj : lldb .SBValue , _dict : LLDBOpaque ) -> str :
2629 """Returns the summary provider for the given value"""
2730 rust_type = classify_rust_type (valobj .GetType ())
2831
29- if rust_type == RustType .STD_STRING :
32+ if rust_type == RustType .StdString :
3033 return StdStringSummaryProvider (valobj , _dict )
31- if rust_type == RustType .STD_OS_STRING :
34+ if rust_type == RustType .StdOsString :
3235 return StdOsStringSummaryProvider (valobj , _dict )
33- if rust_type == RustType .STD_STR :
36+ if rust_type == RustType .StdStr :
3437 return StdStrSummaryProvider (valobj , _dict )
3538
36- if rust_type == RustType .STD_VEC :
39+ if rust_type == RustType .StdVec :
3740 return SizeSummaryProvider (valobj , _dict )
38- if rust_type == RustType .STD_VEC_DEQUE :
41+ if rust_type == RustType .StdVecDeque :
3942 return SizeSummaryProvider (valobj , _dict )
40- if rust_type == RustType .STD_SLICE :
43+ if rust_type == RustType .StdSlice :
4144 return SizeSummaryProvider (valobj , _dict )
4245
43- if rust_type == RustType .STD_HASH_MAP :
46+ if rust_type == RustType .StdHashMap :
4447 return SizeSummaryProvider (valobj , _dict )
45- if rust_type == RustType .STD_HASH_SET :
48+ if rust_type == RustType .StdHashSet :
4649 return SizeSummaryProvider (valobj , _dict )
4750
48- if rust_type == RustType .STD_RC :
51+ if rust_type == RustType .StdRc :
4952 return StdRcSummaryProvider (valobj , _dict )
50- if rust_type == RustType .STD_ARC :
53+ if rust_type == RustType .StdArc :
5154 return StdRcSummaryProvider (valobj , _dict )
5255
53- if rust_type == RustType .STD_REF :
56+ if rust_type == RustType .StdRef :
5457 return StdRefSummaryProvider (valobj , _dict )
55- if rust_type == RustType .STD_REF_MUT :
58+ if rust_type == RustType .StdRefMut :
5659 return StdRefSummaryProvider (valobj , _dict )
57- if rust_type == RustType .STD_REF_CELL :
60+ if rust_type == RustType .StdRefCell :
5861 return StdRefSummaryProvider (valobj , _dict )
5962
60- if rust_type == RustType .STD_NONZERO_NUMBER :
63+ if rust_type == RustType .StdNonZeroNumber :
6164 return StdNonZeroNumberSummaryProvider (valobj , _dict )
6265
63- if rust_type == RustType .STD_PATHBUF :
66+ if rust_type == RustType .StdPathBuf :
6467 return StdPathBufSummaryProvider (valobj , _dict )
65- if rust_type == RustType .STD_PATH :
68+ if rust_type == RustType .StdPath :
6669 return StdPathSummaryProvider (valobj , _dict )
6770
6871 return ""
@@ -72,54 +75,54 @@ def synthetic_lookup(valobj: lldb.SBValue, _dict: LLDBOpaque) -> object:
7275 """Returns the synthetic provider for the given value"""
7376 rust_type = classify_rust_type (valobj .GetType ())
7477
75- if rust_type == RustType .STRUCT :
78+ if rust_type == RustType .Struct :
7679 return StructSyntheticProvider (valobj , _dict )
77- if rust_type == RustType .STRUCT_VARIANT :
80+ if rust_type == RustType .StructVariant :
7881 return StructSyntheticProvider (valobj , _dict , is_variant = True )
79- if rust_type == RustType .TUPLE :
82+ if rust_type == RustType .Tuple :
8083 return TupleSyntheticProvider (valobj , _dict )
81- if rust_type == RustType .TUPLE_VARIANT :
84+ if rust_type == RustType .TupleVariant :
8285 return TupleSyntheticProvider (valobj , _dict , is_variant = True )
83- if rust_type == RustType .EMPTY :
86+ if rust_type == RustType .Empty :
8487 return EmptySyntheticProvider (valobj , _dict )
85- if rust_type == RustType .REGULAR_ENUM :
88+ if rust_type == RustType .RegularEnum :
8689 discriminant = valobj .GetChildAtIndex (0 ).GetChildAtIndex (0 ).GetValueAsUnsigned ()
8790 return synthetic_lookup (valobj .GetChildAtIndex (discriminant ), _dict )
88- if rust_type == RustType .SINGLETON_ENUM :
91+ if rust_type == RustType .SingletonEnum :
8992 return synthetic_lookup (valobj .GetChildAtIndex (0 ), _dict )
90- if rust_type == RustType .ENUM :
93+ if rust_type == RustType .Enum :
9194 return ClangEncodedEnumProvider (valobj , _dict )
92- if rust_type == RustType .STD_VEC :
95+ if rust_type == RustType .StdVec :
9396 return StdVecSyntheticProvider (valobj , _dict )
94- if rust_type == RustType .STD_VEC_DEQUE :
97+ if rust_type == RustType .StdVecDeque :
9598 return StdVecDequeSyntheticProvider (valobj , _dict )
96- if rust_type == RustType .STD_SLICE or rust_type == RustType .STD_STR :
99+ if rust_type == RustType .StdSlice or rust_type == RustType .StdStr :
97100 return StdSliceSyntheticProvider (valobj , _dict )
98101
99- if rust_type == RustType .STD_HASH_MAP :
102+ if rust_type == RustType .StdHashMap :
100103 if is_hashbrown_hashmap (valobj ):
101104 return StdHashMapSyntheticProvider (valobj , _dict )
102105 else :
103106 return StdOldHashMapSyntheticProvider (valobj , _dict )
104- if rust_type == RustType .STD_HASH_SET :
107+ if rust_type == RustType .StdHashSet :
105108 hash_map = valobj .GetChildAtIndex (0 )
106109 if is_hashbrown_hashmap (hash_map ):
107110 return StdHashMapSyntheticProvider (valobj , _dict , show_values = False )
108111 else :
109112 return StdOldHashMapSyntheticProvider (hash_map , _dict , show_values = False )
110113
111- if rust_type == RustType .STD_RC :
114+ if rust_type == RustType .StdRc :
112115 return StdRcSyntheticProvider (valobj , _dict )
113- if rust_type == RustType .STD_ARC :
116+ if rust_type == RustType .StdArc :
114117 return StdRcSyntheticProvider (valobj , _dict , is_atomic = True )
115118
116- if rust_type == RustType .STD_CELL :
119+ if rust_type == RustType .StdCell :
117120 return StdCellSyntheticProvider (valobj , _dict )
118- if rust_type == RustType .STD_REF :
121+ if rust_type == RustType .StdRef :
119122 return StdRefSyntheticProvider (valobj , _dict )
120- if rust_type == RustType .STD_REF_MUT :
123+ if rust_type == RustType .StdRefMut :
121124 return StdRefSyntheticProvider (valobj , _dict )
122- if rust_type == RustType .STD_REF_CELL :
125+ if rust_type == RustType .StdRefCell :
123126 return StdRefSyntheticProvider (valobj , _dict , is_cell = True )
124127
125128 return DefaultSyntheticProvider (valobj , _dict )
0 commit comments