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

Unified Diff: runtime/vm/object.cc

Issue 2646443005: Track async causal stack traces (Closed)
Patch Set: initialize async_causal_stack_trace_ to NULL Created 3 years, 11 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
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() &&
« runtime/lib/stacktrace.cc ('K') | « runtime/vm/object.h ('k') | runtime/vm/object_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698