Ejemplo n.º 1
0
    def test_hashable_backtrace(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()
        self.assertEqual(gdbf._hashable_backtrace(), ['0x11111111', 'foo.c:80', '0x33333333'])
Ejemplo n.º 2
0
    def test_registers(self):
        gdbf = GDBfile(self.file)
        self.assertFalse(gdbf.registers)

        for r in registers:
            gdbf.lines.append('%s\t0xf00\tbar' % r)

        gdbf._process_lines()

        for r in registers:
            self.assertEqual(gdbf.registers_hex[r], '0xf00')
            self.assertEqual(gdbf.registers[r], 'bar')
Ejemplo n.º 3
0
    def test_registers(self):
        gdbf = GDBfile(self.file)
        self.assertFalse(gdbf.registers)

        for r in registers:
            gdbf.lines.append('%s\t0xf00\tbar' % r)

        gdbf._process_lines()

        for r in registers:
            self.assertEqual(gdbf.registers_hex[r], '0xf00')
            self.assertEqual(gdbf.registers[r], 'bar')
Ejemplo n.º 4
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())