[Lldb-commits] [lldb] r116275 - in /lldb/trunk/test: bitfields/TestBitfields.py bitfields/main.c lldbtest.py
Johnny Chen
johnny.chen at apple.com
Mon Oct 11 17:09:25 PDT 2010
Author: johnny
Date: Mon Oct 11 19:09:25 2010
New Revision: 116275
URL: http://llvm.org/viewvc/llvm-project?rev=116275&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/bitfields/TestBitfields.py
lldb/trunk/test/bitfields/main.c
lldb/trunk/test/lldbtest.py
Modified: lldb/trunk/test/bitfields/TestBitfields.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/bitfields/TestBitfields.py?rev=116275&r1=116274&r2=116275&view=diff
==============================================================================
--- lldb/trunk/test/bitfields/TestBitfields.py (original)
+++ lldb/trunk/test/bitfields/TestBitfields.py Mon Oct 11 19:09:25 2010
@@ -31,14 +31,21 @@
self.buildDwarf()
self.bitfields_variable_python()
+ def setUp(self):
+ super(BitfieldsTestCase, self).setUp()
+ # Find the line number to break inside main().
+ self.line = line_number('main.c', '// Set break point at this line.')
+
def bitfields_variable(self):
"""Test 'frame variable ...' on a variable with bitfields."""
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- self.expect("breakpoint set -f main.c -l 42", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = 42, 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.runCmd("run", RUN_SUCCEEDED)
@@ -81,7 +88,7 @@
target = self.dbg.CreateTarget(exe)
self.assertTrue(target.IsValid(), VALID_TARGET)
- breakpoint = target.BreakpointCreateByLocation("main.c", 42)
+ breakpoint = target.BreakpointCreateByLocation("main.c", self.line)
self.assertTrue(breakpoint.IsValid(), VALID_BREAKPOINT)
self.runCmd("run", RUN_SUCCEEDED, setCookie=False)
Modified: lldb/trunk/test/bitfields/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/bitfields/main.c?rev=116275&r1=116274&r2=116275&view=diff
==============================================================================
--- lldb/trunk/test/bitfields/main.c (original)
+++ lldb/trunk/test/bitfields/main.c Mon Oct 11 19:09:25 2010
@@ -39,6 +39,6 @@
bits.b7 = i; //// break $source:$line
for (i=0; i<(1<<4); i++)
bits.four = i; //// break $source:$line
- return 0; //// continue
+ return 0; //// Set break point at this line.
}
Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=116275&r1=116274&r2=116275&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Mon Oct 11 19:09:25 2010
@@ -232,7 +232,7 @@
for i, line in enumerate(f):
if line.find(string_to_match) != -1:
# Found our match.
- return i
+ return i+1
return -1
def pointer_size():
More information about the lldb-commits
mailing list