[Lldb-commits] [lldb] r186959 - Adds a test for "disassemble -a" after an assert, which can fail with ELF

Ashok Thirumurthi ashok.thirumurthi at intel.com
Tue Jul 23 10:20:18 PDT 2013


Author: athirumu
Date: Tue Jul 23 12:20:17 2013
New Revision: 186959

URL: http://llvm.org/viewvc/llvm-project?rev=186959&view=rev
Log:
Adds a test for "disassemble -a" after an assert, which can fail with ELF
because a synthetic symbol hasn't been provided for stripped function symbols.

Modified:
    lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py

Modified: lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py?rev=186959&r1=186958&r2=186959&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py (original)
+++ lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py Tue Jul 23 12:20:17 2013
@@ -31,6 +31,13 @@ class AssertingInferiorTestCase(TestBase
         self.buildDwarf()
         self.inferior_asserting_registers()
 
+    @skipIfGcc # Avoid xpasses as the verion of libc used on the gcc buildbot has the required function symbols.
+    @expectedFailureLinux # ResolveSymbolContextForAddress can fail using ELF with stripped function symbols.
+    def test_inferior_asserting_disassemble(self):
+        """Test that lldb reliably disassemblers frames after asserting (command)."""
+        self.buildDefault()
+        self.inferior_asserting_disassemble()
+
     @python_api_test
     def test_inferior_asserting_python(self):
         """Test that lldb reliably catches the inferior asserting (Python API)."""
@@ -130,6 +137,33 @@ class AssertingInferiorTestCase(TestBase
         self.expect("register read eax",
             substrs = ['eax = 0x'])
 
+    def inferior_asserting_disassemble(self):
+        """Test that lldb can disassemble frames after asserting."""
+        exe = os.path.join(os.getcwd(), "a.out")
+
+        # Create a target by the debugger.
+        target = self.dbg.CreateTarget(exe)
+        self.assertTrue(target, VALID_TARGET)
+
+        # Launch the process, and do not stop at the entry point.
+        target.LaunchSimple(None, None, os.getcwd())
+        self.check_stop_reason()
+
+        process = target.GetProcess()
+        self.assertTrue(process.IsValid(), "current process is valid")
+
+        thread = process.GetThreadAtIndex(0)
+        self.assertTrue(thread.IsValid(), "current thread is valid")
+
+        # lldb should be able to disassemble frames from the inferior after asserting.
+        for frame in thread:
+            self.assertTrue(frame.IsValid(), "current frame is valid")
+
+            self.runCmd("frame select " + str(frame.GetFrameID()), RUN_SUCCEEDED)
+
+            self.expect("disassemble -a %s" % frame.GetPC(),
+                substrs = ['->', frame.GetFunctionName()])
+
     def check_expr_in_main(self, thread):
         depth = thread.GetNumFrames()
         for i in range(depth):





More information about the lldb-commits mailing list