diff --git a/lldb/test/functionalities/stop-hook/TestStopHookMechanism.py b/lldb/test/functionalities/stop-hook/TestStopHookMechanism.py index db722d52a3ea..d04aaa88213b 100644 --- a/lldb/test/functionalities/stop-hook/TestStopHookMechanism.py +++ b/lldb/test/functionalities/stop-hook/TestStopHookMechanism.py @@ -29,6 +29,7 @@ class StopHookMechanismTestCase(TestBase): # 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 @@ class StopHookMechanismTestCase(TestBase): 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') diff --git a/lldb/test/functionalities/stop-hook/main.cpp b/lldb/test/functionalities/stop-hook/main.cpp index ee68c34feb88..c10c1e5ef0d2 100644 --- a/lldb/test/functionalities/stop-hook/main.cpp +++ b/lldb/test/functionalities/stop-hook/main.cpp @@ -30,7 +30,7 @@ int b(int val) 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. }