| Index: runtime/vm/object.cc
|
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
|
| index a5e571f09a5a3e445cc8ff37bed64b3778c5c479..abedeb558d495897de6ac5408face6f2d07c0b45 100644
|
| --- a/runtime/vm/object.cc
|
| +++ b/runtime/vm/object.cc
|
| @@ -22704,31 +22704,34 @@ static intptr_t PrintOneStackTrace(Zone* zone,
|
| const char* StackTrace::ToCStringInternal(intptr_t* frame_index,
|
| intptr_t max_frames) const {
|
| Zone* zone = Thread::Current()->zone();
|
| - Function& function = Function::Handle();
|
| - Code& code = Code::Handle();
|
| + Function& function = Function::Handle(zone);
|
| + Code& code = Code::Handle(zone);
|
| // Iterate through the stack frames and create C string description
|
| // for each frame.
|
| intptr_t total_len = 0;
|
| GrowableArray<char*> frame_strings;
|
| for (intptr_t i = 0; (i < Length()) && (*frame_index < max_frames); i++) {
|
| + code = CodeAtFrame(i);
|
| function = FunctionAtFrame(i);
|
| - if (function.IsNull()) {
|
| + if (code.raw() == StubCode::AsynchronousGapMarker_entry()->code()) {
|
| + const char* kAsynchronousGap = "<asynchronous suspension>\n";
|
| + intptr_t asynchronous_gap_len = strlen(kAsynchronousGap) + 1;
|
| + frame_strings.Add(const_cast<char*>(kAsynchronousGap));
|
| + total_len += asynchronous_gap_len;
|
| + } else if (function.IsNull()) {
|
| // Check for a null function, which indicates a gap in a StackOverflow or
|
| // OutOfMemory trace.
|
| if ((i < (Length() - 1)) &&
|
| (FunctionAtFrame(i + 1) != Function::null())) {
|
| const char* kTruncated = "...\n...\n";
|
| intptr_t truncated_len = strlen(kTruncated) + 1;
|
| - char* chars = zone->Alloc<char>(truncated_len);
|
| - OS::SNPrint(chars, truncated_len, "%s", kTruncated);
|
| - frame_strings.Add(chars);
|
| + frame_strings.Add(const_cast<char*>(kTruncated));
|
| total_len += truncated_len;
|
| ASSERT(PcOffsetAtFrame(i) != Smi::null());
|
| // To account for gap frames.
|
| (*frame_index) += Smi::Value(PcOffsetAtFrame(i));
|
| }
|
| } else {
|
| - code = CodeAtFrame(i);
|
| ASSERT(function.raw() == code.function());
|
| uword pc = code.PayloadStart() + Smi::Value(PcOffsetAtFrame(i));
|
| if (code.is_optimized() && expand_inlined() &&
|
|
|