20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_UTILITIES_DEBUG_HPP
26 #define SHARE_UTILITIES_DEBUG_HPP
27
28 #include "utilities/breakpoint.hpp"
29 #include "utilities/compilerWarnings.hpp"
30 #include "utilities/macros.hpp"
31
32 #include <stddef.h>
33
34 // ShowRegistersOnAssert support (for now Linux only)
35 #if defined(LINUX) && !defined(ZERO)
36 #define CAN_SHOW_REGISTERS_ON_ASSERT
37 extern char* g_assert_poison;
38 #define TOUCH_ASSERT_POISON (*g_assert_poison) = 'X';
39 void initialize_assert_poison();
40 bool handle_assert_poison_fault(const void* ucVoid, const void* faulting_address);
41 #else
42 #define TOUCH_ASSERT_POISON
43 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
44
45 // assertions
46 #ifndef ASSERT
47 #define vmassert(p, ...)
48 #else
49 // Note: message says "assert" rather than "vmassert" for backward
50 // compatibility with tools that parse/match the message text.
51 // Note: The signature is vmassert(p, format, ...), but the solaris
52 // compiler can't handle an empty ellipsis in a macro without a warning.
53 #define vmassert(p, ...) \
54 do { \
55 if (!(p)) { \
56 TOUCH_ASSERT_POISON; \
57 report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", __VA_ARGS__); \
58 BREAKPOINT; \
59 } \
|
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_UTILITIES_DEBUG_HPP
26 #define SHARE_UTILITIES_DEBUG_HPP
27
28 #include "utilities/breakpoint.hpp"
29 #include "utilities/compilerWarnings.hpp"
30 #include "utilities/macros.hpp"
31
32 #include <stddef.h>
33
34 // ShowRegistersOnAssert support (for now Linux only)
35 #if defined(LINUX) && !defined(ZERO)
36 #define CAN_SHOW_REGISTERS_ON_ASSERT
37 extern char* g_assert_poison;
38 #define TOUCH_ASSERT_POISON (*g_assert_poison) = 'X';
39 void initialize_assert_poison();
40 void disarm_assert_poison();
41 bool handle_assert_poison_fault(const void* ucVoid, const void* faulting_address);
42 #else
43 #define TOUCH_ASSERT_POISON
44 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
45
46 // assertions
47 #ifndef ASSERT
48 #define vmassert(p, ...)
49 #else
50 // Note: message says "assert" rather than "vmassert" for backward
51 // compatibility with tools that parse/match the message text.
52 // Note: The signature is vmassert(p, format, ...), but the solaris
53 // compiler can't handle an empty ellipsis in a macro without a warning.
54 #define vmassert(p, ...) \
55 do { \
56 if (!(p)) { \
57 TOUCH_ASSERT_POISON; \
58 report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", __VA_ARGS__); \
59 BREAKPOINT; \
60 } \
|