Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Side by Side Diff: runtime/vm/exceptions.cc

Issue 12894005: Rollback stacktrace change. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/exceptions.h ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 // dart invocation sequence above it, print diagnostics and terminate 358 // dart invocation sequence above it, print diagnostics and terminate
359 // the isolate etc.). 359 // the isolate etc.).
360 const UnhandledException& unhandled_exception = UnhandledException::Handle( 360 const UnhandledException& unhandled_exception = UnhandledException::Handle(
361 UnhandledException::New(exception, stacktrace)); 361 UnhandledException::New(exception, stacktrace));
362 JumpToErrorHandler(handler_pc, handler_sp, handler_fp, unhandled_exception); 362 JumpToErrorHandler(handler_pc, handler_sp, handler_fp, unhandled_exception);
363 } 363 }
364 UNREACHABLE(); 364 UNREACHABLE();
365 } 365 }
366 366
367 367
368 const char* Exceptions::CreateStackTrace() {
369 Isolate* isolate = Isolate::Current();
370 Stacktrace& stacktrace = Stacktrace::Handle(isolate);
371 stacktrace ^= isolate->object_store()->preallocated_stack_trace();
372 RegularStacktraceBuilder frame_builder;
373 uword handler_pc = 0;
374 uword handler_sp = 0;
375 uword handler_fp = 0;
376 FindExceptionHandler(&handler_pc,
377 &handler_sp,
378 &handler_fp,
379 &frame_builder);
380 const Array& func_array =
381 Array::Handle(isolate, Array::MakeArray(frame_builder.func_list()));
382 const Array& code_array =
383 Array::Handle(isolate, Array::MakeArray(frame_builder.code_list()));
384 const Array& pc_offset_array =
385 Array::Handle(isolate,
386 Array::MakeArray(frame_builder.pc_offset_list()));
387 stacktrace = Stacktrace::New(func_array, code_array, pc_offset_array);
388 return stacktrace.ToCString();
389 }
390
391
392 // Static helpers for allocating, initializing, and throwing an error instance. 368 // Static helpers for allocating, initializing, and throwing an error instance.
393 369
394 // Return the script of the Dart function that called the native entry or the 370 // Return the script of the Dart function that called the native entry or the
395 // runtime entry. The frame iterator points to the callee. 371 // runtime entry. The frame iterator points to the callee.
396 RawScript* Exceptions::GetCallerScript(DartFrameIterator* iterator) { 372 RawScript* Exceptions::GetCallerScript(DartFrameIterator* iterator) {
397 StackFrame* caller_frame = iterator->NextFrame(); 373 StackFrame* caller_frame = iterator->NextFrame();
398 ASSERT(caller_frame != NULL && caller_frame->IsDartFrame()); 374 ASSERT(caller_frame != NULL && caller_frame->IsDartFrame());
399 const Function& caller = Function::Handle(caller_frame->LookupDartFunction()); 375 const Function& caller = Function::Handle(caller_frame->LookupDartFunction());
400 ASSERT(!caller.IsNull()); 376 ASSERT(!caller.IsNull());
401 return caller.script(); 377 return caller.script();
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 break; 597 break;
622 } 598 }
623 599
624 return DartLibraryCalls::ExceptionCreate(library, 600 return DartLibraryCalls::ExceptionCreate(library,
625 *class_name, 601 *class_name,
626 *constructor_name, 602 *constructor_name,
627 arguments); 603 arguments);
628 } 604 }
629 605
630 } // namespace dart 606 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/exceptions.h ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698