def get_class_name(addr, size): # Try to detect a vtable ptr at the top of this object: vtable = gdb.Value(addr).cast(void_ptr_ptr).dereference() if not looks_like_ptr(vtable): return None info = execute('info sym (void *)0x%x' % long(vtable)) # "vtable for Foo + 8 in section .rodata of /home/david/heap/test_cplusplus" m = re.match('vtable for (.*) \+ (.*)', info) if m: return m.group(1) # Not matched: return None
def _get_register_state(): from heap.compat import execute return execute('thread apply all info registers')