| 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) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 WTF_EXPORT void WTFReportFatalError(const char* file, int line, const char* func
tion, const char* format, ...) WTF_ATTRIBUTE_PRINTF(4, 5); | 101 WTF_EXPORT void WTFReportFatalError(const char* file, int line, const char* func
tion, const char* format, ...) WTF_ATTRIBUTE_PRINTF(4, 5); |
| 102 WTF_EXPORT void WTFReportError(const char* file, int line, const char* function,
const char* format, ...) WTF_ATTRIBUTE_PRINTF(4, 5); | 102 WTF_EXPORT void WTFReportError(const char* file, int line, const char* function,
const char* format, ...) WTF_ATTRIBUTE_PRINTF(4, 5); |
| 103 WTF_EXPORT void WTFLog(WTFLogChannel*, const char* format, ...) WTF_ATTRIBUTE_PR
INTF(2, 3); | 103 WTF_EXPORT void WTFLog(WTFLogChannel*, const char* format, ...) WTF_ATTRIBUTE_PR
INTF(2, 3); |
| 104 WTF_EXPORT void WTFLogVerbose(const char* file, int line, const char* function,
WTFLogChannel*, const char* format, ...) WTF_ATTRIBUTE_PRINTF(5, 6); | 104 WTF_EXPORT void WTFLogVerbose(const char* file, int line, const char* function,
WTFLogChannel*, const char* format, ...) WTF_ATTRIBUTE_PRINTF(5, 6); |
| 105 WTF_EXPORT void WTFLogAlways(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2)
; | 105 WTF_EXPORT void WTFLogAlways(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2)
; |
| 106 | 106 |
| 107 WTF_EXPORT void WTFGetBacktrace(void** stack, int* size); | 107 WTF_EXPORT void WTFGetBacktrace(void** stack, int* size); |
| 108 WTF_EXPORT void WTFReportBacktrace(int framesToShow = 31); | 108 WTF_EXPORT void WTFReportBacktrace(int framesToShow = 31); |
| 109 WTF_EXPORT void WTFPrintBacktrace(void** stack, int size); | 109 WTF_EXPORT void WTFPrintBacktrace(void** stack, int size); |
| 110 | 110 |
| 111 typedef void (*WTFCrashHookFunction)(); | |
| 112 WTF_EXPORT void WTFSetCrashHook(WTFCrashHookFunction); | |
| 113 WTF_EXPORT void WTFInvokeCrashHook(); | |
| 114 WTF_EXPORT void WTFInstallReportBacktraceOnCrashHook(); | |
| 115 | |
| 116 namespace WTF { | 111 namespace WTF { |
| 117 | 112 |
| 118 class WTF_EXPORT FrameToNameScope { | 113 class WTF_EXPORT FrameToNameScope { |
| 119 public: | 114 public: |
| 120 explicit FrameToNameScope(void*); | 115 explicit FrameToNameScope(void*); |
| 121 ~FrameToNameScope(); | 116 ~FrameToNameScope(); |
| 122 const char* nullableName() { return m_name; } | 117 const char* nullableName() { return m_name; } |
| 123 | 118 |
| 124 private: | 119 private: |
| 125 const char* m_name; | 120 const char* m_name; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 143 | 138 |
| 144 Use CRASH() in response to known, unrecoverable errors like out-of-memory. | 139 Use CRASH() in response to known, unrecoverable errors like out-of-memory. |
| 145 Macro is enabled in both debug and release mode. | 140 Macro is enabled in both debug and release mode. |
| 146 To test for unknown errors and verify assumptions, use ASSERT instead, to avo
id impacting performance in release builds. | 141 To test for unknown errors and verify assumptions, use ASSERT instead, to avo
id impacting performance in release builds. |
| 147 | 142 |
| 148 Signals are ignored by the crash reporter on OS X so we must do better. | 143 Signals are ignored by the crash reporter on OS X so we must do better. |
| 149 */ | 144 */ |
| 150 #ifndef CRASH | 145 #ifndef CRASH |
| 151 #define CRASH() \ | 146 #define CRASH() \ |
| 152 (WTFReportBacktrace(), \ | 147 (WTFReportBacktrace(), \ |
| 153 WTFInvokeCrashHook(), \ | |
| 154 (*(int*)0xfbadbeef = 0), \ | 148 (*(int*)0xfbadbeef = 0), \ |
| 155 IMMEDIATE_CRASH()) | 149 IMMEDIATE_CRASH()) |
| 156 #endif | 150 #endif |
| 157 | 151 |
| 158 #if COMPILER(CLANG) | 152 #if COMPILER(CLANG) |
| 159 #define NO_RETURN_DUE_TO_CRASH NO_RETURN | 153 #define NO_RETURN_DUE_TO_CRASH NO_RETURN |
| 160 #else | 154 #else |
| 161 #define NO_RETURN_DUE_TO_CRASH | 155 #define NO_RETURN_DUE_TO_CRASH |
| 162 #endif | 156 #endif |
| 163 | 157 |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 } \ | 405 } \ |
| 412 inline const thisType& to##thisType(const argumentType& argumentName) \ | 406 inline const thisType& to##thisType(const argumentType& argumentName) \ |
| 413 { \ | 407 { \ |
| 414 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ | 408 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ |
| 415 return static_cast<const thisType&>(argumentName); \ | 409 return static_cast<const thisType&>(argumentName); \ |
| 416 } \ | 410 } \ |
| 417 void to##thisType(const thisType*); \ | 411 void to##thisType(const thisType*); \ |
| 418 void to##thisType(const thisType&) | 412 void to##thisType(const thisType&) |
| 419 | 413 |
| 420 #endif /* WTF_Assertions_h */ | 414 #endif /* WTF_Assertions_h */ |
| OLD | NEW |