[lldb][python] do not let to crash of python bindings on variables before local_inits basic block
- validness of the object pointer check with particularities of TypeInfo structure
This commit is contained in:
@@ -47,6 +47,13 @@ def is_string(value):
|
|||||||
def is_array(value):
|
def is_array(value):
|
||||||
return int(evaluate("(int)Konan_DebugIsArray({})".format(lldb_val_to_ptr(value))).GetValue()) == 1
|
return int(evaluate("(int)Konan_DebugIsArray({})".format(lldb_val_to_ptr(value))).GetValue()) == 1
|
||||||
|
|
||||||
|
|
||||||
|
def check_type_info(addr):
|
||||||
|
"""This method checks self-referencing of pointer of first member of TypeInfo including case when object has an
|
||||||
|
meta-object pointed by TypeInfo. """
|
||||||
|
result = evaluate("**(void ***){0} == ***(void****){0}".format(addr))
|
||||||
|
return result.IsValid() and result.GetValue() == "true"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Some kind of forward declaration.
|
# Some kind of forward declaration.
|
||||||
|
|
||||||
@@ -60,7 +67,7 @@ def kotlin_object_type_summary(lldb_val, internal_dict):
|
|||||||
if str(lldb_val.type) != "struct ObjHeader *":
|
if str(lldb_val.type) != "struct ObjHeader *":
|
||||||
return fallback
|
return fallback
|
||||||
|
|
||||||
if int(fallback, 0) == 0:
|
if not check_type_info(fallback):
|
||||||
return NULL
|
return NULL
|
||||||
|
|
||||||
ptr = lldb_val_to_ptr(lldb_val)
|
ptr = lldb_val_to_ptr(lldb_val)
|
||||||
@@ -190,7 +197,6 @@ class KonanArraySyntheticProvider(KonanHelperProvider):
|
|||||||
def update(self):
|
def update(self):
|
||||||
super(KonanArraySyntheticProvider, self).update()
|
super(KonanArraySyntheticProvider, self).update()
|
||||||
self._children = [x for x in range(0, self.num_children())]
|
self._children = [x for x in range(0, self.num_children())]
|
||||||
pass
|
|
||||||
|
|
||||||
def num_children(self):
|
def num_children(self):
|
||||||
return self._children_count
|
return self._children_count
|
||||||
@@ -213,6 +219,9 @@ class KonanArraySyntheticProvider(KonanHelperProvider):
|
|||||||
|
|
||||||
class KonanProxyTypeProvider:
|
class KonanProxyTypeProvider:
|
||||||
def __init__(self, valobj, _):
|
def __init__(self, valobj, _):
|
||||||
|
fallback = int(valobj.GetValue(), 0)
|
||||||
|
if not check_type_info(fallback):
|
||||||
|
return
|
||||||
self._proxy = select_provider(valobj)
|
self._proxy = select_provider(valobj)
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user