[Lldb-commits] [lldb] r116344 - in /lldb/trunk/test/breakpoint_command: TestBreakpointCommand.py main.c
Johnny Chen
johnny.chen at apple.com
Tue Oct 12 14:52:30 PDT 2010
Author: johnny
Date: Tue Oct 12 16:52:29 2010
New Revision: 116344
URL: http://llvm.org/viewvc/llvm-project?rev=116344&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/breakpoint_command/TestBreakpointCommand.py
lldb/trunk/test/breakpoint_command/main.c
Modified: lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py?rev=116344&r1=116343&r2=116344&view=diff
==============================================================================
--- lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py (original)
+++ lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py Tue Oct 12 16:52:29 2010
@@ -26,16 +26,25 @@
self.buildDwarf()
self.breakpoint_command_sequence()
+ def setUp(self):
+ super(BreakpointCommandTestCase, self).setUp()
+ # Find the line number to break inside main().
+ self.line = line_number('main.c', '// Set break point at this line.')
+
def breakpoint_command_sequence(self):
"""Test a sequence of breakpoint command add, list, and remove."""
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add two breakpoints on the same line.
- self.expect("breakpoint set -f main.c -l 12", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = 12, locations = 1")
- self.expect("breakpoint set -f main.c -l 12", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 2: file ='main.c', line = 12, locations = 1")
+ self.expect("breakpoint set -f main.c -l %d" % self.line,
+ BREAKPOINT_CREATED,
+ startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
+ self.line)
+ self.expect("breakpoint set -f main.c -l %d" % self.line,
+ BREAKPOINT_CREATED,
+ startstr = "Breakpoint created: 2: file ='main.c', line = %d, locations = 1" %
+ self.line)
# Now add callbacks for the breakpoints just created.
self.runCmd("breakpoint command add -c -o 'frame variable -s' 1")
@@ -45,10 +54,10 @@
# The breakpoint list now only contains breakpoint 1.
self.expect("breakpoint list", "Breakpoints 1 & 2 created",
- substrs = ["1: file ='main.c', line = 12, locations = 1",
- "2: file ='main.c', line = 12, locations = 1"],
- patterns = ["1.1: .+at main.c:12, .+unresolved, hit count = 0",
- "2.1: .+at main.c:12, .+unresolved, hit count = 0"])
+ substrs = ["1: file ='main.c', line = %d, locations = 1" % self.line,
+ "2: file ='main.c', line = %d, locations = 1" % self.line],
+ patterns = ["1.1: .+at main.c:%d, .+unresolved, hit count = 0" % self.line,
+ "2.1: .+at main.c:%d, .+unresolved, hit count = 0" % self.line])
self.expect("breakpoint command list 1", "Breakpoint 1 command ok",
substrs = ["Breakpoint commands:",
@@ -87,12 +96,14 @@
# The breakpoint list now only contains breakpoint 1.
self.expect("breakpoint list", "Breakpoint 1 exists",
- substrs = ["1: file ='main.c', line = 12, locations = 1, resolved = 1",
+ substrs = ["1: file ='main.c', line = %d, locations = 1, resolved = 1" %
+ self.line,
"hit count = 1"])
# Not breakpoint 2.
self.expect("breakpoint list", "No more breakpoint 2", matching=False,
- substrs = ["2: file ='main.c', line = 12, locations = 1, resolved = 1"])
+ substrs = ["2: file ='main.c', line = %d, locations = 1, resolved = 1" %
+ self.line])
# Run the program again, with breakpoint 1 remaining.
self.runCmd("run", RUN_SUCCEEDED)
Modified: lldb/trunk/test/breakpoint_command/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/breakpoint_command/main.c?rev=116344&r1=116343&r2=116344&view=diff
==============================================================================
--- lldb/trunk/test/breakpoint_command/main.c (original)
+++ lldb/trunk/test/breakpoint_command/main.c Tue Oct 12 16:52:29 2010
@@ -9,5 +9,5 @@
int main (int argc, char const *argv[])
{
- return 0;
+ return 0; // Set break point at this line.
}
More information about the lldb-commits
mailing list