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 InlinedFunctionsInDartFrameIterator optimized_frames(frame); |
| 50 while (true) { |
| 51 uword pc = 0; |
| 52 func = optimized_frames.GetNextFunction(&pc); |
| 53 if (func.IsNull()) { |
| 54 break; |
| 55 } |
| 56 ASSERT(pc != 0); |
| 57 code = func.unoptimized_code(); |
| 58 offset = Smi::New(pc - code.EntryPoint()); |
| 59 func_list.Add(func); |
| 60 code_list.Add(code); |
| 61 pc_offset_list.Add(offset); |
| 62 } |
| 63 } else { |
| 64 offset = Smi::New(frame->pc() - code.EntryPoint()); |
| 65 func = code.function(); |
| 66 func_list.Add(func); |
| 67 code_list.Add(code); |
| 68 pc_offset_list.Add(offset); |
| 69 } |
51 if (frame->FindExceptionHandler(handler_pc)) { | 70 if (frame->FindExceptionHandler(handler_pc)) { |
52 *handler_sp = frame->sp(); | 71 *handler_sp = frame->sp(); |
53 *handler_fp = frame->fp(); | 72 *handler_fp = frame->fp(); |
54 return true; | 73 return true; |
55 } | 74 } |
56 } | 75 } |
57 frame = frames.NextFrame(); | 76 frame = frames.NextFrame(); |
58 ASSERT(frame != NULL); | 77 ASSERT(frame != NULL); |
59 } | 78 } |
60 ASSERT(frame->IsEntryFrame()); | 79 ASSERT(frame->IsEntryFrame()); |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 case kIsolateUnhandledException: | 464 case kIsolateUnhandledException: |
446 library = Library::IsolateLibrary(); | 465 library = Library::IsolateLibrary(); |
447 class_name = &Symbols::IsolateUnhandledException(); | 466 class_name = &Symbols::IsolateUnhandledException(); |
448 break; | 467 break; |
449 } | 468 } |
450 | 469 |
451 return DartLibraryCalls::ExceptionCreate(library, *class_name, arguments); | 470 return DartLibraryCalls::ExceptionCreate(library, *class_name, arguments); |
452 } | 471 } |
453 | 472 |
454 } // namespace dart | 473 } // namespace dart |
OLD | NEW |