| Johnny Chen | b330786 | 2010-09-17 22:28:51 +0000 | [diff] [blame] | 1 | """ | 
|  | 2 | Set breakpoints on objective-c class and instance methods in foundation. | 
|  | 3 | Also lookup objective-c data types and evaluate expressions. | 
|  | 4 | """ | 
| Johnny Chen | 6c17c08 | 2010-09-16 20:54:06 +0000 | [diff] [blame] | 5 |  | 
|  | 6 | import os, time | 
|  | 7 | import unittest2 | 
|  | 8 | import lldb | 
|  | 9 | from lldbtest import * | 
|  | 10 |  | 
|  | 11 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") | 
|  | 12 | class FoundationTestCase(TestBase): | 
|  | 13 |  | 
| Johnny Chen | 23beac3 | 2011-06-25 20:55:22 +0000 | [diff] [blame^] | 14 | mydir = os.path.join("lang", "objc", "foundation") | 
| Johnny Chen | 6c17c08 | 2010-09-16 20:54:06 +0000 | [diff] [blame] | 15 |  | 
| Johnny Chen | b219d28 | 2010-09-17 21:14:02 +0000 | [diff] [blame] | 16 | def test_break_with_dsym(self): | 
| Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 17 | """Test setting objc breakpoints using '_regexp-break' and 'breakpoint set'.""" | 
| Johnny Chen | 6c17c08 | 2010-09-16 20:54:06 +0000 | [diff] [blame] | 18 | self.buildDsym() | 
|  | 19 | self.break_on_objc_methods() | 
|  | 20 |  | 
| Johnny Chen | b219d28 | 2010-09-17 21:14:02 +0000 | [diff] [blame] | 21 | def test_break_with_dwarf(self): | 
| Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 22 | """Test setting objc breakpoints using '_regexp-break' and 'breakpoint set'.""" | 
| Johnny Chen | 6c17c08 | 2010-09-16 20:54:06 +0000 | [diff] [blame] | 23 | self.buildDwarf() | 
|  | 24 | self.break_on_objc_methods() | 
|  | 25 |  | 
| Johnny Chen | 2769a42 | 2010-10-15 23:35:32 +0000 | [diff] [blame] | 26 | #@unittest2.expectedFailure | 
| Johnny Chen | f8afe89 | 2010-10-12 21:20:11 +0000 | [diff] [blame] | 27 | # rdar://problem/8542091 | 
| Johnny Chen | 8eb3850 | 2010-09-29 17:58:12 +0000 | [diff] [blame] | 28 | # rdar://problem/8492646 | 
| Johnny Chen | b330786 | 2010-09-17 22:28:51 +0000 | [diff] [blame] | 29 | def test_data_type_and_expr_with_dsym(self): | 
|  | 30 | """Lookup objective-c data types and evaluate expressions.""" | 
|  | 31 | self.buildDsym() | 
|  | 32 | self.data_type_and_expr_objc() | 
|  | 33 |  | 
| Johnny Chen | 2769a42 | 2010-10-15 23:35:32 +0000 | [diff] [blame] | 34 | #@unittest2.expectedFailure | 
| Johnny Chen | f8afe89 | 2010-10-12 21:20:11 +0000 | [diff] [blame] | 35 | # rdar://problem/8542091 | 
| Johnny Chen | 8eb3850 | 2010-09-29 17:58:12 +0000 | [diff] [blame] | 36 | # rdar://problem/8492646 | 
| Johnny Chen | b330786 | 2010-09-17 22:28:51 +0000 | [diff] [blame] | 37 | def test_data_type_and_expr_with_dwarf(self): | 
|  | 38 | """Lookup objective-c data types and evaluate expressions.""" | 
|  | 39 | self.buildDwarf() | 
|  | 40 | self.data_type_and_expr_objc() | 
|  | 41 |  | 
| Jim Ingham | 5949cfe | 2010-12-15 20:47:34 +0000 | [diff] [blame] | 42 | @python_api_test | 
|  | 43 | def test_print_ivars_correctly_with_dsym (self): | 
|  | 44 | self.buildDsym() | 
|  | 45 | self.print_ivars_correctly() | 
|  | 46 |  | 
|  | 47 | @python_api_test | 
|  | 48 | def test_print_ivars_correctly_with_dwarf (self): | 
|  | 49 | self.buildDwarf() | 
|  | 50 | self.print_ivars_correctly() | 
|  | 51 |  | 
| Johnny Chen | 6c17c08 | 2010-09-16 20:54:06 +0000 | [diff] [blame] | 52 | def break_on_objc_methods(self): | 
| Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 53 | """Test setting objc breakpoints using '_regexp-break' and 'breakpoint set'.""" | 
| Johnny Chen | 6c17c08 | 2010-09-16 20:54:06 +0000 | [diff] [blame] | 54 | exe = os.path.join(os.getcwd(), "a.out") | 
|  | 55 | self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) | 
|  | 56 |  | 
|  | 57 | # Stop at +[NSString stringWithFormat:]. | 
| Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 58 | self.expect("_regexp-break +[NSString stringWithFormat:]", BREAKPOINT_CREATED, | 
| Johnny Chen | f062c2f | 2010-10-12 19:29:49 +0000 | [diff] [blame] | 59 | substrs = ["Breakpoint created: 1: name = '+[NSString stringWithFormat:]', locations = 1"]) | 
| Johnny Chen | 6c17c08 | 2010-09-16 20:54:06 +0000 | [diff] [blame] | 60 |  | 
| Johnny Chen | 2756d60 | 2010-09-16 23:57:33 +0000 | [diff] [blame] | 61 | # Stop at -[MyString initWithNSString:]. | 
|  | 62 | self.expect("breakpoint set -n '-[MyString initWithNSString:]'", BREAKPOINT_CREATED, | 
|  | 63 | startstr = "Breakpoint created: 2: name = '-[MyString initWithNSString:]', locations = 1") | 
|  | 64 |  | 
|  | 65 | # Stop at the "description" selector. | 
|  | 66 | self.expect("breakpoint set -S description", BREAKPOINT_CREATED, | 
|  | 67 | startstr = "Breakpoint created: 3: name = 'description', locations = 1") | 
|  | 68 |  | 
| Johnny Chen | 6c17c08 | 2010-09-16 20:54:06 +0000 | [diff] [blame] | 69 | # Stop at -[NSAutoreleasePool release]. | 
| Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 70 | self.expect("_regexp-break -[NSAutoreleasePool release]", BREAKPOINT_CREATED, | 
| Johnny Chen | f062c2f | 2010-10-12 19:29:49 +0000 | [diff] [blame] | 71 | substrs = ["Breakpoint created: 4: name = '-[NSAutoreleasePool release]', locations = 1"]) | 
| Johnny Chen | 6c17c08 | 2010-09-16 20:54:06 +0000 | [diff] [blame] | 72 |  | 
|  | 73 | self.runCmd("run", RUN_SUCCEEDED) | 
|  | 74 |  | 
|  | 75 | # First stop is +[NSString stringWithFormat:]. | 
|  | 76 | self.expect("thread backtrace", "Stop at +[NSString stringWithFormat:]", | 
|  | 77 | substrs = ["Foundation`+[NSString stringWithFormat:]"]) | 
|  | 78 |  | 
|  | 79 | self.runCmd("process continue") | 
|  | 80 |  | 
| Johnny Chen | 73b7b93 | 2010-12-06 22:09:04 +0000 | [diff] [blame] | 81 | # Second stop is still +[NSString stringWithFormat:]. | 
|  | 82 | self.expect("thread backtrace", "Stop at +[NSString stringWithFormat:]", | 
|  | 83 | substrs = ["Foundation`+[NSString stringWithFormat:]"]) | 
|  | 84 |  | 
|  | 85 | self.runCmd("process continue") | 
|  | 86 |  | 
| Johnny Chen | 2756d60 | 2010-09-16 23:57:33 +0000 | [diff] [blame] | 87 | # Followed by a.out`-[MyString initWithNSString:]. | 
|  | 88 | self.expect("thread backtrace", "Stop at a.out`-[MyString initWithNSString:]", | 
|  | 89 | substrs = ["a.out`-[MyString initWithNSString:]"]) | 
|  | 90 |  | 
|  | 91 | self.runCmd("process continue") | 
|  | 92 |  | 
|  | 93 | # Followed by -[MyString description]. | 
|  | 94 | self.expect("thread backtrace", "Stop at -[MyString description]", | 
|  | 95 | substrs = ["a.out`-[MyString description]"]) | 
|  | 96 |  | 
|  | 97 | self.runCmd("process continue") | 
|  | 98 |  | 
| Johnny Chen | 73b7b93 | 2010-12-06 22:09:04 +0000 | [diff] [blame] | 99 | # Followed by the same -[MyString description]. | 
|  | 100 | self.expect("thread backtrace", "Stop at -[MyString description]", | 
|  | 101 | substrs = ["a.out`-[MyString description]"]) | 
|  | 102 |  | 
|  | 103 | self.runCmd("process continue") | 
|  | 104 |  | 
| Johnny Chen | 6c17c08 | 2010-09-16 20:54:06 +0000 | [diff] [blame] | 105 | # Followed by -[NSAutoreleasePool release]. | 
|  | 106 | self.expect("thread backtrace", "Stop at -[NSAutoreleasePool release]", | 
|  | 107 | substrs = ["Foundation`-[NSAutoreleasePool release]"]) | 
|  | 108 |  | 
| Johnny Chen | f8afe89 | 2010-10-12 21:20:11 +0000 | [diff] [blame] | 109 | def setUp(self): | 
| Johnny Chen | aadcef5 | 2010-10-14 17:31:24 +0000 | [diff] [blame] | 110 | # Call super's setUp(). | 
|  | 111 | TestBase.setUp(self) | 
| Johnny Chen | f8afe89 | 2010-10-12 21:20:11 +0000 | [diff] [blame] | 112 | # Find the line number to break inside main(). | 
| Jim Ingham | 5949cfe | 2010-12-15 20:47:34 +0000 | [diff] [blame] | 113 | self.main_source = "main.m" | 
|  | 114 | self.line = line_number(self.main_source, '// Set break point at this line.') | 
| Johnny Chen | f8afe89 | 2010-10-12 21:20:11 +0000 | [diff] [blame] | 115 |  | 
| Johnny Chen | b330786 | 2010-09-17 22:28:51 +0000 | [diff] [blame] | 116 | def data_type_and_expr_objc(self): | 
|  | 117 | """Lookup objective-c data types and evaluate expressions.""" | 
|  | 118 | exe = os.path.join(os.getcwd(), "a.out") | 
|  | 119 | self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) | 
|  | 120 |  | 
|  | 121 | # Stop at -[MyString description]. | 
|  | 122 | self.expect("breakpoint set -n '-[MyString description]", BREAKPOINT_CREATED, | 
|  | 123 | startstr = "Breakpoint created: 1: name = '-[MyString description]', locations = 1") | 
|  | 124 |  | 
|  | 125 | self.runCmd("run", RUN_SUCCEEDED) | 
|  | 126 |  | 
|  | 127 | # The backtrace should show we stop at -[MyString description]. | 
|  | 128 | self.expect("thread backtrace", "Stop at -[MyString description]", | 
|  | 129 | substrs = ["a.out`-[MyString description]"]) | 
|  | 130 |  | 
|  | 131 | # Lookup objc data type MyString and evaluate some expressions. | 
|  | 132 |  | 
|  | 133 | self.expect("image lookup -t NSString", DATA_TYPES_DISPLAYED_CORRECTLY, | 
| Johnny Chen | 620f9d1 | 2010-09-29 17:50:35 +0000 | [diff] [blame] | 134 | substrs = ['name = "NSString"', | 
| Johnny Chen | f8afe89 | 2010-10-12 21:20:11 +0000 | [diff] [blame] | 135 | 'clang_type = "@interface NSString']) | 
| Johnny Chen | b330786 | 2010-09-17 22:28:51 +0000 | [diff] [blame] | 136 |  | 
|  | 137 | self.expect("image lookup -t MyString", DATA_TYPES_DISPLAYED_CORRECTLY, | 
| Johnny Chen | 620f9d1 | 2010-09-29 17:50:35 +0000 | [diff] [blame] | 138 | substrs = ['name = "MyString"', | 
| Johnny Chen | f8afe89 | 2010-10-12 21:20:11 +0000 | [diff] [blame] | 139 | 'clang_type = "@interface MyString', | 
|  | 140 | 'NSString * str;', | 
|  | 141 | 'NSDate * date;']) | 
| Johnny Chen | b330786 | 2010-09-17 22:28:51 +0000 | [diff] [blame] | 142 |  | 
| Jim Ingham | 2837b76 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 143 | self.expect("frame variable -T -s", VARIABLES_DISPLAYED_CORRECTLY, | 
| Johnny Chen | 7fce877 | 2010-10-01 23:34:28 +0000 | [diff] [blame] | 144 | substrs = ["ARG: (MyString *) self"], | 
|  | 145 | patterns = ["ARG: \(.*\) _cmd", | 
|  | 146 | "(struct objc_selector *)|(SEL)"]) | 
| Johnny Chen | b330786 | 2010-09-17 22:28:51 +0000 | [diff] [blame] | 147 |  | 
| Johnny Chen | 07f06c4 | 2010-11-11 19:15:04 +0000 | [diff] [blame] | 148 | # rdar://problem/8651752 | 
|  | 149 | # don't crash trying to ask clang how many children an empty record has | 
|  | 150 | self.runCmd("frame variable *_cmd") | 
|  | 151 |  | 
| Johnny Chen | 8eb3850 | 2010-09-29 17:58:12 +0000 | [diff] [blame] | 152 | # rdar://problem/8492646 | 
|  | 153 | # test/foundation fails after updating to tot r115023 | 
|  | 154 | # self->str displays nothing as output | 
| Jim Ingham | 2837b76 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 155 | self.expect("frame variable -T self->str", VARIABLES_DISPLAYED_CORRECTLY, | 
| Johnny Chen | b330786 | 2010-09-17 22:28:51 +0000 | [diff] [blame] | 156 | startstr = "(NSString *) self->str") | 
|  | 157 |  | 
|  | 158 | # rdar://problem/8447030 | 
|  | 159 | # 'frame variable self->date' displays the wrong data member | 
| Jim Ingham | 2837b76 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 160 | self.expect("frame variable -T self->date", VARIABLES_DISPLAYED_CORRECTLY, | 
| Johnny Chen | b330786 | 2010-09-17 22:28:51 +0000 | [diff] [blame] | 161 | startstr = "(NSDate *) self->date") | 
|  | 162 |  | 
| Johnny Chen | f8afe89 | 2010-10-12 21:20:11 +0000 | [diff] [blame] | 163 | # This should display the str and date member fields as well. | 
| Jim Ingham | 2837b76 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 164 | self.expect("frame variable -T *self", VARIABLES_DISPLAYED_CORRECTLY, | 
| Johnny Chen | 8e74416 | 2010-12-15 22:50:54 +0000 | [diff] [blame] | 165 | substrs = ["(MyString) *self", | 
| Johnny Chen | f8afe89 | 2010-10-12 21:20:11 +0000 | [diff] [blame] | 166 | "(NSString *) str", | 
|  | 167 | "(NSDate *) date"]) | 
|  | 168 |  | 
|  | 169 | # This should fail expectedly. | 
| Johnny Chen | a8807f9 | 2010-10-19 00:52:07 +0000 | [diff] [blame] | 170 | self.expect("expression self->non_existent_member", | 
|  | 171 | COMMAND_FAILED_AS_EXPECTED, error=True, | 
| Johnny Chen | f8afe89 | 2010-10-12 21:20:11 +0000 | [diff] [blame] | 172 | startstr = "error: 'MyString' does not have a member named 'non_existent_member'") | 
|  | 173 |  | 
| Johnny Chen | f8afe89 | 2010-10-12 21:20:11 +0000 | [diff] [blame] | 174 | # Use expression parser. | 
| Johnny Chen | 99ff489 | 2010-11-12 00:55:31 +0000 | [diff] [blame] | 175 | self.runCmd("expression self->str") | 
|  | 176 | self.runCmd("expression self->date") | 
| Johnny Chen | 2e566e0 | 2010-09-29 18:05:03 +0000 | [diff] [blame] | 177 |  | 
| Johnny Chen | a8807f9 | 2010-10-19 00:52:07 +0000 | [diff] [blame] | 178 | # (lldb) expression self->str | 
| Johnny Chen | f8afe89 | 2010-10-12 21:20:11 +0000 | [diff] [blame] | 179 | # error: instance variable 'str' is protected | 
| Johnny Chen | b330786 | 2010-09-17 22:28:51 +0000 | [diff] [blame] | 180 | # error: 1 errors parsing expression | 
| Johnny Chen | f8afe89 | 2010-10-12 21:20:11 +0000 | [diff] [blame] | 181 | # | 
| Johnny Chen | a8807f9 | 2010-10-19 00:52:07 +0000 | [diff] [blame] | 182 | # (lldb) expression self->date | 
| Johnny Chen | f8afe89 | 2010-10-12 21:20:11 +0000 | [diff] [blame] | 183 | # error: instance variable 'date' is protected | 
| Johnny Chen | b330786 | 2010-09-17 22:28:51 +0000 | [diff] [blame] | 184 | # error: 1 errors parsing expression | 
| Johnny Chen | f8afe89 | 2010-10-12 21:20:11 +0000 | [diff] [blame] | 185 | # | 
|  | 186 |  | 
| Johnny Chen | 7987c61 | 2010-10-15 19:29:15 +0000 | [diff] [blame] | 187 | self.runCmd("breakpoint delete 1") | 
| Johnny Chen | f8afe89 | 2010-10-12 21:20:11 +0000 | [diff] [blame] | 188 | self.expect("breakpoint set -f main.m -l %d" % self.line, | 
|  | 189 | BREAKPOINT_CREATED, | 
|  | 190 | startstr = "Breakpoint created: 2: file ='main.m', line = %d, locations = 1" % | 
|  | 191 | self.line) | 
|  | 192 | self.runCmd("process continue") | 
|  | 193 |  | 
| Johnny Chen | f8afe89 | 2010-10-12 21:20:11 +0000 | [diff] [blame] | 194 | # rdar://problem/8542091 | 
|  | 195 | # test/foundation: expr -o -- my not working? | 
|  | 196 | # | 
|  | 197 | # Test new feature with r115115: | 
|  | 198 | # Add "-o" option to "expression" which prints the object description if available. | 
| Johnny Chen | a8807f9 | 2010-10-19 00:52:07 +0000 | [diff] [blame] | 199 | self.expect("expression -o -- my", "Object description displayed correctly", | 
| Johnny Chen | 2769a42 | 2010-10-15 23:35:32 +0000 | [diff] [blame] | 200 | patterns = ["Hello from.*a.out.*with timestamp: "]) | 
| Johnny Chen | b330786 | 2010-09-17 22:28:51 +0000 | [diff] [blame] | 201 |  | 
| Jim Ingham | 5949cfe | 2010-12-15 20:47:34 +0000 | [diff] [blame] | 202 | @unittest2.expectedFailure | 
|  | 203 | # See: <rdar://problem/8717050> lldb needs to use the ObjC runtime symbols for ivar offsets | 
|  | 204 | # Only fails for the ObjC 2.0 runtime. | 
|  | 205 | def print_ivars_correctly(self) : | 
|  | 206 | exe = os.path.join(os.getcwd(), "a.out") | 
| Johnny Chen | 6c17c08 | 2010-09-16 20:54:06 +0000 | [diff] [blame] | 207 |  | 
| Jim Ingham | 5949cfe | 2010-12-15 20:47:34 +0000 | [diff] [blame] | 208 | target = self.dbg.CreateTarget(exe) | 
| Johnny Chen | 4ebd019 | 2011-05-24 18:22:45 +0000 | [diff] [blame] | 209 | self.assertTrue(target, VALID_TARGET) | 
| Jim Ingham | 5949cfe | 2010-12-15 20:47:34 +0000 | [diff] [blame] | 210 |  | 
|  | 211 | break1 = target.BreakpointCreateByLocation(self.main_source, self.line) | 
| Johnny Chen | 4ebd019 | 2011-05-24 18:22:45 +0000 | [diff] [blame] | 212 | self.assertTrue(break1, VALID_BREAKPOINT) | 
| Jim Ingham | 5949cfe | 2010-12-15 20:47:34 +0000 | [diff] [blame] | 213 |  | 
|  | 214 | # Now launch the process, and do not stop at entry point. | 
| Greg Clayton | 6f907e6 | 2011-01-23 17:46:22 +0000 | [diff] [blame] | 215 | error = lldb.SBError() | 
| Johnny Chen | 5a0bee7 | 2011-06-15 22:14:12 +0000 | [diff] [blame] | 216 | process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error) | 
| Jim Ingham | 5949cfe | 2010-12-15 20:47:34 +0000 | [diff] [blame] | 217 |  | 
| Johnny Chen | 5a0bee7 | 2011-06-15 22:14:12 +0000 | [diff] [blame] | 218 | self.assertTrue(process, PROCESS_IS_VALID) | 
| Jim Ingham | 5949cfe | 2010-12-15 20:47:34 +0000 | [diff] [blame] | 219 |  | 
|  | 220 | # The stop reason of the thread should be breakpoint. | 
| Johnny Chen | 5a0bee7 | 2011-06-15 22:14:12 +0000 | [diff] [blame] | 221 | thread = process.GetThreadAtIndex(0) | 
| Jim Ingham | 5949cfe | 2010-12-15 20:47:34 +0000 | [diff] [blame] | 222 | if thread.GetStopReason() != lldb.eStopReasonBreakpoint: | 
| Johnny Chen | de90f1d | 2011-04-27 17:43:07 +0000 | [diff] [blame] | 223 | from lldbutil import stop_reason_to_str | 
| Jim Ingham | 5949cfe | 2010-12-15 20:47:34 +0000 | [diff] [blame] | 224 | self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS % | 
| Johnny Chen | de90f1d | 2011-04-27 17:43:07 +0000 | [diff] [blame] | 225 | stop_reason_to_str(thread.GetStopReason())) | 
| Jim Ingham | 5949cfe | 2010-12-15 20:47:34 +0000 | [diff] [blame] | 226 |  | 
|  | 227 | # Make sure we stopped at the first breakpoint. | 
|  | 228 |  | 
|  | 229 | cur_frame = thread.GetFrameAtIndex(0) | 
|  | 230 |  | 
|  | 231 | line_number = cur_frame.GetLineEntry().GetLine() | 
|  | 232 | self.assertTrue (line_number == self.line, "Hit the first breakpoint.") | 
|  | 233 |  | 
|  | 234 | my_var = cur_frame.FindVariable("my") | 
| Johnny Chen | 4ebd019 | 2011-05-24 18:22:45 +0000 | [diff] [blame] | 235 | self.assertTrue(my_var, "Made a variable object for my") | 
| Jim Ingham | 5949cfe | 2010-12-15 20:47:34 +0000 | [diff] [blame] | 236 |  | 
|  | 237 | str_var = cur_frame.FindVariable("str") | 
| Johnny Chen | 4ebd019 | 2011-05-24 18:22:45 +0000 | [diff] [blame] | 238 | self.assertTrue(str_var, "Made a variable object for str") | 
| Jim Ingham | 5949cfe | 2010-12-15 20:47:34 +0000 | [diff] [blame] | 239 |  | 
|  | 240 | # Now make sure that the my->str == str: | 
|  | 241 |  | 
|  | 242 | my_str_var = my_var.GetChildMemberWithName("str") | 
| Johnny Chen | 4ebd019 | 2011-05-24 18:22:45 +0000 | [diff] [blame] | 243 | self.assertTrue(my_str_var, "Found a str ivar in my") | 
| Jim Ingham | 5949cfe | 2010-12-15 20:47:34 +0000 | [diff] [blame] | 244 |  | 
|  | 245 | str_value = int(str_var.GetValue(cur_frame), 0) | 
|  | 246 |  | 
|  | 247 | my_str_value = int(my_str_var.GetValue(cur_frame), 0) | 
|  | 248 |  | 
|  | 249 | self.assertTrue(str_value == my_str_value, "Got the correct value for my->str") | 
|  | 250 |  | 
| Johnny Chen | 6c17c08 | 2010-09-16 20:54:06 +0000 | [diff] [blame] | 251 | if __name__ == '__main__': | 
|  | 252 | import atexit | 
|  | 253 | lldb.SBDebugger.Initialize() | 
|  | 254 | atexit.register(lambda: lldb.SBDebugger.Terminate()) | 
|  | 255 | unittest2.main() |