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

Unified Diff: runtime/vm/exceptions.cc

Issue 12316116: Add functionality to get full stack trace when exceptions are thrown. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/exceptions.cc
===================================================================
--- runtime/vm/exceptions.cc (revision 19025)
+++ runtime/vm/exceptions.cc (working copy)
@@ -203,13 +203,30 @@
Stacktrace& stacktrace = Stacktrace::Handle();
if (pc_offset_list.Length() != 0) {
if (existing_stacktrace.IsNull()) {
- stacktrace = Stacktrace::New(func_list, code_list, pc_offset_list);
+ const Array& func_array = Array::Handle(Array::MakeArray(func_list));
+ const Array& code_array = Array::Handle(Array::MakeArray(code_list));
+ const Array& pc_offset_array =
+ Array::Handle(Array::MakeArray(pc_offset_list));
+
+ stacktrace = Stacktrace::New(func_array, code_array, pc_offset_array);
} else {
stacktrace ^= existing_stacktrace.raw();
stacktrace.Append(func_list, code_list, pc_offset_list);
+ // Since we are re throwing and appending to the existing stack trace
+ // we clear out the catch trace collected in the existing stack trace
+ // as that trace will not be valid anymore.
+ stacktrace.SetCatchStacktrace(Object::empty_array(),
+ Object::empty_array(),
+ Object::empty_array());
}
} else {
stacktrace ^= existing_stacktrace.raw();
+ // Since we are re throwing the existing stack trace
+ // we clear out the catch trace collected in it
+ // as that trace will not be valid anymore.
+ stacktrace.SetCatchStacktrace(Object::empty_array(),
+ Object::empty_array(),
+ Object::empty_array());
}
if (FLAG_print_stacktrace_at_throw) {
OS::Print("Exception '%s' thrown:\n", exception.ToCString());

Powered by Google App Engine
This is Rietveld 408576698