Push the top code objects onto the stack in PushStackTraceAndDie

Doing so will increase the likelyhood of getting the interesting code objects
into the mindump.

Change-Id: I6c6d06bbfe7ab8649139b1146bda0f9b3d679064
Reviewed-on: https://chromium-review.googlesource.com/468967
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44444}
This commit is contained in:
Camillo Bruni 2017-04-06 15:22:57 +02:00 committed by Commit Bot
parent 82fa48ad04
commit 4da08b7dff
2 changed files with 22 additions and 1 deletions

View File

@ -322,6 +322,27 @@ void Isolate::PushStackTraceAndDie(unsigned int magic, void* ptr1, void* ptr2,
// TODO(dcarney): convert buffer to utf8?
base::OS::PrintError("Stacktrace (%x-%x) %p %p: %s\n", magic, magic2, ptr1,
ptr2, reinterpret_cast<char*>(buffer));
PushCodeObjectsAndDie(0xdeadc0de);
}
void Isolate::PushCodeObjectsAndDie(unsigned int magic) {
const int kMaxCodeObjects = 16;
// Mark as volatile to lower the probability of optimizing code_objects
// away.
Code* volatile code_objects[kMaxCodeObjects];
StackFrameIterator it(this);
int numCodeObjects = 0;
for (; !it.done() && numCodeObjects < kMaxCodeObjects; it.Advance()) {
code_objects[numCodeObjects++] = it.frame()->unchecked_code();
}
// Keep the top raw code object pointers on the stack in the hope that the
// corresponding pages end up more frequently in the minidump.
base::OS::PrintError(
"\nCodeObjects (%p length=%i): 1:%p 2:%p 3:%p 4:%p...\n\n",
static_cast<void*>(code_objects[0]), numCodeObjects,
static_cast<void*>(code_objects[0]), static_cast<void*>(code_objects[1]),
static_cast<void*>(code_objects[2]), static_cast<void*>(code_objects[4]));
base::OS::Abort();
}
@ -764,7 +785,6 @@ static void PrintFrames(Isolate* isolate,
}
}
void Isolate::PrintStack(StringStream* accumulator, PrintStackMode mode) {
// The MentionedObjectCache is not GC-proof at the moment.
DisallowHeapAllocation no_gc;

View File

@ -704,6 +704,7 @@ class Isolate {
Handle<String> StackTraceString();
NO_INLINE(void PushStackTraceAndDie(unsigned int magic, void* ptr1,
void* ptr2, unsigned int magic2));
NO_INLINE(void PushCodeObjectsAndDie(unsigned int magic));
Handle<JSArray> CaptureCurrentStackTrace(
int frame_limit,
StackTrace::StackTraceOptions options);