OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 #include "vm/ast_printer.h" | 6 #include "vm/ast_printer.h" |
7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
8 #include "vm/debugger.h" | 8 #include "vm/debugger.h" |
9 #include "vm/longjump.h" | 9 #include "vm/longjump.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 241 |
242 | 242 |
243 // Uses the debugger to pause the program and capture the variable | 243 // Uses the debugger to pause the program and capture the variable |
244 // descriptors for all frames on the stack. | 244 // descriptors for all frames on the stack. |
245 static const char* CaptureVarsAtLine(Dart_Handle lib, | 245 static const char* CaptureVarsAtLine(Dart_Handle lib, |
246 const char* entry, | 246 const char* entry, |
247 int line) { | 247 int line) { |
248 EXPECT(ClassFinalizer::ProcessPendingClasses()); | 248 EXPECT(ClassFinalizer::ProcessPendingClasses()); |
249 bool saved_flag = FLAG_show_invisible_frames; | 249 bool saved_flag = FLAG_show_invisible_frames; |
250 FLAG_show_invisible_frames = true; | 250 FLAG_show_invisible_frames = true; |
251 Isolate* isolate = Isolate::Current(); | |
252 Debugger* debugger = isolate->debugger(); | |
253 const String& url = String::Handle(String::New(TestCase::url())); | |
254 Dart_SetPausedEventHandler(SaveVars); | 251 Dart_SetPausedEventHandler(SaveVars); |
255 debugger->SetBreakpointAtLine(url, line); | 252 EXPECT_VALID(Dart_SetBreakpoint(NewString(TestCase::url()), line)); |
256 saved_vars = NULL; | 253 saved_vars = NULL; |
257 EXPECT_VALID(Dart_Invoke(lib, NewString(entry), 0, NULL)); | 254 EXPECT_VALID(Dart_Invoke(lib, NewString(entry), 0, NULL)); |
258 const char* tmp = saved_vars; | 255 const char* tmp = saved_vars; |
259 saved_vars = NULL; | 256 saved_vars = NULL; |
260 FLAG_show_invisible_frames = saved_flag; | 257 FLAG_show_invisible_frames = saved_flag; |
261 return tmp; | 258 return tmp; |
262 } | 259 } |
263 | 260 |
264 | 261 |
265 TEST_CASE(Parser_AllocateVariables_CapturedVar) { | 262 TEST_CASE(Parser_AllocateVariables_CapturedVar) { |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 " name=:current_context_var\n" | 570 " name=:current_context_var\n" |
574 " 1 ContextLevel level=1 scope=2 begin=3 end=79\n" | 571 " 1 ContextLevel level=1 scope=2 begin=3 end=79\n" |
575 " 2 ContextVar level=1 begin=9 end=79 name=x\n" | 572 " 2 ContextVar level=1 begin=9 end=79 name=x\n" |
576 " 3 StackVar scope=2 begin=11 end=79 name=b\n", | 573 " 3 StackVar scope=2 begin=11 end=79 name=b\n", |
577 CaptureVarsAtLine(lib, "a", 10)); | 574 CaptureVarsAtLine(lib, "a", 10)); |
578 } | 575 } |
579 | 576 |
580 #endif // !PRODUCT | 577 #endif // !PRODUCT |
581 | 578 |
582 } // namespace dart | 579 } // namespace dart |
OLD | NEW |