forked from OSchip/llvm-project
Avoid using hardcoded line number to break on. Use the line_number() utility
function to get the line number to break on during setUp(). llvm-svn: 116349
This commit is contained in:
parent
ac6cd00706
commit
1a28439b96
|
@ -46,14 +46,21 @@ class ClassTypesTestCase(TestBase):
|
|||
self.buildDwarf()
|
||||
self.class_types_expr_parser()
|
||||
|
||||
def setUp(self):
|
||||
super(ClassTypesTestCase, self).setUp()
|
||||
# Find the line number to break for main.cpp.
|
||||
self.line = line_number('main.cpp', '// Set break point at this line.')
|
||||
|
||||
def class_types(self):
|
||||
"""Test 'frame variable this' when stopped on a class constructor."""
|
||||
exe = os.path.join(os.getcwd(), "a.out")
|
||||
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
|
||||
|
||||
# Break on the ctor function of class C.
|
||||
self.expect("breakpoint set -f main.cpp -l 93", BREAKPOINT_CREATED,
|
||||
startstr = "Breakpoint created: 1: file ='main.cpp', line = 93")
|
||||
self.expect("breakpoint set -f main.cpp -l %d" % self.line,
|
||||
BREAKPOINT_CREATED,
|
||||
startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
|
||||
self.line)
|
||||
|
||||
self.runCmd("run", RUN_SUCCEEDED)
|
||||
|
||||
|
@ -96,13 +103,13 @@ class ClassTypesTestCase(TestBase):
|
|||
|
||||
bpfilespec = lldb.SBFileSpec("main.cpp")
|
||||
|
||||
breakpoint = target.BreakpointCreateByLocation(bpfilespec, 93)
|
||||
breakpoint = target.BreakpointCreateByLocation(bpfilespec, self.line)
|
||||
self.assertTrue(breakpoint.IsValid(), VALID_BREAKPOINT)
|
||||
|
||||
# Verify the breakpoint just created.
|
||||
self.expect(repr(breakpoint), BREAKPOINT_CREATED, exe=False,
|
||||
substrs = ['main.cpp',
|
||||
'93'])
|
||||
str(self.line)])
|
||||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
rc = lldb.SBError()
|
||||
|
@ -127,7 +134,7 @@ class ClassTypesTestCase(TestBase):
|
|||
# should be 93.
|
||||
self.expect("%s:%d" % (lldbutil.GetFilenames(thread)[0],
|
||||
lldbutil.GetLineNumbers(thread)[0]),
|
||||
"Break correctly at main.cpp:93", exe=False,
|
||||
"Break correctly at main.cpp:%d" % self.line, exe=False,
|
||||
startstr = "main.cpp:")
|
||||
### clang compiled code reported main.cpp:94?
|
||||
### startstr = "main.cpp:93")
|
||||
|
|
|
@ -33,14 +33,21 @@ class IterateFrameAndDisassembleTestCase(TestBase):
|
|||
self.buildDwarf()
|
||||
self.disassemble_call_stack_api()
|
||||
|
||||
def setUp(self):
|
||||
super(IterateFrameAndDisassembleTestCase, self).setUp()
|
||||
# Find the line number to break for main.cpp.
|
||||
self.line = line_number('main.cpp', '// Set break point at this line.')
|
||||
|
||||
def breakOnCtor(self):
|
||||
"""Setup/run the program so it stops on C's constructor."""
|
||||
exe = os.path.join(os.getcwd(), "a.out")
|
||||
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
|
||||
|
||||
# Break on the ctor function of class C.
|
||||
self.expect("breakpoint set -f main.cpp -l 93", BREAKPOINT_CREATED,
|
||||
startstr = "Breakpoint created: 1: file ='main.cpp', line = 93")
|
||||
self.expect("breakpoint set -f main.cpp -l %d" % self.line,
|
||||
BREAKPOINT_CREATED,
|
||||
startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
|
||||
self.line)
|
||||
|
||||
self.runCmd("run", RUN_SUCCEEDED)
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ public:
|
|||
B(ai, bi),
|
||||
m_c_int(ci)
|
||||
{
|
||||
printf("Within C::ctor() m_c_int=%d\n", m_c_int);
|
||||
printf("Within C::ctor() m_c_int=%d\n", m_c_int); // Set break point at this line.
|
||||
}
|
||||
|
||||
//virtual
|
||||
|
|
Loading…
Reference in New Issue