Skip to content

Commit cc632c2

Browse files
committed
debugging...
1 parent 4cb2411 commit cc632c2

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

‎src/luajit_dbg.py‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,9 +593,15 @@ def _dbgtype(self, typestr):
593593

594594
def _cast(self, tp, val):
595595
assert isinstance(tp, lldb.SBType)
596+
# self.write("_cast: val={}\n".format(val))
597+
# self.write("_cast: type(val)={}\n".format(type(val)))
596598
if isinstance(val, lldb.value):
597599
val = val.sbvalue
598600
elif type(val) is int:
601+
# self.write("_cast: int 1\n")
602+
# vvv = self._lldb_value_from_raw(val, tp.GetByteSize(), tp)
603+
# self.write("_cast: int 2\n")
604+
# return vvv
599605
return self._lldb_value_from_raw(val, tp.GetByteSize(), tp)
600606
elif not isinstance(val, lldb.SBValue):
601607
raise Exception(
@@ -748,13 +754,22 @@ def register_command(self, command, name):
748754

749755
def create_enum_value(self, enum_name, enum_member, hint_module=None):
750756
val = self.eval(enum_name + "::" + enum_member)
757+
dbg.write("create_enum_value: val={}\n".format(val))
758+
dbg.write("create_enum_value: val.IsValid={}\n".format(val.IsValid()))
751759
if val.IsValid() and val.error is None:
760+
self.write("create_enum_value: acceptable value\n")
752761
return val
753-
762+
763+
if val.error is not None:
764+
dbg.write("create_enum_value: val.error[{}]={}\n".format(len(val.error), val.error))
765+
754766
for m in self.target.modules:
755767
if hint_module is not None and m.file.basename != hint_module:
756768
continue
769+
self.write("create_enum_value: m.file.basename={}\n".format(m.file.basename))
757770
tp = next((t for t in m.GetTypes(lldb.eTypeClassEnumeration) if t.IsValid() and t.GetEnumMembers()[enum_member] is not None))
771+
self.write("create_enum_value: tp={}\n".format(tp))
772+
758773
if tp is not None:
759774
return self.cast(tp, tp.GetEnumMembers()[enum_member].unsigned).sbvalue
760775
return None
@@ -865,11 +880,16 @@ def __get_items(self):
865880
max_enum_value = dbg.create_enum_value(
866881
self.__enum_name, self.__max_enum_member
867882
)
883+
dbg.write("EnumBasedList.__get_items: max_enum_value={}\n".format(max_enum_value))
868884
items = []
869885
for i in range(dbg.cast('int', max_enum_value)):
870886
item = str(dbg.cast(max_enum_value.type, dbg.eval(str(i))))
887+
if self.__enum_name == 'IRFieldID':
888+
dbg.write("enum_names: item={}\n".format(item))
871889
if self.__map_func:
872890
item = self.__map_func(item, *self.__map_func_extra_args)
891+
if self.__enum_name == 'IRFieldID':
892+
dbg.write("enum_names: item={}\n".format(item))
873893
items.append(item)
874894
self.__items = items
875895
return self.__items
@@ -2942,6 +2962,9 @@ class LJDumpTrace(dbg.LJBase):
29422962
'''
29432963

29442964
def execute(self, arg):
2965+
dbg.write("execute: len(IRFIELDS)={}\n".format(len(IRFIELDS)))
2966+
for irf in IRFIELDS:
2967+
dbg.write("irf={}\n".format(irf))
29452968
arg, flags = dbg.extract_flags(arg, 'rs')
29462969
dbg.write('{}'.format(dump_trace(
29472970
dbg.cast('GCtrace *', dbg.eval(arg)),

0 commit comments

Comments
 (0)