Index: runtime/vm/debugger_api_impl.cc |
diff --git a/runtime/vm/debugger_api_impl.cc b/runtime/vm/debugger_api_impl.cc |
index c20bf670a12307a11a992be55ababd04ab5b44e7..17ffe27bf300fadefa70acb2bec5c76cd7175671 100644 |
--- a/runtime/vm/debugger_api_impl.cc |
+++ b/runtime/vm/debugger_api_impl.cc |
@@ -221,11 +221,38 @@ DART_EXPORT Dart_Handle Dart_GetStackTrace(Dart_StackTrace* trace) { |
Isolate* isolate = Isolate::Current(); |
DARTSCOPE(isolate); |
CHECK_NOT_NULL(trace); |
- *trace = reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace()); |
+ *trace = reinterpret_cast<Dart_StackTrace>( |
+ isolate->debugger()->UncachedStackTrace()); |
return Api::Success(); |
} |
+DART_EXPORT Dart_Handle Dart_GetStackTraceFromError(Dart_Handle handle, |
+ Dart_StackTrace* trace) { |
+ Isolate* isolate = Isolate::Current(); |
+ DARTSCOPE(isolate); |
+ CHECK_NOT_NULL(trace); |
+ const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle)); |
+ if (obj.IsUnhandledException()) { |
+ const UnhandledException& error = UnhandledException::Cast(obj); |
+ Stacktrace& dart_stacktrace = Stacktrace::Handle(isolate); |
+ dart_stacktrace ^= error.stacktrace(); |
+ if (dart_stacktrace.IsNull()) { |
+ *trace = NULL; |
+ } else { |
+ *trace = reinterpret_cast<Dart_StackTrace>( |
+ isolate->debugger()->StackTraceFrom(dart_stacktrace)); |
+ } |
+ return Api::Success(); |
+ } else if (obj.IsError()) { |
+ return Api::NewError("This error is not an unhandled exception error."); |
siva
2013/11/12 16:00:43
Why are you not getting the stack trace correspond
rmacnak
2013/11/12 22:32:40
This matches the behavior of Dart_ErrorGetStacktra
|
+ } else { |
+ return Api::NewError("Can only get stacktraces from error handles."); |
+ } |
+} |
+ |
+ |
+ |
DART_EXPORT Dart_Handle Dart_ActivationFrameInfo( |
Dart_ActivationFrame activation_frame, |
Dart_Handle* function_name, |
@@ -251,6 +278,30 @@ DART_EXPORT Dart_Handle Dart_ActivationFrameInfo( |
return Api::Success(); |
} |
+DART_EXPORT Dart_Handle Dart_ActivationFrameInfoWithColumn( |
+ Dart_ActivationFrame activation_frame, |
+ Dart_Handle* function_name, |
+ Dart_Handle* script_url, |
+ intptr_t* line_number, |
+ intptr_t* column_number) { |
+ Isolate* isolate = Isolate::Current(); |
+ DARTSCOPE(isolate); |
+ CHECK_AND_CAST(ActivationFrame, frame, activation_frame); |
+ if (function_name != NULL) { |
+ *function_name = Api::NewHandle(isolate, frame->QualifiedFunctionName()); |
+ } |
+ if (script_url != NULL) { |
+ *script_url = Api::NewHandle(isolate, frame->SourceUrl()); |
+ } |
+ if (line_number != NULL) { |
+ *line_number = frame->LineNumber(); |
+ } |
+ if (column_number != NULL) { |
+ *column_number = frame->ColumnNumber(); |
+ } |
+ return Api::Success(); |
+} |
+ |
DART_EXPORT Dart_Handle Dart_ActivationFrameGetLocation( |
Dart_ActivationFrame activation_frame, |