Skip to content

Commit f944f91

Browse files
Minor fixes and improvements for svmhelpers.py
1 parent efb20d4 commit f944f91

File tree

1 file changed

+8
-1
lines changed
  • substratevm/src/com.oracle.svm.hosted.image.debug/gdbpy

1 file changed

+8
-1
lines changed

substratevm/src/com.oracle.svm.hosted.image.debug/gdbpy/svmhelpers.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,6 @@ def get_rtt(cls, obj: gdb.Value) -> gdb.Type:
414414
'J': 'long',
415415
'S': 'short',
416416
}.get(rtt_name, rtt_name)
417-
rtt_name += ' '
418417
for _ in range(array_dimension):
419418
rtt_name += '[]'
420419

@@ -775,6 +774,9 @@ def __call__(self, obj: gdb.Value):
775774

776775
# no complex java type -> handle foreign types for selfref checks
777776
elif obj.type.code == gdb.TYPE_CODE_PTR and obj.type.target().code != gdb.TYPE_CODE_VOID:
777+
# Filter out references to the null literal
778+
if SVMUtil.is_null(obj):
779+
return SVMPPConst(None)
778780
return self.__call__(obj.dereference())
779781
elif obj.type.code == gdb.TYPE_CODE_ARRAY:
780782
return SVMPPArray(obj, False)
@@ -1354,6 +1356,11 @@ def object(self, completion: bool = False) -> str:
13541356
if this_obj.type.code == gdb.TYPE_CODE_PTR:
13551357
obj_str = f"{this}->{func_name}"
13561358
obj_str += f"({param_str})"
1359+
obj = gdb.parse_and_eval(obj_str)
1360+
base_obj_str = obj_str
1361+
if not SVMUtil.is_primitive(obj.type) and SVMUtil.is_java_type(obj.type):
1362+
obj, obj_str = SVMCommandPrint.cast_to_rtt(obj, obj_str)
1363+
self.cache[base_obj_str] = (obj, obj_str)
13571364
elif self.sym == "LBRACK":
13581365
if (not obj.type.is_array_like) and not isinstance(gdb.default_visualizer(obj), SVMPPArray):
13591366
raise RuntimeError(f"Array object expected at: {self.expr[:self.t.end]}")

0 commit comments

Comments
 (0)