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

Unified Diff: runtime/vm/object.cc

Issue 41503004: - Account for hidden frames when concatenating throw and (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 29207)
+++ runtime/vm/object.cc (working copy)
@@ -15245,19 +15245,19 @@
RawString* Stacktrace::FullStacktrace() const {
const Array& code_array = Array::Handle(raw_ptr()->catch_code_array_);
+ intptr_t idx = 0;
if (!code_array.IsNull() && (code_array.Length() > 0)) {
const Array& pc_offset_array =
Array::Handle(raw_ptr()->catch_pc_offset_array_);
const Stacktrace& catch_trace = Stacktrace::Handle(
Stacktrace::New(code_array, pc_offset_array));
- intptr_t idx = Length();
- const String& trace =
- String::Handle(String::New(catch_trace.ToCStringInternal(idx)));
- const String& throw_trace =
- String::Handle(String::New(ToCStringInternal(0)));
- return String::Concat(throw_trace, trace);
+ const String& throw_string =
+ String::Handle(String::New(ToCStringInternal(&idx)));
+ const String& catch_string =
+ String::Handle(String::New(catch_trace.ToCStringInternal(&idx)));
+ return String::Concat(throw_string, catch_string);
}
- return String::New(ToCStringInternal(0));
+ return String::New(ToCStringInternal(&idx));
}
@@ -15319,7 +15319,7 @@
}
-const char* Stacktrace::ToCStringInternal(intptr_t frame_index) const {
+const char* Stacktrace::ToCStringInternal(intptr_t* frame_index) const {
Isolate* isolate = Isolate::Current();
Function& function = Function::Handle();
Code& code = Code::Handle();
@@ -15327,7 +15327,6 @@
// for each frame.
intptr_t total_len = 0;
GrowableArray<char*> frame_strings;
- intptr_t current_frame_index = frame_index;
for (intptr_t i = 0; i < Length(); i++) {
function = FunctionAtFrame(i);
if (function.IsNull()) {
@@ -15355,13 +15354,13 @@
ASSERT(code.EntryPoint() <= pc);
ASSERT(pc < (code.EntryPoint() + code.Size()));
total_len += PrintOneStacktrace(
- isolate, &frame_strings, pc, function, code, current_frame_index);
- current_frame_index++; // To account for inlined frames.
+ isolate, &frame_strings, pc, function, code, *frame_index);
+ (*frame_index)++; // To account for inlined frames.
}
} else {
total_len += PrintOneStacktrace(
- isolate, &frame_strings, pc, function, code, current_frame_index);
- current_frame_index++;
+ isolate, &frame_strings, pc, function, code, *frame_index);
+ (*frame_index)++;
}
}
}
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698