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

Unified Diff: runtime/vm/debugger_api_impl.cc

Issue 51793002: Add an API function to get a debugger stack trace from an error handle. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 7 years, 1 month 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
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger_api_impl.cc
diff --git a/runtime/vm/debugger_api_impl.cc b/runtime/vm/debugger_api_impl.cc
index aabf70e9b95409563cf582699aae8183f0f7a8a9..dcee7a72ec2e604e36c148f95f0e4fa4bf2b621f 100644
--- a/runtime/vm/debugger_api_impl.cc
+++ b/runtime/vm/debugger_api_impl.cc
@@ -221,17 +221,42 @@ 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()->CurrentStackTrace());
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 {
+ return Api::NewError("Can only get stacktraces from error handles or "
+ "instances of Error.");
+ }
+}
+
+
DART_EXPORT Dart_Handle Dart_ActivationFrameInfo(
Dart_ActivationFrame activation_frame,
Dart_Handle* function_name,
Dart_Handle* script_url,
intptr_t* line_number,
- intptr_t* library_id) {
+ intptr_t* column_number) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
CHECK_AND_CAST(ActivationFrame, frame, activation_frame);
@@ -244,9 +269,8 @@ DART_EXPORT Dart_Handle Dart_ActivationFrameInfo(
if (line_number != NULL) {
*line_number = frame->LineNumber();
}
- if (library_id != NULL) {
- const Library& lib = Library::Handle(frame->Library());
- *library_id = lib.index();
+ if (column_number != NULL) {
+ *column_number = frame->ColumnNumber();
}
return Api::Success();
}
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698