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 #include "vm/exceptions.h" | 5 #include "vm/exceptions.h" |
6 | 6 |
7 #include "vm/dart_api_impl.h" | 7 #include "vm/dart_api_impl.h" |
8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
9 #include "vm/debugger.h" | 9 #include "vm/debugger.h" |
10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
(...skipping 24 matching lines...) Expand all Loading... | |
35 const GrowableObjectArray& code_list, | 35 const GrowableObjectArray& code_list, |
36 const GrowableObjectArray& pc_offset_list) { | 36 const GrowableObjectArray& pc_offset_list) { |
37 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames); | 37 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames); |
38 StackFrame* frame = frames.NextFrame(); | 38 StackFrame* frame = frames.NextFrame(); |
39 ASSERT(frame != NULL); // We expect to find a dart invocation frame. | 39 ASSERT(frame != NULL); // We expect to find a dart invocation frame. |
40 Function& func = Function::Handle(); | 40 Function& func = Function::Handle(); |
41 Code& code = Code::Handle(); | 41 Code& code = Code::Handle(); |
42 Smi& offset = Smi::Handle(); | 42 Smi& offset = Smi::Handle(); |
43 while (!frame->IsEntryFrame()) { | 43 while (!frame->IsEntryFrame()) { |
44 if (frame->IsDartFrame()) { | 44 if (frame->IsDartFrame()) { |
45 func = frame->LookupDartFunction(); | |
46 code = frame->LookupDartCode(); | 45 code = frame->LookupDartCode(); |
47 offset = Smi::New(frame->pc() - code.EntryPoint()); | 46 if (code.is_optimized()) { |
48 func_list.Add(func); | 47 // For optimized frames, extract all the inlined functions if any |
49 code_list.Add(code); | 48 // into the stack trace. |
50 pc_offset_list.Add(offset); | 49 OptimizedDartFrameIterator optimized_frames(frame); |
50 while (true) { | |
51 uword pc = 0; | |
52 func = optimized_frames.GetNextFunction(&pc); | |
53 if (func.IsNull()) { | |
54 break; | |
55 } | |
srdjan
2013/01/10 21:53:57
ASSERT(pc != 0);
siva
2013/01/12 00:20:54
Done.
| |
56 code = func.unoptimized_code(); | |
57 offset = Smi::New(pc - code.EntryPoint()); | |
58 func_list.Add(func); | |
59 code_list.Add(code); | |
60 pc_offset_list.Add(offset); | |
61 } | |
62 } else { | |
63 offset = Smi::New(frame->pc() - code.EntryPoint()); | |
64 func = code.function(); | |
65 func_list.Add(func); | |
66 code_list.Add(code); | |
67 pc_offset_list.Add(offset); | |
68 } | |
51 if (frame->FindExceptionHandler(handler_pc)) { | 69 if (frame->FindExceptionHandler(handler_pc)) { |
52 *handler_sp = frame->sp(); | 70 *handler_sp = frame->sp(); |
53 *handler_fp = frame->fp(); | 71 *handler_fp = frame->fp(); |
54 return true; | 72 return true; |
55 } | 73 } |
56 } | 74 } |
57 frame = frames.NextFrame(); | 75 frame = frames.NextFrame(); |
58 ASSERT(frame != NULL); | 76 ASSERT(frame != NULL); |
59 } | 77 } |
60 ASSERT(frame->IsEntryFrame()); | 78 ASSERT(frame->IsEntryFrame()); |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
445 case kIsolateUnhandledException: | 463 case kIsolateUnhandledException: |
446 library = Library::IsolateLibrary(); | 464 library = Library::IsolateLibrary(); |
447 class_name = &Symbols::IsolateUnhandledException(); | 465 class_name = &Symbols::IsolateUnhandledException(); |
448 break; | 466 break; |
449 } | 467 } |
450 | 468 |
451 return DartLibraryCalls::ExceptionCreate(library, *class_name, arguments); | 469 return DartLibraryCalls::ExceptionCreate(library, *class_name, arguments); |
452 } | 470 } |
453 | 471 |
454 } // namespace dart | 472 } // namespace dart |
OLD | NEW |