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

Unified Diff: runtime/vm/object.h

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
Index: runtime/vm/object.h
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 2b48af202dbbf4498e861ec9c1c2278584697b20..a90838e0a514a6a15079429c0467f5000790e82c 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -6072,6 +6072,9 @@ class Closure : public AllStatic {
};
+class ExceptionStackTrace;
rmacnak 2013/11/07 21:31:12 Move to top of file?
+class ExceptionStackFrame;
+
// Internal stacktrace object used in exceptions for printing stack traces.
class Stacktrace : public Instance {
public:
@@ -6102,6 +6105,8 @@ class Stacktrace : public Instance {
RawString* FullStacktrace() const;
const char* ToCStringInternal(intptr_t* frame_index) const;
+ ExceptionStackTrace* BuildExceptionStackTrace() const;
rmacnak 2013/11/07 21:31:12 Ditto bad name.
+
private:
void set_code_array(const Array& code_array) const;
void set_pc_offset_array(const Array& pc_offset_array) const;
@@ -6114,6 +6119,56 @@ class Stacktrace : public Instance {
};
+// Constructed and handed out by the API to avoid repeatedly iterating through
+// frames to expand inlined frames and skip invisible frames.
+// Cf. DebuggerStackTrace.
+class ExceptionStackTrace : public ZoneAllocated {
+ public:
+ explicit ExceptionStackTrace(int capacity)
+ : frames_(capacity) { }
+
+ intptr_t Length() const { return frames_.length(); }
+
+ ExceptionStackFrame* FrameAt(int i) const { return frames_[i]; }
+
+ private:
+ void AddFrame(ExceptionStackFrame* frame) { frames_.Add(frame); }
+ ZoneGrowableArray<ExceptionStackFrame*> frames_;
+
+ friend class Stacktrace;
+ friend class Debugger;
+ DISALLOW_COPY_AND_ASSIGN(ExceptionStackTrace);
+};
+
+
+class ExceptionStackFrame : public ZoneAllocated {
+ public:
+ explicit ExceptionStackFrame(
+ String& function_name,
+ String& script_uri,
+ intptr_t line_number,
+ intptr_t column_number)
+ : function_name_(String::ZoneHandle(function_name.raw())),
+ script_uri_(String::ZoneHandle(script_uri.raw())),
+ line_number_(line_number),
+ column_number_(column_number) { }
+
+ RawString* function_name() const { return function_name_.raw(); }
+ RawString* script_uri() const { return script_uri_.raw(); }
+ intptr_t line_number() const { return line_number_; }
+ intptr_t column_number() const { return column_number_; }
+
+ private:
+ const String& function_name_;
+ const String& script_uri_;
+ const intptr_t line_number_;
+ const intptr_t column_number_;
+
+ friend class Stacktrace;
+ DISALLOW_COPY_AND_ASSIGN(ExceptionStackFrame);
+};
+
+
// Internal JavaScript regular expression object.
class JSRegExp : public Instance {
public:
« runtime/vm/debugger.h ('K') | « runtime/vm/debugger.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698