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. llvm-svn: 140419
This commit is contained in:
parent
edf503757c
commit
76bb759605
|
@ -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')
|
||||
|
|
|
@ -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.
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue