Reviewers: mvstanton,

Description:
Make Runtime_Abort print to stderr instead of stdout.

[email protected]

Please review this at https://codereview.chromium.org/15298005/

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

Affected files:
  M src/checks.cc
  M src/heap.cc
  M src/isolate.h
  M src/isolate.cc
  M src/runtime.cc


Index: src/checks.cc
diff --git a/src/checks.cc b/src/checks.cc
index a6405ecdec01a47a6c018d3cd9c46e0d2d9f6cff..8bcde1c61ce751650d7dd7385396c33ede57dc72 100644
--- a/src/checks.cc
+++ b/src/checks.cc
@@ -53,7 +53,7 @@ extern "C" void V8_Fatal(const char* file, int line, const char* format, ...) {
   if (fatal_error_handler_nesting_depth < 3) {
     if (i::FLAG_stack_trace_on_abort) {
       // Call this one twice on double fault
-      i::Isolate::Current()->PrintStack();
+      i::Isolate::Current()->PrintStack(stderr);
     }
   }
   i::OS::Abort();
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index a69c539911da64045d1cae9f109e7847d2d83b07..4f7d92f6ed8b16636a9f7e7388d2d3fe492f4869 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -5936,7 +5936,7 @@ bool Heap::IdleGlobalGC() {

 void Heap::Print() {
   if (!HasBeenSetUp()) return;
-  isolate()->PrintStack();
+  isolate()->PrintStack(stdout);
   AllSpaces spaces(this);
for (Space* space = spaces.next(); space != NULL; space = spaces.next()) {
     space->Print();
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 2f36063dd6b98d9fa63658f36dbd1041d39582e9..7e49abb0b4a0ac6a808ecce2a5cab18c7ed10cae 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -835,7 +835,7 @@ Handle<JSArray> Isolate::CaptureCurrentStackTrace(
 }


-void Isolate::PrintStack() {
+void Isolate::PrintStack(FILE* out) {
   if (stack_trace_nesting_level_ == 0) {
     stack_trace_nesting_level_++;

@@ -850,7 +850,7 @@ void Isolate::PrintStack() {
     StringStream accumulator(allocator);
     incomplete_message_ = &accumulator;
     PrintStack(&accumulator);
-    accumulator.OutputToStdOut();
+    accumulator.OutputToFile(out);
     InitializeLoggingAndCounters();
     accumulator.Log();
     incomplete_message_ = NULL;
@@ -865,7 +865,7 @@ void Isolate::PrintStack() {
       "\n\nAttempt to print stack while printing stack (double fault)\n");
     OS::PrintError(
       "If you are lucky you may find a partial stack dump on stdout.\n\n");
-    incomplete_message_->OutputToStdOut();
+    incomplete_message_->OutputToFile(out);
   }
 }

Index: src/isolate.h
diff --git a/src/isolate.h b/src/isolate.h
index ab32987780a230f01c9b9ac7106c8bf34550e2ef..c311f3eb4e2ee17da4e86beaa380300875ea6ebe 100644
--- a/src/isolate.h
+++ b/src/isolate.h
@@ -724,7 +724,7 @@ class Isolate {
   void PrintCurrentStackTrace(FILE* out);
   void PrintStackTrace(FILE* out, char* thread_data);
   void PrintStack(StringStream* accumulator);
-  void PrintStack();
+  void PrintStack(FILE* out);
   Handle<String> StackTraceString();
   NO_INLINE(void PushStackTraceAndDie(unsigned int magic,
                                       Object* object,
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 849ddbf9910a388d2610cc7b9e45ac189a21e0dd..61b3549ddebf8d07db91bf6aafc405381e3e444b 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -8991,7 +8991,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPrint) {
 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugTrace) {
   NoHandleAllocation ha(isolate);
   ASSERT(args.length() == 0);
-  isolate->PrintStack();
+  isolate->PrintStack(stdout);
   return isolate->heap()->undefined_value();
 }

@@ -13099,7 +13099,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Abort) {
   ASSERT(args.length() == 2);
   OS::PrintError("abort: %s\n",
                  reinterpret_cast<char*>(args[0]) + args.smi_at(1));
-  isolate->PrintStack();
+  isolate->PrintStack(stderr);
   OS::Abort();
   UNREACHABLE();
   return NULL;


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to