def __init__(self, gdbval): WrappedPointer.__init__(self, gdbval) # Cache some values: # This is the high-water mark: at this point and beyond, the bytes of # memory are untouched since malloc: self.pool_address = self.field('pool_address')
def __init__(self, gdbval, arenaobj): WrappedPointer.__init__(self, gdbval) assert (isinstance(arenaobj, ArenaObject)) self.arenaobj = arenaobj # obmalloc.c sets up arenaobj->pool_address to the first pool # address, aligning it to POOL_SIZE_MASK: self.initial_pool_addr = self.as_address() self.num_pools = ARENA_SIZE // POOL_SIZE self.excess = self.initial_pool_addr & POOL_SIZE_MASK if self.excess != 0: self.num_pools -= 1 self.initial_pool_addr += POOL_SIZE - self.excess
def __init__(self, gdbval, arenaobj): WrappedPointer.__init__(self, gdbval) assert(isinstance(arenaobj, ArenaObject)) self.arenaobj = arenaobj # obmalloc.c sets up arenaobj->pool_address to the first pool # address, aligning it to POOL_SIZE_MASK: self.initial_pool_addr = self.as_address() self.num_pools = ARENA_SIZE / POOL_SIZE self.excess = self.initial_pool_addr & POOL_SIZE_MASK if self.excess != 0: self.num_pools -= 1 self.initial_pool_addr += POOL_SIZE - self.excess
class GTypeInstancePtr(WrappedPointer): @classmethod def from_gtypeinstance_ptr(cls, addr, typenode): typename = cls.get_type_name(typenode) if typename: cls = cls.get_class_for_typename(typename) return cls(addr, typenode, typename) @classmethod def get_class_for_typename(cls, typename): '''Get the GTypeInstance subclass for the given type name''' if typename in typemap: return typemap[typename] return GTypeInstancePtr def __init__(self, addr, typenode, typename): # Try to cast the ptr to the named type: addr = gdb.Value(addr) try: if is_typename_castable(typename): # This requires, say, gtk2-debuginfo: ptr_type = caching_lookup_type(typename).pointer() addr = addr.cast(ptr_type) #print typename, addr.dereference() #if typename == 'GdkPixbuf': # print 'GOT PIXELS', addr['pixels'] except RuntimeError, e: pass #print addr, e WrappedPointer.__init__(self, addr) self.typenode = typenode self.typename = typename """
def __init__(self, addr, typenode, typename): # Try to cast the ptr to the named type: addr = gdb.Value(addr) try: if is_typename_castable(typename): # This requires, say, gtk2-debuginfo: ptr_type = caching_lookup_type(typename).pointer() addr = addr.cast(ptr_type) #print typename, addr.dereference() #if typename == 'GdkPixbuf': # print 'GOT PIXELS', addr['pixels'] except RuntimeError as e: pass #print addr, e WrappedPointer.__init__(self, addr) self.typenode = typenode self.typename = typename """