[Lldb-commits] [lldb] r140419 - in /lldb/trunk/test/functionalities/stop-hook: TestStopHookMechanism.py main.cpp

Jim Ingham jingham at apple.com
Fri Sep 23 14:24:58 PDT 2011


Author: jingham
Date: Fri Sep 23 16:24:57 2011
New Revision: 140419

URL: http://llvm.org/viewvc/llvm-project?rev=140419&view=rev
Log:
Added a test for problems caused when Clang errantly makes the line range for one line
too long, so that the jump from the line above the bad line to the line after
ends up in the middle of the bad line instead.  Added a workaround to lldb to just
continue to the end if we find ourselves stopped in the middle of some other line.

Modified:
    lldb/trunk/test/functionalities/stop-hook/TestStopHookMechanism.py
    lldb/trunk/test/functionalities/stop-hook/main.cpp

Modified: lldb/trunk/test/functionalities/stop-hook/TestStopHookMechanism.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/stop-hook/TestStopHookMechanism.py?rev=140419&r1=140418&r2=140419&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/stop-hook/TestStopHookMechanism.py (original)
+++ lldb/trunk/test/functionalities/stop-hook/TestStopHookMechanism.py Fri Sep 23 16:24:57 2011
@@ -29,6 +29,7 @@
         # Find the line numbers inside main.cpp.
         self.begl = line_number('main.cpp', '// Set breakpoint here to test target stop-hook.')
         self.endl = line_number('main.cpp', '// End of the line range for which stop-hook is to be run.')
+        self.correct_step_line = line_number ('main.cpp', '// We should stop here after stepping.')
         self.line = line_number('main.cpp', '// Another breakpoint which is outside of the stop-hook range.')
 
     def stop_hook_firing(self):
@@ -66,6 +67,13 @@
         child.sendline('thread step-over')
         # Expecting to find the output emitted by the firing of our stop hook.
         child.expect_exact('(void *) $')
+        # This is orthogonal to the main stop hook test, but this example shows a bug in
+        # CLANG where the line table entry for the "return -1" actually includes some code
+        # from the other branch of the if/else, so we incorrectly stop at the "return -1" line.
+        # I fixed that in lldb and I'm sticking in a test here because I don't want to have to
+        # make up a whole nother test case for it.
+        child.sendline('frame info')
+        child.expect_exact('at main.cpp:%d'%self.correct_step_line)
 
         # Now continue the inferior, we'll stop at another breakpoint which is outside the stop-hook range.
         child.sendline('process continue')

Modified: lldb/trunk/test/functionalities/stop-hook/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/stop-hook/main.cpp?rev=140419&r1=140418&r2=140419&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/stop-hook/main.cpp (original)
+++ lldb/trunk/test/functionalities/stop-hook/main.cpp Fri Sep 23 16:24:57 2011
@@ -30,7 +30,7 @@
     if (!ptr)  // Set breakpoint here to test target stop-hook.
         return -1;
     else
-        printf("ptr=%p\n", ptr);
+        printf("ptr=%p\n", ptr); // We should stop here after stepping.
     return rc; // End of the line range for which stop-hook is to be run.
 }
 





More information about the lldb-commits mailing list