예제 #1
0
파일: frames.py 프로젝트: Werkov/urbi
    def __str__(self):
        # get the location
        try:
            loc = "??"
            for l in BoostOptional(self.frame.read_var('loc')):
                loc = "%s" % l
        except ValueError:
            loc = "??"

        # get the message
        try:
            msg = "%s" % self.frame.read_var('msg')
            msg = msg.replace('\"','')
        except ValueError:
            msg = "<??>"

        # get the target and the arguments
        try:
            args_it = LibportVector(self.frame.read_var('args')).__iter__()
            # TODO: should the iterator try to map its elements
            # to other classes such as the intrusive_ptr<*> ?
            target = "%s" % args_it.next()['pointee_'].dereference()
            args = ', '.join([ "%s" % v['pointee_'].dereference() for v in args_it ])
        except:
            # can except StopIteration, ValueError or gdb.MemoryError
            # gdb.MemoryError is not present in version 7.2
            target = "Object_0x????"
            args = "..."
            return '[%s] %s.%s(%s)\n\tError: %s' % (loc, target, msg, args, sys.exc_info()[0])

        return '[%s] %s.%s(%s)' % (loc, target, msg, args)
예제 #2
0
    def __str__(self):
        # get the location
        try:
            loc = "??"
            for l in BoostOptional(self.frame.read_var('loc')):
                loc = "%s" % l
        except ValueError:
            loc = "??"

        # get the message
        try:
            msg = "%s" % self.frame.read_var('msg')
            msg = msg.replace('\"', '')
        except ValueError:
            msg = "<??>"

        # get the target and the arguments
        try:
            args_it = LibportVector(self.frame.read_var('args')).__iter__()
            # TODO: should the iterator try to map its elements
            # to other classes such as the intrusive_ptr<*> ?
            target = "%s" % args_it.next()['pointee_'].dereference()
            args = ', '.join(
                ["%s" % v['pointee_'].dereference() for v in args_it])
        except:
            # can except StopIteration, ValueError or gdb.MemoryError
            # gdb.MemoryError is not present in version 7.2
            target = "Object_0x????"
            args = "..."
            return '[%s] %s.%s(%s)\n\tError: %s' % (loc, target, msg, args,
                                                    sys.exc_info()[0])

        return '[%s] %s.%s(%s)' % (loc, target, msg, args)
예제 #3
0
파일: breakpoints.py 프로젝트: Werkov/urbi
 def stopIf(frame, job):
     try:
         res = True
         if res and line:
             val = frame.read_var('loc')
             val = BoostOptional(val).__iter__().next()
             val = yyLocation(val)
             res = val.line() == line
             if res and file:
                 res = val.filename() == file
         if res and quoted_method:
             frame_method = "%s" % frame.read_var('msg')
             res = frame_method == quoted_method
         if res and (target or args):
             args_it = LibportVector(frame.read_var('args')).__iter__()
             frame_target = "%s" % args_it.next()['pointee_'].dereference()
             if res and target:
                 res = target == frame_target
             # FIXME: the pretty print is extremelly dependent.
             if res and args:
                 frame_args = ', '.join([ "%s" % v['pointee_'].dereference() for v in args_it ])
                 res = args == frame_args
         if res:
             print "UBreakpoint %d: %s" % (bp, urbi.frames.UrbiCallApplyFrame(frame))
         return res
     except ValueError:
         return False
     except StopIteration:
         return False
     except gdb.MemoryError as e:
         return False
예제 #4
0
 def stopIf(frame, job):
     try:
         res = True
         if res and line:
             val = frame.read_var('loc')
             val = BoostOptional(val).__iter__().next()
             val = yyLocation(val)
             res = val.line() == line
             if res and file:
                 res = val.filename() == file
         if res and quoted_method:
             frame_method = "%s" % frame.read_var('msg')
             res = frame_method == quoted_method
         if res and (target or args):
             args_it = LibportVector(frame.read_var('args')).__iter__()
             frame_target = "%s" % args_it.next(
             )['pointee_'].dereference()
             if res and target:
                 res = target == frame_target
             # FIXME: the pretty print is extremelly dependent.
             if res and args:
                 frame_args = ', '.join([
                     "%s" % v['pointee_'].dereference() for v in args_it
                 ])
                 res = args == frame_args
         if res:
             print "UBreakpoint %d: %s" % (
                 bp, urbi.frames.UrbiCallApplyFrame(frame))
         return res
     except ValueError:
         return False
     except StopIteration:
         return False
     except gdb.MemoryError as e:
         return False