Skip to content

Commit

Permalink
[debug][bindings] more logs
Browse files Browse the repository at this point in the history
(cherry picked from commit 28bc665c93ec229bf39e55c645ed0b16411236a6)
  • Loading branch information
vvlevchenko committed Mar 19, 2020
1 parent 79d5fec commit 95daf22
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions llvmDebugInfoC/src/scripts/konan_lldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _symbol_loaded_address(name, debugger = lldb.debugger):
# take first
for candidate in candidates:
address = candidate.GetStartAddress().GetLoadAddress(target)
log(lambda: "{} {:#x}".format(name, address))
log(lambda: "_symbol_loaded_address:{} {:#x}".format(name, address))
return address

def _type_info_by_address(address, debugger = lldb.debugger):
Expand All @@ -71,7 +71,7 @@ def _type_info_by_address(address, debugger = lldb.debugger):
return candidates

def is_instance_of(addr, typeinfo):
return evaluate("(bool)IsInstance({}, {})".format(addr, typeinfo)).GetValue() == "true"
return evaluate("(bool)IsInstance({}, {:#x})".format(addr, typeinfo)).GetValue() == "true"

def is_string_or_array(value):
return evaluate("(int)IsInstance({0}, {1}) ? 1 : ((int)Konan_DebugIsArray({0}) ? 2 : 0)".format(lldb_val_to_ptr(value), _symbol_loaded_address('kclass:kotlin.String'))).unsigned
Expand Down Expand Up @@ -114,6 +114,7 @@ def kotlin_object_type_summary(lldb_val, internal_dict = {}):

def select_provider(lldb_val, tip, internal_dict):
soa = is_string_or_array(lldb_val)
log(lambda : "select_provider: {} : {}".format(lldb_val, soa))
return __FACTORY['string'](lldb_val, tip, internal_dict) if soa == 1 else __FACTORY['array'](lldb_val, tip, internal_dict) if soa == 2 \
else __FACTORY['object'](lldb_val, tip, internal_dict)

Expand Down

0 comments on commit 95daf22

Please sign in to comment.