summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2010-10-12 21:52:29 +0000
committerJohnny Chen <johnny.chen@apple.com>2010-10-12 21:52:29 +0000
commit48daa1fddbe68cd388aaafed6472b23c6efb4f18 (patch)
tree022e29c862269e935934d1686d42130f2c8e1e67
parent370799c272dfccf51a80a16fda4663bcf004455c (diff)
downloadbcm5719-llvm-48daa1fddbe68cd388aaafed6472b23c6efb4f18.tar.gz
bcm5719-llvm-48daa1fddbe68cd388aaafed6472b23c6efb4f18.zip
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: 116344
-rw-r--r--lldb/test/breakpoint_command/TestBreakpointCommand.py31
-rw-r--r--lldb/test/breakpoint_command/main.c2
2 files changed, 22 insertions, 11 deletions
diff --git a/lldb/test/breakpoint_command/TestBreakpointCommand.py b/lldb/test/breakpoint_command/TestBreakpointCommand.py
index f3a35807ebf..d14d51063e0 100644
--- a/lldb/test/breakpoint_command/TestBreakpointCommand.py
+++ b/lldb/test/breakpoint_command/TestBreakpointCommand.py
@@ -26,16 +26,25 @@ class BreakpointCommandTestCase(TestBase):
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 @@ class BreakpointCommandTestCase(TestBase):
# 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 @@ class BreakpointCommandTestCase(TestBase):
# 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)
diff --git a/lldb/test/breakpoint_command/main.c b/lldb/test/breakpoint_command/main.c
index 343eac7e554..62ec97f4328 100644
--- a/lldb/test/breakpoint_command/main.c
+++ b/lldb/test/breakpoint_command/main.c
@@ -9,5 +9,5 @@
int main (int argc, char const *argv[])
{
- return 0;
+ return 0; // Set break point at this line.
}
OpenPOWER on IntegriCloud