[Lldb-commits] [lldb] r116358 - in /lldb/trunk/test/stl: TestSTL.py main.cpp
Johnny Chen
johnny.chen at apple.com
Tue Oct 12 15:53:03 PDT 2010
Author: johnny
Date: Tue Oct 12 17:53:02 2010
New Revision: 116358
URL: http://llvm.org/viewvc/llvm-project?rev=116358&view=rev
Log:
Avoid using hardcoded line number to break on. Use the line_number() utility
function to get the line number to break on during setUp().
Modified:
lldb/trunk/test/stl/TestSTL.py
lldb/trunk/test/stl/main.cpp
Modified: lldb/trunk/test/stl/TestSTL.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/stl/TestSTL.py?rev=116358&r1=116357&r2=116358&view=diff
==============================================================================
--- lldb/trunk/test/stl/TestSTL.py (original)
+++ lldb/trunk/test/stl/TestSTL.py Tue Oct 12 17:53:02 2010
@@ -22,6 +22,11 @@
self.buildDwarf()
self.step_into_stl()
+ def setUp(self):
+ super(STLTestCase, self).setUp()
+ # Find the line number to break inside main().
+ self.line = line_number('main.cpp', '// Set break point at this line.')
+
def step_into_stl(self):
"""Test that we can successfully step into an STL function."""
exe = os.path.join(os.getcwd(), "a.out")
@@ -33,14 +38,16 @@
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break on line 13 of main.cpp.
- self.expect("breakpoint set -f main.cpp -l 13", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = 13, locations = 1")
+ 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)
# Stop at 'std::string hello_world ("Hello World!");'.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['main.cpp:13',
+ substrs = ['main.cpp:%d' % self.line,
'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
Modified: lldb/trunk/test/stl/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/stl/main.cpp?rev=116358&r1=116357&r2=116358&view=diff
==============================================================================
--- lldb/trunk/test/stl/main.cpp (original)
+++ lldb/trunk/test/stl/main.cpp Tue Oct 12 17:53:02 2010
@@ -10,6 +10,6 @@
#include <string>
int main (int argc, char const *argv[])
{
- std::string hello_world ("Hello World!");
+ std::string hello_world ("Hello World!"); // Set break point at this line.
std::cout << hello_world << std::endl;
}
More information about the lldb-commits
mailing list