Reviewers: Jakob,

Message:
PTAQL.

Description:
Put even more debug information on stack when aborting.


[email protected]
BUG=131642
TEST=


Please review this at http://codereview.chromium.org/10698048/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/debug.h
  M src/debug.cc


Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index ffe5b0db1fae5c55d3f40d6fad0b97b45024e68b..24ea7b5ba4543bef1b28a16962f97dfc2dd5195e 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -896,17 +896,15 @@ void Debug::PutValuesOnStackAndDie(int start,
                                    Address c_entry_fp,
                                    Address last_fp,
                                    Address larger_fp,
-                                   Address last_in_fp,
-                                   Address last_out_fp,
                                    int count,
+                                   char* stack,
                                    int end) {
   OS::PrintError("start:       %d\n", start);
   OS::PrintError("c_entry_fp:  %p\n", static_cast<void*>(c_entry_fp));
   OS::PrintError("last_fp:     %p\n", static_cast<void*>(last_fp));
   OS::PrintError("larger_fp:   %p\n", static_cast<void*>(larger_fp));
-  OS::PrintError("last_in_fp:  %p\n", static_cast<void*>(last_in_fp));
-  OS::PrintError("last_out_fp: %p\n", static_cast<void*>(last_out_fp));
   OS::PrintError("count:       %d\n", count);
+  OS::PrintError("stack:       %s\n", stack);
   OS::PrintError("end:         %d\n", end);
   OS::Abort();
 }
@@ -1014,25 +1012,27 @@ Object* Debug::Break(Arguments args) {
       // - FP of the frame at which we plan to stop stepping out (last FP).
       // - current FP that's larger than last FP.
       // - Counter for the number of steps to step out.
+      // - stack trace string.
       if (it.done()) {
         // We crawled the entire stack, never reaching last_fp_.
         PutValuesOnStackAndDie(0xBEEEEEEE,
                                frame->fp(),
                                thread_local_.last_fp_,
-                               NULL,
-                               thread_local_.step_into_fp_,
-                               thread_local_.step_out_fp_,
+                               reinterpret_cast<Address>(0xDEADDEAD),
                                count,
-                               0xFEEEEEEE);
+                               NULL,
+                               0xCEEEEEEE);
       } else if (it.frame()->fp() != thread_local_.last_fp_) {
         // We crawled over last_fp_, without getting a match.
-        PutValuesOnStackAndDie(0xBEEEEEEE,
+        Handle<String> stack = isolate_->StackTraceString();
+        char buffer[2048];
+        String::WriteToFlat(*stack, buffer, 0, 2047);
+        PutValuesOnStackAndDie(0xDEEEEEEE,
                                frame->fp(),
                                thread_local_.last_fp_,
                                it.frame()->fp(),
-                               thread_local_.step_into_fp_,
-                               thread_local_.step_out_fp_,
                                count,
+                               buffer,
                                0xFEEEEEEE);
       }

Index: src/debug.h
diff --git a/src/debug.h b/src/debug.h
index 445137c83820719458fbc8cc1cb31e42a1ad40e1..9b5c2505ecb73e383436f66adcb2f83373a6c211 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -236,9 +236,8 @@ class Debug {
                                         Address c_entry_fp,
                                         Address last_fp,
                                         Address larger_fp,
-                                        Address last_in_fp,
-                                        Address last_out_fp,
                                         int count,
+                                        char* stack,
                                         int end));
   Object* Break(Arguments args);
   void SetBreakPoint(Handle<JSFunction> function,


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to