Add a test scenario for 'source list -b' which shows the line table locations from

the debug information which indicates valid places to set source level breakpoints.

llvm-svn: 129871
This commit is contained in:
Johnny Chen 2011-04-20 20:35:59 +00:00
parent 514cce8e43
commit dbee242518
1 changed files with 16 additions and 1 deletions

View File

@ -86,13 +86,28 @@ class SourceManagerTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
substrs = ['stopped',
'main.c',
'main.c:%d' % self.line,
'stop reason = breakpoint'])
# Display some source code.
self.expect("list -f main.c -l %d" % self.line, SOURCE_DISPLAYED_CORRECTLY,
substrs = ['Hello world'])
# The '-b' option shows the line table locations from the debug information
# that indicates valid places to set source level breakpoints.
# The file to display is implicit in this case.
self.runCmd("list -l %d -c 3 -b" % self.line)
output = self.res.GetOutput().splitlines()[0]
# If the breakpoint set command succeeded, we should expect a positive number
# of breakpoints for the current line, i.e., self.line.
import re
m = re.search('^\[(\d+)\].*// Set break point at this line.', output)
if not m:
self.fail("Fail to display source level breakpoints")
self.assertTrue(int(m.group(1)) > 0)
# Read the main.c file content.
with open('main.c', 'r') as f:
original_content = f.read()