@@ -100,6 +100,16 @@ def children(self):
100100 except Exception as e :
101101 yield str (repr (e ))
102102
103+ def jank_opaque_box_type (val ):
104+ address = jank_address (val )
105+ canonical_type = gdb .parse_and_eval (f"((jank::runtime::obj::opaque_box*){ address } )->canonical_type.c_str()" )
106+ match = re .search ("0x([0-9a-fA-F]{12}) (.*)" , str (canonical_type ))
107+ type_name = match .group (2 )[1 :- 1 ].replace ('\\ "' , '"' ).rstrip ()
108+ if type_name .endswith ('*' ):
109+ return gdb .lookup_type (type_name [:- 1 ].rstrip ()).pointer ()
110+ else :
111+ return gdb .lookup_type (type_name ).pointer ()
112+
103113class jank_print_opaque_box :
104114 def __init__ (self , val ):
105115 self .val = val
@@ -108,15 +118,8 @@ def to_string(self):
108118 def children (self ):
109119 try :
110120 address = jank_address (self .val )
111- canonical_type = gdb .parse_and_eval (f"((jank::runtime::obj::opaque_box*){ address } )->canonical_type.c_str()" )
112- match = re .search ("0x([0-9a-fA-F]{12}) (.*)" , str (canonical_type ))
113- type_name = match .group (2 )[1 :- 1 ].replace ('\\ "' , '"' ).rstrip ()
114- if type_name .endswith ('*' ):
115- inner_type = gdb .lookup_type (type_name [:- 1 ].rstrip ()).pointer ()
116- else :
117- inner_type = gdb .lookup_type (type_name ).pointer ()
118121 box = gdb .parse_and_eval (f"((jank::runtime::obj::opaque_box*){ address } )" )
119- yield "data" , box ["data" ].cast (inner_type ).dereference ()
122+ yield "data" , box ["data" ].cast (jank_opaque_box_type ( self . val ) ).dereference ()
120123 except Exception as e :
121124 yield str (repr (e )), self .val ["data" ]
122125
0 commit comments