[Lldb-commits] [lldb] r116355 - in /lldb/trunk/test/global_variables: TestGlobalVariables.py main.c
Johnny Chen
johnny.chen at apple.com
Tue Oct 12 15:35:26 PDT 2010
Author: johnny
Date: Tue Oct 12 17:35:26 2010
New Revision: 116355
URL: http://llvm.org/viewvc/llvm-project?rev=116355&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().
Also modify main.c to use g_file_static_cstr within main() so clang does not
optimize this variable out.
Modified:
lldb/trunk/test/global_variables/TestGlobalVariables.py
lldb/trunk/test/global_variables/main.c
Modified: lldb/trunk/test/global_variables/TestGlobalVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/global_variables/TestGlobalVariables.py?rev=116355&r1=116354&r2=116355&view=diff
==============================================================================
--- lldb/trunk/test/global_variables/TestGlobalVariables.py (original)
+++ lldb/trunk/test/global_variables/TestGlobalVariables.py Tue Oct 12 17:35:26 2010
@@ -20,14 +20,21 @@
self.buildDwarf()
self.global_variables()
+ def setUp(self):
+ super(GlobalVariablesTestCase, self).setUp()
+ # Find the line number to break inside main().
+ self.line = line_number('main.c', '// Set break point at this line.')
+
def global_variables(self):
"""Test 'frame variable -s -a' which omits args and shows scopes."""
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 20", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = 20, 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)
Modified: lldb/trunk/test/global_variables/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/global_variables/main.c?rev=116355&r1=116354&r2=116355&view=diff
==============================================================================
--- lldb/trunk/test/global_variables/main.c (original)
+++ lldb/trunk/test/global_variables/main.c Tue Oct 12 17:35:26 2010
@@ -16,6 +16,6 @@
int main (int argc, char const *argv[])
{
static const char *g_func_static_cstr = "g_func_static_cstr";
- printf ("%s\n", g_file_global_cstr);
- return g_file_global_int + g_a; //// break $source:$line; continue; var -global g_a -global g_global_int
+ printf ("%s %s\n", g_file_global_cstr, g_file_static_cstr);
+ return g_file_global_int + g_a; // Set break point at this line. //// break $source:$line; continue; var -global g_a -global g_global_int
}
More information about the lldb-commits
mailing list