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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 197 |
198 output[0] = '\0'; | 198 output[0] = '\0'; |
199 return output_buffer; | 199 return output_buffer; |
200 } | 200 } |
201 | 201 |
202 | 202 |
203 // Saves the var descriptors for all frames on the stack as a string. | 203 // Saves the var descriptors for all frames on the stack as a string. |
204 static void SaveVars(Dart_IsolateId isolate_id, | 204 static void SaveVars(Dart_IsolateId isolate_id, |
205 intptr_t bp_id, | 205 intptr_t bp_id, |
206 const Dart_CodeLocation& loc) { | 206 const Dart_CodeLocation& loc) { |
| 207 ASSERT(Isolate::Current()->debugger() != NULL); |
207 DebuggerStackTrace* stack = | 208 DebuggerStackTrace* stack = |
208 Isolate::Current()->debugger()->StackTrace(); | 209 Isolate::Current()->debugger()->StackTrace(); |
209 intptr_t num_frames = stack->Length(); | 210 intptr_t num_frames = stack->Length(); |
210 const int kBufferLen = 2048; | 211 const int kBufferLen = 2048; |
211 char* buffer = new char[kBufferLen]; | 212 char* buffer = new char[kBufferLen]; |
212 char* pos = buffer; | 213 char* pos = buffer; |
213 LocalVarDescriptors& var_desc = LocalVarDescriptors::Handle(); | 214 LocalVarDescriptors& var_desc = LocalVarDescriptors::Handle(); |
214 for (intptr_t i = 0; i < num_frames; i++) { | 215 for (intptr_t i = 0; i < num_frames; i++) { |
215 ActivationFrame* frame = stack->FrameAt(i); | 216 ActivationFrame* frame = stack->FrameAt(i); |
216 var_desc = frame->code().GetLocalVarDescriptors(); | 217 var_desc = frame->code().GetLocalVarDescriptors(); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 "a\n" | 560 "a\n" |
560 " 0 CurrentCtx scope=0 begin=0 end=0" | 561 " 0 CurrentCtx scope=0 begin=0 end=0" |
561 " name=:current_context_var\n" | 562 " name=:current_context_var\n" |
562 " 1 ContextLevel level=1 scope=2 begin=3 end=79\n" | 563 " 1 ContextLevel level=1 scope=2 begin=3 end=79\n" |
563 " 2 ContextVar level=1 begin=9 end=79 name=x\n" | 564 " 2 ContextVar level=1 begin=9 end=79 name=x\n" |
564 " 3 StackVar scope=2 begin=11 end=79 name=b\n", | 565 " 3 StackVar scope=2 begin=11 end=79 name=b\n", |
565 CaptureVarsAtLine(lib, "a", 10)); | 566 CaptureVarsAtLine(lib, "a", 10)); |
566 } | 567 } |
567 | 568 |
568 } // namespace dart | 569 } // namespace dart |
OLD | NEW |