Commit a2cfa9d3 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Put additional information onto the stack when crashing in Debug::Break.

R=jkummerow@chromium.org
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10698116

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11999 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4a46de19
...@@ -892,6 +892,7 @@ void Debug::Iterate(ObjectVisitor* v) { ...@@ -892,6 +892,7 @@ void Debug::Iterate(ObjectVisitor* v) {
} }
// TODO(131642): Remove this when fixed.
void Debug::PutValuesOnStackAndDie(int start, void Debug::PutValuesOnStackAndDie(int start,
Address c_entry_fp, Address c_entry_fp,
Address last_fp, Address last_fp,
...@@ -1009,6 +1010,7 @@ Object* Debug::Break(Arguments args) { ...@@ -1009,6 +1010,7 @@ Object* Debug::Break(Arguments args) {
it.Advance(); it.Advance();
} }
// TODO(131642): Remove this when fixed.
// Catch the cases that would lead to crashes and capture // Catch the cases that would lead to crashes and capture
// - C entry FP at which to start stack crawl. // - C entry FP at which to start stack crawl.
// - FP of the frame at which we plan to stop stepping out (last FP). // - FP of the frame at which we plan to stop stepping out (last FP).
...@@ -1017,18 +1019,23 @@ Object* Debug::Break(Arguments args) { ...@@ -1017,18 +1019,23 @@ Object* Debug::Break(Arguments args) {
// - stack trace string. // - stack trace string.
if (it.done()) { if (it.done()) {
// We crawled the entire stack, never reaching last_fp_. // We crawled the entire stack, never reaching last_fp_.
Handle<String> stack = isolate_->StackTraceString();
char buffer[8192];
int length = Min(8192, stack->length());
String::WriteToFlat(*stack, buffer, 0, length - 1);
PutValuesOnStackAndDie(0xBEEEEEEE, PutValuesOnStackAndDie(0xBEEEEEEE,
frame->fp(), frame->fp(),
thread_local_.last_fp_, thread_local_.last_fp_,
reinterpret_cast<Address>(0xDEADDEAD), reinterpret_cast<Address>(0xDEADDEAD),
count, count,
NULL, buffer,
0xCEEEEEEE); 0xCEEEEEEE);
} else if (it.frame()->fp() != thread_local_.last_fp_) { } else if (it.frame()->fp() != thread_local_.last_fp_) {
// We crawled over last_fp_, without getting a match. // We crawled over last_fp_, without getting a match.
Handle<String> stack = isolate_->StackTraceString(); Handle<String> stack = isolate_->StackTraceString();
char buffer[8192]; char buffer[8192];
String::WriteToFlat(*stack, buffer, 0, 8191); int length = Min(8192, stack->length());
String::WriteToFlat(*stack, buffer, 0, length - 1);
PutValuesOnStackAndDie(0xDEEEEEEE, PutValuesOnStackAndDie(0xDEEEEEEE,
frame->fp(), frame->fp(),
thread_local_.last_fp_, thread_local_.last_fp_,
......
...@@ -232,6 +232,7 @@ class Debug { ...@@ -232,6 +232,7 @@ class Debug {
void PreemptionWhileInDebugger(); void PreemptionWhileInDebugger();
void Iterate(ObjectVisitor* v); void Iterate(ObjectVisitor* v);
// TODO(131642): Remove this when fixed.
NO_INLINE(void PutValuesOnStackAndDie(int start, NO_INLINE(void PutValuesOnStackAndDie(int start,
Address c_entry_fp, Address c_entry_fp,
Address last_fp, Address last_fp,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment