99if sys .version_info [0 ] >= 3 :
1010 xrange = range
1111
12- rust_enabled = 'set language rust' in gdb .execute ('complete set language ru' , to_string = True )
12+ rust_enabled = 'set language rust' in gdb .execute ('complete set language ru' , to_string = True )
1313
1414# The btree pretty-printers fail in a confusing way unless
1515# https://sourceware.org/bugzilla/show_bug.cgi?id=21763 is fixed.
2121 if int (_match .group (1 )) > 8 or (int (_match .group (1 )) == 8 and int (_match .group (2 )) >= 1 ):
2222 gdb_81 = True
2323
24- #===============================================================================
24+ # ===============================================================================
2525# GDB Pretty Printing Module for Rust
26- #===============================================================================
26+ # ===============================================================================
27+
2728
2829class GdbType (rustpp .Type ):
2930
@@ -133,39 +134,39 @@ def rust_pretty_printer_lookup_function(gdb_val):
133134
134135 if type_kind == rustpp .TYPE_KIND_REGULAR_STRUCT :
135136 return RustStructPrinter (val ,
136- omit_first_field = False ,
137- omit_type_name = False ,
138- is_tuple_like = False )
137+ omit_first_field = False ,
138+ omit_type_name = False ,
139+ is_tuple_like = False )
139140
140141 if type_kind == rustpp .TYPE_KIND_STRUCT_VARIANT :
141142 return RustStructPrinter (val ,
142- omit_first_field = True ,
143- omit_type_name = False ,
144- is_tuple_like = False )
143+ omit_first_field = True ,
144+ omit_type_name = False ,
145+ is_tuple_like = False )
145146
146147 if type_kind == rustpp .TYPE_KIND_STR_SLICE :
147148 return RustStringSlicePrinter (val )
148149
149150 if type_kind == rustpp .TYPE_KIND_TUPLE :
150151 return RustStructPrinter (val ,
151- omit_first_field = False ,
152- omit_type_name = True ,
153- is_tuple_like = True )
152+ omit_first_field = False ,
153+ omit_type_name = True ,
154+ is_tuple_like = True )
154155
155156 if type_kind == rustpp .TYPE_KIND_TUPLE_STRUCT :
156157 return RustStructPrinter (val ,
157- omit_first_field = False ,
158- omit_type_name = False ,
159- is_tuple_like = True )
158+ omit_first_field = False ,
159+ omit_type_name = False ,
160+ is_tuple_like = True )
160161
161162 if type_kind == rustpp .TYPE_KIND_CSTYLE_VARIANT :
162163 return RustCStyleVariantPrinter (val .get_child_at_index (0 ))
163164
164165 if type_kind == rustpp .TYPE_KIND_TUPLE_VARIANT :
165166 return RustStructPrinter (val ,
166- omit_first_field = True ,
167- omit_type_name = False ,
168- is_tuple_like = True )
167+ omit_first_field = True ,
168+ omit_type_name = False ,
169+ is_tuple_like = True )
169170
170171 if type_kind == rustpp .TYPE_KIND_SINGLETON_ENUM :
171172 variant = get_field_at_index (gdb_val , 0 )
@@ -189,9 +190,9 @@ def rust_pretty_printer_lookup_function(gdb_val):
189190 return None
190191
191192
192- #=------------------------------------------------------------------------------
193+ # =------------------------------------------------------------------------------
193194# Pretty Printer Classes
194- #=------------------------------------------------------------------------------
195+ # =------------------------------------------------------------------------------
195196class RustEmptyPrinter (object ):
196197 def __init__ (self , val ):
197198 self .__val = val
@@ -355,6 +356,7 @@ def children_of_node(boxed_node, height, want_values):
355356 else :
356357 yield keys [i ]['value' ]['value' ]
357358
359+
358360class RustStdBTreeSetPrinter (object ):
359361 def __init__ (self , val ):
360362 self .__val = val
@@ -429,6 +431,7 @@ def to_string(self):
429431 def display_hint (self ):
430432 return "string"
431433
434+
432435class RustCStyleVariantPrinter (object ):
433436 def __init__ (self , val ):
434437 assert val .type .get_dwarf_type_kind () == rustpp .DWARF_TYPE_CODE_ENUM
0 commit comments