Esempio n. 1
0
    def test_get_crash_signature(self):
        gdbf = GDBfile(self.file)
        self.assertFalse(gdbf._hashable_backtrace())

        gdbf.lines.append('#0 0x11111111 in ??')
        gdbf.lines.append('#1 0x22222222 in foo at foo.c:80')
        gdbf.lines.append('#2 0x33333333 in bar')

        gdbf._process_lines()
        gdbf._hashable_backtrace()
        self.assertEqual(gdbf.get_crash_signature(1), hashlib.md5('0x11111111').hexdigest())
        self.assertEqual(gdbf.get_crash_signature(2), hashlib.md5('0x11111111 foo.c:80').hexdigest())
        self.assertEqual(gdbf.get_crash_signature(3), hashlib.md5('0x11111111 foo.c:80 0x33333333').hexdigest())
Esempio n. 2
0
    parser = OptionParser()
    parser.add_option('',
                      '--debug',
                      dest='debug',
                      action='store_true',
                      help='Enable debug messages (overrides --verbose)')
    parser.add_option('',
                      '--verbose',
                      dest='verbose',
                      action='store_true',
                      help='Enable verbose messages')
    (options, args) = parser.parse_args()

    if options.debug:
        logger.setLevel(logging.DEBUG)
    elif options.verbose:
        logger.setLevel(logging.INFO)
    else:
        logger.setLevel(logging.WARNING)

    for f in args:
        debugger = os.path.splitext(f)[1]
        if debugger == '.gdb':
            g = GDBfile(f)
        elif debugger == '.cw':
            g = CWfile(f)
        print 'Signature=%s' % g.get_crash_signature(5)
        if g.registers_hex.get(g.pc_name):
            print 'PC=%s' % g.registers_hex[g.pc_name]
Esempio n. 3
0
logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)

if __name__ == '__main__':
    logger = logging.getLogger()
    hdlr = logging.StreamHandler()
    logger.addHandler(hdlr)

    parser = OptionParser()
    parser.add_option('', '--debug', dest='debug', action='store_true', help='Enable debug messages (overrides --verbose)')
    parser.add_option('', '--verbose', dest='verbose', action='store_true', help='Enable verbose messages')
    (options, args) = parser.parse_args()

    if options.debug:
        logger.setLevel(logging.DEBUG)
    elif options.verbose:
        logger.setLevel(logging.INFO)
    else:
        logger.setLevel(logging.WARNING)

    for f in args:
        debugger = os.path.splitext(f)[1]
        if debugger == '.gdb':
            g = GDBfile(f)
        elif debugger == '.cw':
            g = CWfile(f)
        print 'Signature=%s' % g.get_crash_signature(5)
        if g.registers_hex.get(g.pc_name):
            print 'PC=%s' % g.registers_hex[g.pc_name]