Send all debug output to stderr
authorLars Knoll <lars.knoll@digia.com>
Fri, 12 Oct 2012 06:51:02 +0000 (08:51 +0200)
committerSimon Hausmann <simon.hausmann@digia.com>
Fri, 12 Oct 2012 07:18:43 +0000 (09:18 +0200)
qDebug() was used for part of the logging, which
uses stderr. Send everything else there as well.

Change-Id: I363dff3d2e4dd6f95bf0347f1df589ae2528fd32
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
masm/stubs/WTFStubs.cpp
qv4isel_masm.cpp

index 2c642ac..e4009b8 100644 (file)
@@ -27,7 +27,7 @@ uint32_t cryptographicallyRandomNumber()
     return 0;
 }
 
-static FILE* s_dataFile = stdout;
+static FILE* s_dataFile = stderr;
 
 void setDataFile(FILE* f)
 {
index e633497..98b9a71 100644 (file)
@@ -19,7 +19,7 @@ using namespace QQmlJS::MASM;
 using namespace QQmlJS::VM;
 
 namespace {
-QTextStream qout(stdout, QIODevice::WriteOnly);
+QTextStream qout(stderr, QIODevice::WriteOnly);
 }
 
 static void printDisassmbleOutputWithCalls(const char* output, const QHash<void*, const char*>& functions)
@@ -31,7 +31,7 @@ static void printDisassmbleOutputWithCalls(const char* output, const QHash<void*
         ptrString.prepend("0x");
         processedOutput = processedOutput.replace(ptrString, it.value());
     }
-    fprintf(stdout, "%s\n", processedOutput.constData());
+    fprintf(stderr, "%s\n", processedOutput.constData());
 }
 
 InstructionSelection::InstructionSelection(VM::ExecutionEngine *engine, IR::Module *module, uchar *buffer)
@@ -102,9 +102,12 @@ void InstructionSelection::operator()(IR::Function *function)
     FILE* disasmStream = open_memstream(&disasmOutput, &disasmLength);
     WTF::setDataFile(disasmStream);
 
-    _function->codeRef = linkBuffer.finalizeCodeWithDisassembly("operator()(IR::Function*)");
+    QByteArray name = _function->name->toUtf8();
+    if (name.startsWith('%'))
+        name.prepend('%');
+    _function->codeRef = linkBuffer.finalizeCodeWithDisassembly(name.data());
 
-    WTF::setDataFile(stdout);
+    WTF::setDataFile(stderr);
     fclose(disasmStream);
 #if CPU(X86) || CPU(X86_64)
     printDisassmbleOutputWithCalls(disasmOutput, functions);