| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 ASSERT(frame != NULL); // We expect to find a dart invocation frame. | 48 ASSERT(frame != NULL); // We expect to find a dart invocation frame. |
| 49 Function& func = Function::Handle(); | 49 Function& func = Function::Handle(); |
| 50 Code& code = Code::Handle(); | 50 Code& code = Code::Handle(); |
| 51 Smi& offset = Smi::Handle(); | 51 Smi& offset = Smi::Handle(); |
| 52 while (!frame->IsEntryFrame()) { | 52 while (!frame->IsEntryFrame()) { |
| 53 if (frame->IsDartFrame()) { | 53 if (frame->IsDartFrame()) { |
| 54 code = frame->LookupDartCode(); | 54 code = frame->LookupDartCode(); |
| 55 if (code.is_optimized()) { | 55 if (code.is_optimized()) { |
| 56 // For optimized frames, extract all the inlined functions if any | 56 // For optimized frames, extract all the inlined functions if any |
| 57 // into the stack trace. | 57 // into the stack trace. |
| 58 InlinedFunctionsInDartFrameIterator optimized_frames(frame); | 58 for (InlinedFunctionsIterator it(frame); !it.Done(); it.Advance()) { |
| 59 while (true) { | 59 func = it.function(); |
| 60 uword pc = 0; | 60 code = it.code(); |
| 61 func = optimized_frames.GetNextFunction(&pc); | 61 uword pc = it.pc(); |
| 62 if (func.IsNull()) { | |
| 63 break; | |
| 64 } | |
| 65 ASSERT(pc != 0); | 62 ASSERT(pc != 0); |
| 63 ASSERT(code.EntryPoint() <= pc); |
| 64 ASSERT(pc < (code.EntryPoint() + code.Size())); |
| 66 if (ShouldShowFunction(func)) { | 65 if (ShouldShowFunction(func)) { |
| 67 code = func.unoptimized_code(); | |
| 68 offset = Smi::New(pc - code.EntryPoint()); | 66 offset = Smi::New(pc - code.EntryPoint()); |
| 69 ASSERT(0 <= offset.Value() && offset.Value() < code.Size()); | |
| 70 func_list.Add(func); | 67 func_list.Add(func); |
| 71 code_list.Add(code); | 68 code_list.Add(code); |
| 72 pc_offset_list.Add(offset); | 69 pc_offset_list.Add(offset); |
| 73 } | 70 } |
| 74 } | 71 } |
| 75 } else { | 72 } else { |
| 76 offset = Smi::New(frame->pc() - code.EntryPoint()); | 73 offset = Smi::New(frame->pc() - code.EntryPoint()); |
| 77 func = code.function(); | 74 func = code.function(); |
| 78 if (ShouldShowFunction(func)) { | 75 if (ShouldShowFunction(func)) { |
| 79 func_list.Add(func); | 76 func_list.Add(func); |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 case kIsolateUnhandledException: | 475 case kIsolateUnhandledException: |
| 479 library = Library::IsolateLibrary(); | 476 library = Library::IsolateLibrary(); |
| 480 class_name = &Symbols::IsolateUnhandledException(); | 477 class_name = &Symbols::IsolateUnhandledException(); |
| 481 break; | 478 break; |
| 482 } | 479 } |
| 483 | 480 |
| 484 return DartLibraryCalls::ExceptionCreate(library, *class_name, arguments); | 481 return DartLibraryCalls::ExceptionCreate(library, *class_name, arguments); |
| 485 } | 482 } |
| 486 | 483 |
| 487 } // namespace dart | 484 } // namespace dart |
| OLD | NEW |