Chromium Code Reviews| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 const char* m_name; | 120 const char* m_name; |
| 121 char* m_cxaDemangled; | 121 char* m_cxaDemangled; |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 } // namespace WTF | 124 } // namespace WTF |
| 125 | 125 |
| 126 using WTF::FrameToNameScope; | 126 using WTF::FrameToNameScope; |
| 127 | 127 |
| 128 /* IMMEDIATE_CRASH() - Like CRASH() below but crashes in the fastest, simplest p ossible way with no attempt at logging. */ | 128 /* IMMEDIATE_CRASH() - Like CRASH() below but crashes in the fastest, simplest p ossible way with no attempt at logging. */ |
| 129 #ifndef IMMEDIATE_CRASH | 129 #ifndef IMMEDIATE_CRASH |
| 130 #if COMPILER(GCC) | 130 #if COMPILER(GCC) |
|
Nico
2015/07/02 04:54:37
Isn't it a better fix to change this to COMIPLER(G
Sam McNally
2015/07/02 05:09:40
I'm not sure why, but doing that instead doesn't f
Nico
2015/07/02 05:22:36
Hm, strange. Seems to work in a reduced example:
Sam McNally
2015/07/02 06:01:12
It turns out that CRASH is defined as __debugbreak
Sam McNally
2015/07/03 01:16:05
I've changed this to add a __builtin_unreachable()
| |
| 131 #define IMMEDIATE_CRASH() __builtin_trap() | 131 #define IMMEDIATE_CRASH() __builtin_trap() |
| 132 #else | 132 #else |
| 133 #define IMMEDIATE_CRASH() ((void)(*(volatile char*)0 = 0)) | 133 #define IMMEDIATE_CRASH() ((void)(*(volatile char*)0 = 0)) |
| 134 #endif | 134 #endif |
| 135 #endif | 135 #endif |
| 136 | 136 |
| 137 /* CRASH() - Raises a fatal error resulting in program termination and triggerin g either the debugger or the crash reporter. | 137 /* CRASH() - Raises a fatal error resulting in program termination and triggerin g either the debugger or the crash reporter. |
| 138 | 138 |
| 139 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. |
| 140 Macro is enabled in both debug and release mode. | 140 Macro is enabled in both debug and release mode. |
| 141 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. |
| 142 | 142 |
| 143 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. |
| 144 */ | 144 */ |
| 145 #ifndef CRASH | 145 #ifndef CRASH |
| 146 #define CRASH() \ | 146 #define CRASH() \ |
| 147 (WTFReportBacktrace(), \ | 147 (WTFReportBacktrace(), \ |
| 148 (*(int*)0xfbadbeef = 0), \ | 148 (*(int*)0xfbadbeef = 0), \ |
| 149 IMMEDIATE_CRASH()) | 149 IMMEDIATE_CRASH()) |
| 150 #endif | 150 #endif |
| 151 | 151 |
| 152 #if COMPILER(CLANG) | 152 #if COMPILER(CLANG) && COMPILER(GCC) |
| 153 #define NO_RETURN_DUE_TO_CRASH NO_RETURN | 153 #define NO_RETURN_DUE_TO_CRASH NO_RETURN |
| 154 #else | 154 #else |
| 155 #define NO_RETURN_DUE_TO_CRASH | 155 #define NO_RETURN_DUE_TO_CRASH |
| 156 #endif | 156 #endif |
| 157 | 157 |
| 158 /* BACKTRACE | 158 /* BACKTRACE |
| 159 | 159 |
| 160 Print a backtrace to the same location as ASSERT messages. | 160 Print a backtrace to the same location as ASSERT messages. |
| 161 */ | 161 */ |
| 162 #if BACKTRACE_DISABLED | 162 #if BACKTRACE_DISABLED |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 } \ | 393 } \ |
| 394 inline const thisType& to##thisType(const argumentType& argumentName) \ | 394 inline const thisType& to##thisType(const argumentType& argumentName) \ |
| 395 { \ | 395 { \ |
| 396 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ | 396 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ |
| 397 return static_cast<const thisType&>(argumentName); \ | 397 return static_cast<const thisType&>(argumentName); \ |
| 398 } \ | 398 } \ |
| 399 void to##thisType(const thisType*); \ | 399 void to##thisType(const thisType*); \ |
| 400 void to##thisType(const thisType&) | 400 void to##thisType(const thisType&) |
| 401 | 401 |
| 402 #endif /* WTF_Assertions_h */ | 402 #endif /* WTF_Assertions_h */ |
| OLD | NEW |