| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 3 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
| 4 * Copyright (C) 2011 University of Szeged. All rights reserved. | 4 * Copyright (C) 2011 University of Szeged. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #if (OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__))) && !OS(ANDROID) | 64 #if (OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__))) && !OS(ANDROID) |
| 65 #include <cxxabi.h> | 65 #include <cxxabi.h> |
| 66 #include <dlfcn.h> | 66 #include <dlfcn.h> |
| 67 #include <execinfo.h> | 67 #include <execinfo.h> |
| 68 #endif | 68 #endif |
| 69 | 69 |
| 70 #if OS(ANDROID) | 70 #if OS(ANDROID) |
| 71 #include "android/log.h" | 71 #include "android/log.h" |
| 72 #endif | 72 #endif |
| 73 | 73 |
| 74 #if PLATFORM(BLACKBERRY) | |
| 75 #include <BlackBerryPlatformLog.h> | |
| 76 #endif | |
| 77 | |
| 78 extern "C" { | 74 extern "C" { |
| 79 | 75 |
| 80 WTF_ATTRIBUTE_PRINTF(1, 0) | 76 WTF_ATTRIBUTE_PRINTF(1, 0) |
| 81 static void vprintf_stderr_common(const char* format, va_list args) | 77 static void vprintf_stderr_common(const char* format, va_list args) |
| 82 { | 78 { |
| 83 #if USE(CF) && !OS(WINDOWS) | 79 #if USE(CF) && !OS(WINDOWS) |
| 84 if (strstr(format, "%@")) { | 80 if (strstr(format, "%@")) { |
| 85 CFStringRef cfFormat = CFStringCreateWithCString(NULL, format, kCFString
EncodingUTF8); | 81 CFStringRef cfFormat = CFStringCreateWithCString(NULL, format, kCFString
EncodingUTF8); |
| 86 | 82 |
| 87 #if COMPILER(CLANG) | 83 #if COMPILER(CLANG) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 110 | 106 |
| 111 #if USE(APPLE_SYSTEM_LOG) | 107 #if USE(APPLE_SYSTEM_LOG) |
| 112 va_list copyOfArgs; | 108 va_list copyOfArgs; |
| 113 va_copy(copyOfArgs, args); | 109 va_copy(copyOfArgs, args); |
| 114 asl_vlog(0, 0, ASL_LEVEL_NOTICE, format, copyOfArgs); | 110 asl_vlog(0, 0, ASL_LEVEL_NOTICE, format, copyOfArgs); |
| 115 va_end(copyOfArgs); | 111 va_end(copyOfArgs); |
| 116 #endif | 112 #endif |
| 117 | 113 |
| 118 // Fall through to write to stderr in the same manner as other platforms. | 114 // Fall through to write to stderr in the same manner as other platforms. |
| 119 | 115 |
| 120 #elif PLATFORM(BLACKBERRY) | |
| 121 BBLOGV(BlackBerry::Platform::LogLevelCritical, format, args); | |
| 122 #elif OS(ANDROID) | 116 #elif OS(ANDROID) |
| 123 __android_log_vprint(ANDROID_LOG_WARN, "WebKit", format, args); | 117 __android_log_vprint(ANDROID_LOG_WARN, "WebKit", format, args); |
| 124 #elif HAVE(ISDEBUGGERPRESENT) | 118 #elif HAVE(ISDEBUGGERPRESENT) |
| 125 if (IsDebuggerPresent()) { | 119 if (IsDebuggerPresent()) { |
| 126 size_t size = 1024; | 120 size_t size = 1024; |
| 127 | 121 |
| 128 do { | 122 do { |
| 129 char* buffer = (char*)malloc(size); | 123 char* buffer = (char*)malloc(size); |
| 130 | 124 |
| 131 if (buffer == NULL) | 125 if (buffer == NULL) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 148 #endif | 142 #endif |
| 149 free(buffer); | 143 free(buffer); |
| 150 break; | 144 break; |
| 151 } | 145 } |
| 152 | 146 |
| 153 free(buffer); | 147 free(buffer); |
| 154 size *= 2; | 148 size *= 2; |
| 155 } while (size > 1024); | 149 } while (size > 1024); |
| 156 } | 150 } |
| 157 #endif | 151 #endif |
| 158 #if !PLATFORM(BLACKBERRY) | |
| 159 vfprintf(stderr, format, args); | 152 vfprintf(stderr, format, args); |
| 160 #endif | |
| 161 } | 153 } |
| 162 | 154 |
| 163 #if COMPILER(CLANG) || (COMPILER(GCC) && GCC_VERSION_AT_LEAST(4, 6, 0)) | 155 #if COMPILER(CLANG) || (COMPILER(GCC) && GCC_VERSION_AT_LEAST(4, 6, 0)) |
| 164 #pragma GCC diagnostic push | 156 #pragma GCC diagnostic push |
| 165 #pragma GCC diagnostic ignored "-Wformat-nonliteral" | 157 #pragma GCC diagnostic ignored "-Wformat-nonliteral" |
| 166 #endif | 158 #endif |
| 167 | 159 |
| 168 static void vprintf_stderr_with_prefix(const char* prefix, const char* format, v
a_list args) | 160 static void vprintf_stderr_with_prefix(const char* prefix, const char* format, v
a_list args) |
| 169 { | 161 { |
| 170 size_t prefixLength = strlen(prefix); | 162 size_t prefixLength = strlen(prefix); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 412 |
| 421 void WTFLogAlways(const char* format, ...) | 413 void WTFLogAlways(const char* format, ...) |
| 422 { | 414 { |
| 423 va_list args; | 415 va_list args; |
| 424 va_start(args, format); | 416 va_start(args, format); |
| 425 vprintf_stderr_with_trailing_newline(format, args); | 417 vprintf_stderr_with_trailing_newline(format, args); |
| 426 va_end(args); | 418 va_end(args); |
| 427 } | 419 } |
| 428 | 420 |
| 429 } // extern "C" | 421 } // extern "C" |
| OLD | NEW |