[Lldb-commits] [lldb] r179788 - Added unit tests for register read (should pass) and the expression interpreter (xfail) after the inferior has crashed.
Ashok Thirumurthi
ashok.thirumurthi at intel.com
Thu Apr 18 13:11:55 PDT 2013
Author: athirumu
Date: Thu Apr 18 15:11:55 2013
New Revision: 179788
URL: http://llvm.org/viewvc/llvm-project?rev=179788&view=rev
Log:
Added unit tests for register read (should pass) and the expression interpreter (xfail) after the inferior has crashed.
- Thanks to Samuel Jacob for the related reproducer.
Reviewed by: Daniel Malea.
Modified:
lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py
Modified: lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py?rev=179788&r1=179787&r2=179788&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py (original)
+++ lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py Thu Apr 18 15:11:55 2013
@@ -1,4 +1,4 @@
-"""Test that lldb reliably catches the inferior crashing."""
+"""Test that lldb functions correctly after the inferior has crashed."""
import os, time
import unittest2
@@ -20,12 +20,36 @@ class CrashingInferiorTestCase(TestBase)
self.buildDwarf()
self.inferior_crashing()
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_inferior_crashing_registers_dsym(self):
+ """Test that lldb reliably reads registers from the inferior after crashing (command)."""
+ self.buildDsym()
+ self.inferior_crashing_registers()
+
+ def test_inferior_crashing_register_dwarf(self):
+ """Test that lldb reliably reads registers from the inferior after crashing (command)."""
+ self.buildDwarf()
+ self.inferior_crashing_registers()
+
@python_api_test
def test_inferior_crashing_python(self):
"""Test that lldb reliably catches the inferior crashing (Python API)."""
self.buildDefault()
self.inferior_crashing_python()
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ @unittest2.expectedFailure # bugzilla 15784?
+ def test_inferior_crashing_expr(self):
+ """Test that the lldb expression interpreter can read from the inferior after crashing (command)."""
+ self.buildDsym()
+ self.inferior_crashing_expr()
+
+ @unittest2.expectedFailure # bugzilla 15784
+ def test_inferior_crashing_expr(self):
+ """Test that the lldb expression interpreter can read from the inferior after crashing (command)."""
+ self.buildDwarf()
+ self.inferior_crashing_expr()
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
@@ -78,6 +102,38 @@ class CrashingInferiorTestCase(TestBase)
if self.TraceOn():
lldbutil.print_stacktrace(thread)
+ def inferior_crashing_registers(self):
+ """Test that lldb can read registers after crashing."""
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ if sys.platform.startswith("darwin"):
+ stop_reason = 'stop reason = EXC_BAD_ACCESS'
+ else:
+ stop_reason = 'stop reason = invalid address'
+
+ # lldb should be able to read from registers from the inferior after crashing.
+ self.expect("register read rax",
+ substrs = ['rax = 0x'])
+
+ def inferior_crashing_expr(self):
+ """Test that the lldb expression interpreter can read symbols after crashing."""
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ if sys.platform.startswith("darwin"):
+ stop_reason = 'stop reason = EXC_BAD_ACCESS'
+ else:
+ stop_reason = 'stop reason = invalid address'
+
+ # The lldb expression interpreter should be able to read from addresses of the inferior during process exit.
+ self.expect("p argc",
+ startstr = ['(int) $0 = 1'])
+
if __name__ == '__main__':
import atexit
lldb.SBDebugger.Initialize()
More information about the lldb-commits
mailing list