def invoke(self, arg, from_tty): maximum = objects.information.maximum(self.api, self._class) minimum_id = objects.ident(objects.information.minimum_id(self.api, self._class)) maximum_id = objects.ident(objects.information.maximum_id(self.api, self._class)) args = arg.split() valid = False if len(args): for val in args: try: index = int(val, base = 0) if index < maximum: if index < minimum_id.index(): print "error: %s is not an index (min is %d)" % (val, minimum_id.index()) return else: index = objects.ident(index).index() except ValueError: print "error: %s is not an index" % (val) return try: obj = objects.information.object_return(self.api, self._class, index) except IndexError: print "error: index %s is invalid" % (index) return instance = self.instance(obj) valid = instance.show(from_tty) objects.information.invalidate() else: print '-' * 70 print ' %s: %d [%08x -> %08x]' % (objects.information.name(self.api, self._class), maximum, minimum_id.value(), maximum_id.value()) valid = True for index in range(minimum_id.index(), minimum_id.index() + maximum): if valid: print '-' * 70 valid = self.invoke(str(index), from_tty) return valid
def invoke(self, arg, from_tty): maximum = objects.information.maximum(self.api, self._class) minimum_id = objects.ident(objects.information.minimum_id(self.api, self._class)) maximum_id = objects.ident(objects.information.maximum_id(self.api, self._class)) args = arg.split() valid = False if len(args): for val in args: try: index = int(val, base = 0) if index < maximum: if index < minimum_id.index(): print("error: %s is not an index (min is %d)" % (val, minimum_id.index())) return else: index = objects.ident(index).index() except ValueError: print("error: %s is not an index" % (val)) return try: obj = objects.information.object_return(self.api, self._class, index) except IndexError: print("error: index %s is invalid" % (index)) return instance = self.instance(obj) valid = instance.show(from_tty) objects.information.invalidate() else: print('-' * 70) print(' %s: %d [%08x -> %08x]' % (objects.information.name(self.api, self._class), maximum, minimum_id.value(), maximum_id.value())) valid = True for index in range(minimum_id.index(), minimum_id.index() + maximum): if valid: print('-' * 70) valid = self.invoke(str(index), from_tty) return valid
def invoke(self, arg, from_tty): for num in arg.split(): try: val = gdb.parse_and_eval(num) num = int(val) except: print 'error: "%s" is not a number' % (num) return id = objects.ident(num) if not id.valid(): print 'Invalid object id' return print 'API:%s Class:%s Node:%d Index:%d Id:%08X' % \ (id.api(), id._class(), id.node(), id.index(), id.value()) objectname = id.api() + '/' + id._class() obj = objects.information.object(id).dereference() if objectname in self.objects: object = self.objects[objectname](obj) object.show(from_tty) objects.information.invalidate()
def __init__(self, id): self.id = objects.ident(id)