2010-08-29 Kwang Yul Seo <skyul@company100.net>

        Reviewed by Kent Tamura.

        [BREWMP] Port vprintf_stderr_common
        https://bugs.webkit.org/show_bug.cgi?id=33568

        Use BREW's DBGPRINTF to output debug messages.

        * wtf/Assertions.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66345 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5eea7a83
2010-08-29 Kwang Yul Seo <skyul@company100.net>
Reviewed by Kent Tamura.
[BREWMP] Port vprintf_stderr_common
https://bugs.webkit.org/show_bug.cgi?id=33568
Use BREW's DBGPRINTF to output debug messages.
* wtf/Assertions.cpp:
2010-08-28 Gavin Barraclough <barraclough@apple.com>
Reviewed by Oliver Hunt.
......
......@@ -35,7 +35,7 @@
#include <CoreFoundation/CFString.h>
#endif
#if COMPILER(MSVC) && !OS(WINCE)
#if COMPILER(MSVC) && !OS(WINCE) && !PLATFORM(BREWMP)
#ifndef WINVER
#define WINVER 0x0500
#endif
......@@ -50,8 +50,40 @@
#include <winbase.h>
#endif
#if PLATFORM(BREWMP)
#include <AEEStdLib.h>
#include <wtf/Vector.h>
#endif
extern "C" {
#if PLATFORM(BREWMP)
static void printLog(const Vector<char>& buffer)
{
// Each call to DBGPRINTF generates at most 128 bytes of output on the Windows SDK.
// On Qualcomm chipset targets, DBGPRINTF() comes out the diag port (though this may change).
// The length of each output string is constrained even more than on the Windows SDK.
#if COMPILER(MSVC)
const int printBufferSize = 128;
#else
const int printBufferSize = 32;
#endif
char printBuffer[printBufferSize + 1];
printBuffer[printBufferSize] = 0; // to guarantee null termination
const char* p = buffer.data();
const char* end = buffer.data() + buffer.size();
while (p < end) {
strncpy(printBuffer, p, printBufferSize);
DBGPRINTF(printBuffer);
p += printBufferSize;
}
}
#endif
WTF_ATTRIBUTE_PRINTF(1, 0)
static void vprintf_stderr_common(const char* format, va_list args)
{
......@@ -71,6 +103,16 @@ static void vprintf_stderr_common(const char* format, va_list args)
CFRelease(str);
CFRelease(cfFormat);
} else
#elif PLATFORM(BREWMP)
// When str is 0, the return value is the number of bytes needed
// to accept the result including null termination.
int size = vsnprintf(0, 0, format, args);
if (size > 0) {
Vector<char> buffer(size);
vsnprintf(buffer.data(), size, format, args);
printLog(buffer);
}
#elif COMPILER(MSVC) && !defined(WINCEBASIC)
if (IsDebuggerPresent()) {
size_t size = 1024;
......
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