def runTest(self): config = ProgramConfiguration("test", "x86-64", "linux") crashInfo1 = GDBCrashInfo([], gdbCrashAddress1.splitlines(), config) crashInfo2 = GDBCrashInfo([], gdbCrashAddress2.splitlines(), config) crashInfo3 = GDBCrashInfo([], gdbCrashAddress3.splitlines(), config) self.assertEqual(crashInfo1.crashAddress, 0x1L) self.assertEqual(crashInfo2.crashAddress, None) self.assertEqual(crashInfo3.crashAddress, 0xffffffffffffffa0L)
def runTest(self): registerMap64 = {} registerMap64["rax"] = 0x0L registerMap64["rbx"] = -1L registerMap64["rsi"] = 0xde6e5L registerMap64["rdi"] = 0x7ffff6543238L registerMap32 = {} registerMap32["eax"] = 0x0L registerMap32["ebx"] = -1L registerMap32["ecx"] = 0xf75fffb8L # Simple tests self.assertEqual(GDBCrashInfo.calculateCrashAddress("mov %rbx,0x10(%rax)", registerMap64), 0x10L) self.assertEqual(GDBCrashInfo.calculateCrashAddress("mov %ebx,0x10(%eax)", registerMap32), 0x10L) # Overflow tests self.assertEqual(GDBCrashInfo.calculateCrashAddress("mov %rax,0x10(%rbx)", registerMap64), 0xFL) self.assertEqual(GDBCrashInfo.calculateCrashAddress("mov %eax,0x10(%ebx)", registerMap32), 0xFL) self.assertEqual(GDBCrashInfo.calculateCrashAddress("mov %rbx,-0x10(%rax)", registerMap64), int64(uint64(0xfffffffffffffff0L))) self.assertEqual(GDBCrashInfo.calculateCrashAddress("mov %ebx,-0x10(%eax)", registerMap32), int32(uint32(0xfffffff0L))) # Scalar test self.assertEqual(GDBCrashInfo.calculateCrashAddress("movl $0x7b,0x0", registerMap32), 0x0L) # Real world examples # Note: The crash address here can also be 0xf7600000 because the double quadword # move can fail on the second 8 bytes if the source address is not 16-byte aligned self.assertEqual(GDBCrashInfo.calculateCrashAddress("movdqu 0x40(%ecx),%xmm4", registerMap32), int32(uint32(0xf75ffff8L))) # Again, this is an unaligned access and the crash can be at 0x7ffff6700000 or 0x7ffff6700000 - 4 self.assertEqual(GDBCrashInfo.calculateCrashAddress("mov -0x4(%rdi,%rsi,2),%eax", registerMap64), int64(uint64(0x7ffff66ffffeL)))
def runTest(self): config = ProgramConfiguration("test", "x86", "linux") crashInfo1 = GDBCrashInfo([], gdbRegressionTrace1.splitlines(), config) self.assertEqual(crashInfo1.backtrace[0], "js::ScriptedIndirectProxyHandler::defineProperty") self.assertEqual(crashInfo1.backtrace[1], "js::SetPropertyIgnoringNamedGetter")
def runTest(self): config = ProgramConfiguration("test", "x86", "linux") crashInfo = GDBCrashInfo([], gdbSampleTrace1.splitlines(), config) self.assertEqual(len(crashInfo.backtrace), 8) self.assertEqual(crashInfo.backtrace[0], "internalAppend<js::ion::MDefinition*>") self.assertEqual(crashInfo.backtrace[2], "js::ion::MPhi::addInput") self.assertEqual(crashInfo.backtrace[6], "processCfgStack") self.assertEqual(crashInfo.registers["eax"], 0x0L) self.assertEqual(crashInfo.registers["ebx"], 0x8962ff4L) self.assertEqual(crashInfo.registers["eip"], 0x818bc33L)
def runTest(self): config = ProgramConfiguration("test", "x86-64", "linux") crashInfo3 = GDBCrashInfo([], gdbRegressionTrace3.splitlines(), config) self.assertEqual(crashInfo3.crashAddress, 0x7fffffffffffL)
def runTest(self): config = ProgramConfiguration("test", "x86", "linux") crashInfo2 = GDBCrashInfo([], gdbRegressionTrace2.splitlines(), config) self.assertEqual(crashInfo2.crashAddress, 0xfffd579cL)