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

Unified Diff: runtime/vm/object.cc

Issue 248213002: Expose functionality to create a stack trace to internal vm code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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/object.cc
===================================================================
--- runtime/vm/object.cc (revision 35284)
+++ runtime/vm/object.cc (working copy)
@@ -11808,12 +11808,12 @@
}
-RawICData* ICData::New(const Function& function,
+RawICData* ICData::New(const Function& caller_function,
const String& target_name,
const Array& arguments_descriptor,
intptr_t deopt_id,
intptr_t num_args_tested) {
- ASSERT(!function.IsNull());
+ ASSERT(!caller_function.IsNull());
ASSERT(!target_name.IsNull());
ASSERT(!arguments_descriptor.IsNull());
ASSERT(Object::icdata_class() != Class::null());
@@ -11827,7 +11827,7 @@
NoGCScope no_gc;
result ^= raw;
}
- result.set_function(function);
+ result.set_function(caller_function);
result.set_target_name(target_name);
result.set_arguments_descriptor(arguments_descriptor);
result.set_deopt_id(deopt_id);
@@ -18098,7 +18098,8 @@
}
-const char* Stacktrace::ToCStringInternal(intptr_t* frame_index) const {
+const char* Stacktrace::ToCStringInternal(intptr_t* frame_index,
+ intptr_t max_frames) const {
Isolate* isolate = Isolate::Current();
Function& function = Function::Handle();
Code& code = Code::Handle();
@@ -18106,7 +18107,7 @@
// for each frame.
intptr_t total_len = 0;
GrowableArray<char*> frame_strings;
- for (intptr_t i = 0; i < Length(); i++) {
+ for (intptr_t i = 0; (i < Length()) && (*frame_index < max_frames); i++) {
function = FunctionAtFrame(i);
if (function.IsNull()) {
// Check if null function object indicates a stack trace overflow.
@@ -18124,7 +18125,8 @@
uword pc = code.EntryPoint() + Smi::Value(PcOffsetAtFrame(i));
if (code.is_optimized() && expand_inlined()) {
// Traverse inlined frames.
- for (InlinedFunctionsIterator it(code, pc); !it.Done(); it.Advance()) {
+ for (InlinedFunctionsIterator it(code, pc);
+ !it.Done() && (*frame_index < max_frames); it.Advance()) {
function = it.function();
if (function.is_visible() || FLAG_verbose_stacktrace) {
code = it.code();
@@ -18135,8 +18137,8 @@
ASSERT(pc < (code.EntryPoint() + code.Size()));
total_len += PrintOneStacktrace(
isolate, &frame_strings, pc, function, code, *frame_index);
+ (*frame_index)++; // To account for inlined frames.
}
- (*frame_index)++; // To account for inlined frames.
}
} else {
total_len += PrintOneStacktrace(
« runtime/vm/flow_graph_builder.h ('K') | « runtime/vm/object.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698