11import lldb
2- import re
32import debugger_pretty_printers_common as rustpp
43
5- #===============================================================================
4+ # ===============================================================================
65# LLDB Pretty Printing Module for Rust
7- #===============================================================================
6+ # ===============================================================================
7+
88
99class LldbType (rustpp .Type ):
1010
@@ -84,16 +84,16 @@ def print_val(lldb_val, internal_dict):
8484 type_kind == rustpp .TYPE_KIND_EMPTY ):
8585 return print_struct_val (val ,
8686 internal_dict ,
87- omit_first_field = False ,
88- omit_type_name = False ,
89- is_tuple_like = False )
87+ omit_first_field = False ,
88+ omit_type_name = False ,
89+ is_tuple_like = False )
9090
9191 if type_kind == rustpp .TYPE_KIND_STRUCT_VARIANT :
9292 return print_struct_val (val ,
9393 internal_dict ,
94- omit_first_field = True ,
95- omit_type_name = False ,
96- is_tuple_like = False )
94+ omit_first_field = True ,
95+ omit_type_name = False ,
96+ is_tuple_like = False )
9797
9898 if type_kind == rustpp .TYPE_KIND_SLICE :
9999 return print_vec_slice_val (val , internal_dict )
@@ -110,26 +110,26 @@ def print_val(lldb_val, internal_dict):
110110 if type_kind == rustpp .TYPE_KIND_TUPLE :
111111 return print_struct_val (val ,
112112 internal_dict ,
113- omit_first_field = False ,
114- omit_type_name = True ,
115- is_tuple_like = True )
113+ omit_first_field = False ,
114+ omit_type_name = True ,
115+ is_tuple_like = True )
116116
117117 if type_kind == rustpp .TYPE_KIND_TUPLE_STRUCT :
118118 return print_struct_val (val ,
119119 internal_dict ,
120- omit_first_field = False ,
121- omit_type_name = False ,
122- is_tuple_like = True )
120+ omit_first_field = False ,
121+ omit_type_name = False ,
122+ is_tuple_like = True )
123123
124124 if type_kind == rustpp .TYPE_KIND_CSTYLE_VARIANT :
125125 return val .type .get_unqualified_type_name ()
126126
127127 if type_kind == rustpp .TYPE_KIND_TUPLE_VARIANT :
128128 return print_struct_val (val ,
129129 internal_dict ,
130- omit_first_field = True ,
131- omit_type_name = False ,
132- is_tuple_like = True )
130+ omit_first_field = True ,
131+ omit_type_name = False ,
132+ is_tuple_like = True )
133133
134134 if type_kind == rustpp .TYPE_KIND_SINGLETON_ENUM :
135135 return print_val (lldb_val .GetChildAtIndex (0 ), internal_dict )
@@ -157,9 +157,9 @@ def print_val(lldb_val, internal_dict):
157157 return lldb_val .GetValue ()
158158
159159
160- #=--------------------------------------------------------------------------------------------------
160+ # =--------------------------------------------------------------------------------------------------
161161# Type-Specialized Printing Functions
162- #=--------------------------------------------------------------------------------------------------
162+ # =--------------------------------------------------------------------------------------------------
163163
164164def print_struct_val (val , internal_dict , omit_first_field , omit_type_name , is_tuple_like ):
165165 """
@@ -212,6 +212,7 @@ def render_child(child_index):
212212 return template % {"type_name" : type_name ,
213213 "body" : body }
214214
215+
215216def print_pointer_val (val , internal_dict ):
216217 """Prints a pointer value with Rust syntax"""
217218 assert val .type .get_dwarf_type_kind () == rustpp .DWARF_TYPE_CODE_PTR
@@ -253,18 +254,21 @@ def print_std_vec_val(val, internal_dict):
253254 length ,
254255 internal_dict )
255256
257+
256258def print_str_slice_val (val , internal_dict ):
257259 (length , data_ptr ) = rustpp .extract_length_and_ptr_from_slice (val )
258260 return read_utf8_string (data_ptr , length )
259261
262+
260263def print_std_string_val (val , internal_dict ):
261264 vec = val .get_child_at_index (0 )
262265 (length , data_ptr , cap ) = rustpp .extract_length_ptr_and_cap_from_std_vec (vec )
263266 return read_utf8_string (data_ptr , length )
264267
265- #=--------------------------------------------------------------------------------------------------
268+ # =--------------------------------------------------------------------------------------------------
266269# Helper Functions
267- #=--------------------------------------------------------------------------------------------------
270+ # =--------------------------------------------------------------------------------------------------
271+
268272
269273def print_array_of_values (array_name , data_ptr_val , length , internal_dict ):
270274 """Prints a contiguous memory range, interpreting it as values of the
0 commit comments