mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-24 00:31:16 +00:00
add final code to check vtable accuracy
This commit is contained in:
parent
28a4c1fe2f
commit
ce9990d534
@ -246,3 +246,12 @@ def get_recompiled_address_from_name(self, name):
|
|||||||
return self.names[name]
|
return self.names[name]
|
||||||
else:
|
else:
|
||||||
logger.error('Failed to find function symbol with name: %s', name)
|
logger.error('Failed to find function symbol with name: %s', name)
|
||||||
|
|
||||||
|
def verify_vtable(self, class_name, func_name, offset):
|
||||||
|
for class_id, c in classes.items():
|
||||||
|
if c.name == class_name and c.field_list:
|
||||||
|
fl = fieldlists[c.field_list]
|
||||||
|
for v in fl.vtable:
|
||||||
|
if v.name == func_name and v.offset == offset:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|||||||
@ -400,16 +400,17 @@ def can_resolve_register_differences(original_asm, new_asm):
|
|||||||
break
|
break
|
||||||
|
|
||||||
try:
|
try:
|
||||||
start_brkt = line.index('(')
|
start_brkt = line.rindex('(')
|
||||||
name_discovery = line[0:start_brkt].split()
|
name_discovery = line[0:start_brkt].split()
|
||||||
vtbl_name = name_discovery[len(name_discovery) - 1]
|
vtbl_name = name_discovery[len(name_discovery) - 1]
|
||||||
break
|
break
|
||||||
except ValueError:
|
except ValueError:
|
||||||
continue
|
continue
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
continue
|
||||||
|
|
||||||
print('Found vtable function %s::%s offset %s' % (in_class, vtbl_name, hex(address)))
|
if not syminfo.verify_vtable(in_class, vtbl_name, address):
|
||||||
|
raise Exception('Function %s::%s is not at %s' % (in_class, vtbl_name, hex(address)))
|
||||||
else:
|
else:
|
||||||
# NOTE: Naive implementation, won't support vtable functions after a nested class
|
# NOTE: Naive implementation, won't support vtable functions after a nested class
|
||||||
class_discovery = line.split()
|
class_discovery = line.split()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user