Changeset 66345 in webkit


Ignore:
Timestamp:
Aug 29, 2010 6:46:43 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

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:
Location:
trunk/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r66318 r66345  
     12010-08-29  Kwang Yul Seo  <skyul@company100.net>
     2
     3        Reviewed by Kent Tamura.
     4
     5        [BREWMP] Port vprintf_stderr_common
     6        https://bugs.webkit.org/show_bug.cgi?id=33568
     7
     8        Use BREW's DBGPRINTF to output debug messages.
     9
     10        * wtf/Assertions.cpp:
     11
    1122010-08-28  Gavin Barraclough  <barraclough@apple.com>
    213
  • trunk/JavaScriptCore/wtf/Assertions.cpp

    r52791 r66345  
    3636#endif
    3737
    38 #if COMPILER(MSVC) && !OS(WINCE)
     38#if COMPILER(MSVC) && !OS(WINCE) && !PLATFORM(BREWMP)
    3939#ifndef WINVER
    4040#define WINVER 0x0500
     
    5151#endif
    5252
     53#if PLATFORM(BREWMP)
     54#include <AEEStdLib.h>
     55#include <wtf/Vector.h>
     56#endif
     57
    5358extern "C" {
     59
     60#if PLATFORM(BREWMP)
     61
     62static void printLog(const Vector<char>& buffer)
     63{
     64    // Each call to DBGPRINTF generates at most 128 bytes of output on the Windows SDK.
     65    // On Qualcomm chipset targets, DBGPRINTF() comes out the diag port (though this may change).
     66    // The length of each output string is constrained even more than on the Windows SDK.
     67#if COMPILER(MSVC)
     68    const int printBufferSize = 128;
     69#else
     70    const int printBufferSize = 32;
     71#endif
     72
     73    char printBuffer[printBufferSize + 1];
     74    printBuffer[printBufferSize] = 0; // to guarantee null termination
     75
     76    const char* p = buffer.data();
     77    const char* end = buffer.data() + buffer.size();
     78    while (p < end) {
     79        strncpy(printBuffer, p, printBufferSize);
     80        DBGPRINTF(printBuffer);
     81        p += printBufferSize;
     82    }
     83}
     84
     85#endif
    5486
    5587WTF_ATTRIBUTE_PRINTF(1, 0)
     
    72104        CFRelease(cfFormat);
    73105    } else
     106#elif PLATFORM(BREWMP)
     107    // When str is 0, the return value is the number of bytes needed
     108    // to accept the result including null termination.
     109    int size = vsnprintf(0, 0, format, args);
     110    if (size > 0) {
     111        Vector<char> buffer(size);
     112        vsnprintf(buffer.data(), size, format, args);
     113        printLog(buffer);
     114    }
     115
    74116#elif COMPILER(MSVC) && !defined(WINCEBASIC)
    75117    if (IsDebuggerPresent()) {
Note: See TracChangeset for help on using the changeset viewer.