diff options
Diffstat (limited to 'JavaScriptCore/wtf/Assertions.cpp')
| -rw-r--r-- | JavaScriptCore/wtf/Assertions.cpp | 51 |
1 files changed, 46 insertions, 5 deletions
diff --git a/JavaScriptCore/wtf/Assertions.cpp b/JavaScriptCore/wtf/Assertions.cpp index cadbc91..1841150 100644 --- a/JavaScriptCore/wtf/Assertions.cpp +++ b/JavaScriptCore/wtf/Assertions.cpp @@ -35,23 +35,54 @@ #include <CoreFoundation/CFString.h> #endif -#if COMPILER(MSVC) && !OS(WINCE) +#if COMPILER(MSVC) && !OS(WINCE) && !PLATFORM(BREWMP) #ifndef WINVER #define WINVER 0x0500 #endif #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0500 #endif -#include <windows.h> #include <crtdbg.h> #endif -#if OS(WINCE) -#include <winbase.h> +#if OS(WINDOWS) +#include <windows.h> +#endif + +#if PLATFORM(BREWMP) +#include <AEEdbg.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); + dbg_Message(printBuffer, DBG_MSG_LEVEL_HIGH, __FILE__, __LINE__); + p += printBufferSize; + } +} + +#endif + WTF_ATTRIBUTE_PRINTF(1, 0) static void vprintf_stderr_common(const char* format, va_list args) { @@ -71,7 +102,17 @@ static void vprintf_stderr_common(const char* format, va_list args) CFRelease(str); CFRelease(cfFormat); } else -#elif COMPILER(MSVC) && !defined(WINCEBASIC) +#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 HAVE(ISDEBUGGERPRESENT) if (IsDebuggerPresent()) { size_t size = 1024; |
