annotate src/share/vm/utilities/debug.hpp @ 8506:c3657d00e343

-Merge with tip
author Christos Kotselidis <christos.kotselidis@oracle.com>
date Thu, 21 Mar 2013 14:11:13 +0100
parents 86b4965f0c9a b8f261ba79c6
children b9a918201d47
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1490
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1490
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1490
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef SHARE_VM_UTILITIES_DEBUG_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_UTILITIES_DEBUG_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
2361
1216415d8e35 7014923: G1: code cleanup
tonyp
parents: 2177
diff changeset
28 #include "prims/jvm.h"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "utilities/globalDefinitions.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
31 #include <stdarg.h>
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
32
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
33 // Simple class to format the ctor arguments into a fixed-sized buffer.
6268
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
34 class FormatBufferBase {
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
35 protected:
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
36 char* _buf;
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
37 inline FormatBufferBase(char* buf) : _buf(buf) {}
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
38 public:
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
39 operator const char *() const { return _buf; }
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
40 };
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
41
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
42 // Use resource area for buffer
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
43 #define RES_BUFSZ 256
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
44 class FormatBufferResource : public FormatBufferBase {
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
45 public:
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
46 FormatBufferResource(const char * format, ...);
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
47 };
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
48
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
49 // Use stack for buffer
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
50 template <size_t bufsz = 256>
6268
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
51 class FormatBuffer : public FormatBufferBase {
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
52 public:
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
53 inline FormatBuffer(const char * format, ...);
2152
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 1972
diff changeset
54 inline void append(const char* format, ...);
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
55 inline void print(const char* format, ...);
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
56 inline void printv(const char* format, va_list ap);
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
57
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
58 char* buffer() { return _buf; }
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
59 int size() { return bufsz; }
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
60
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
61 private:
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
62 FormatBuffer(const FormatBuffer &); // prevent copies
6268
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
63 char _buffer[bufsz];
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
64
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
65 protected:
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
66 inline FormatBuffer();
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
67 };
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
68
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
69 template <size_t bufsz>
6268
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
70 FormatBuffer<bufsz>::FormatBuffer(const char * format, ...) : FormatBufferBase(_buffer) {
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
71 va_list argp;
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
72 va_start(argp, format);
2361
1216415d8e35 7014923: G1: code cleanup
tonyp
parents: 2177
diff changeset
73 jio_vsnprintf(_buf, bufsz, format, argp);
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
74 va_end(argp);
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
75 }
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
76
2152
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 1972
diff changeset
77 template <size_t bufsz>
6268
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
78 FormatBuffer<bufsz>::FormatBuffer() : FormatBufferBase(_buffer) {
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
79 _buf[0] = '\0';
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
80 }
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
81
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
82 template <size_t bufsz>
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
83 void FormatBuffer<bufsz>::print(const char * format, ...) {
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
84 va_list argp;
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
85 va_start(argp, format);
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
86 jio_vsnprintf(_buf, bufsz, format, argp);
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
87 va_end(argp);
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
88 }
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
89
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
90 template <size_t bufsz>
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
91 void FormatBuffer<bufsz>::printv(const char * format, va_list argp) {
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
92 jio_vsnprintf(_buf, bufsz, format, argp);
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
93 }
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
94
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 2426
diff changeset
95 template <size_t bufsz>
2152
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 1972
diff changeset
96 void FormatBuffer<bufsz>::append(const char* format, ...) {
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 1972
diff changeset
97 // Given that the constructor does a vsnprintf we can assume that
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 1972
diff changeset
98 // _buf is already initialized.
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 1972
diff changeset
99 size_t len = strlen(_buf);
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 1972
diff changeset
100 char* buf_end = _buf + len;
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 1972
diff changeset
101
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 1972
diff changeset
102 va_list argp;
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 1972
diff changeset
103 va_start(argp, format);
2361
1216415d8e35 7014923: G1: code cleanup
tonyp
parents: 2177
diff changeset
104 jio_vsnprintf(buf_end, bufsz - len, format, argp);
2152
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 1972
diff changeset
105 va_end(argp);
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 1972
diff changeset
106 }
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 1972
diff changeset
107
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
108 // Used to format messages for assert(), guarantee(), fatal(), etc.
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
109 typedef FormatBuffer<> err_msg;
6268
6c5b7a6becc8 7187454: stack overflow in C2 compiler thread on Solaris x86
kvn
parents: 4872
diff changeset
110 typedef FormatBufferResource err_msg_res;
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
111
0
a61af66fc99e Initial load
duke
parents:
diff changeset
112 // assertions
a61af66fc99e Initial load
duke
parents:
diff changeset
113 #ifdef ASSERT
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
114 #ifndef USE_REPEATED_ASSERTS
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
115 #define assert(p, msg) \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
116 do { \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
117 if (!(p)) { \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
118 report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", msg); \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
119 BREAKPOINT; \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
120 } \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
121 } while (0)
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
122 #else // #ifndef USE_REPEATED_ASSERTS
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
123 #define assert(p, msg)
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
124 do { \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
125 for (int __i = 0; __i < AssertRepeat; __i++) { \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
126 if (!(p)) { \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
127 report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", msg); \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
128 BREAKPOINT; \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
129 } \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
130 } \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
131 } while (0)
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
132 #endif // #ifndef USE_REPEATED_ASSERTS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 // This version of assert is for use with checking return status from
a61af66fc99e Initial load
duke
parents:
diff changeset
135 // library calls that return actual error values eg. EINVAL,
a61af66fc99e Initial load
duke
parents:
diff changeset
136 // ENOMEM etc, rather than returning -1 and setting errno.
a61af66fc99e Initial load
duke
parents:
diff changeset
137 // When the status is not what is expected it is very useful to know
a61af66fc99e Initial load
duke
parents:
diff changeset
138 // what status was actually returned, so we pass the status variable as
a61af66fc99e Initial load
duke
parents:
diff changeset
139 // an extra arg and use strerror to convert it to a meaningful string
a61af66fc99e Initial load
duke
parents:
diff changeset
140 // like "Invalid argument", "out of memory" etc
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
141 #define assert_status(p, status, msg) \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
142 do { \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
143 if (!(p)) { \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
144 report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
145 err_msg("error %s(%d) %s", strerror(status), \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
146 status, msg)); \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
147 BREAKPOINT; \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
148 } \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
149 } while (0)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
150
a61af66fc99e Initial load
duke
parents:
diff changeset
151 // Do not assert this condition if there's already another error reported.
a61af66fc99e Initial load
duke
parents:
diff changeset
152 #define assert_if_no_error(cond,msg) assert((cond) || is_error_reported(), msg)
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
153 #else // #ifdef ASSERT
0
a61af66fc99e Initial load
duke
parents:
diff changeset
154 #define assert(p,msg)
a61af66fc99e Initial load
duke
parents:
diff changeset
155 #define assert_status(p,status,msg)
a61af66fc99e Initial load
duke
parents:
diff changeset
156 #define assert_if_no_error(cond,msg)
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
157 #endif // #ifdef ASSERT
0
a61af66fc99e Initial load
duke
parents:
diff changeset
158
a61af66fc99e Initial load
duke
parents:
diff changeset
159 // guarantee is like assert except it's always executed -- use it for
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
160 // cheap tests that catch errors that would otherwise be hard to find.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
161 // guarantee is also used for Verify options.
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
162 #define guarantee(p, msg) \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
163 do { \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
164 if (!(p)) { \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
165 report_vm_error(__FILE__, __LINE__, "guarantee(" #p ") failed", msg); \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
166 BREAKPOINT; \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
167 } \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
168 } while (0)
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
169
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
170 #define fatal(msg) \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
171 do { \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
172 report_fatal(__FILE__, __LINE__, msg); \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
173 BREAKPOINT; \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
174 } while (0)
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
175
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
176 // out of memory
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
177 #define vm_exit_out_of_memory(size, msg) \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
178 do { \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
179 report_vm_out_of_memory(__FILE__, __LINE__, size, msg); \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
180 BREAKPOINT; \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
181 } while (0)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
182
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
183 #define ShouldNotCallThis() \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
184 do { \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
185 report_should_not_call(__FILE__, __LINE__); \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
186 BREAKPOINT; \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
187 } while (0)
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
188
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
189 #define ShouldNotReachHere() \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
190 do { \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
191 report_should_not_reach_here(__FILE__, __LINE__); \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
192 BREAKPOINT; \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
193 } while (0)
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
194
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6268
diff changeset
195 #define ShouldNotReachHere2(message) \
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6268
diff changeset
196 do { \
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6268
diff changeset
197 report_should_not_reach_here2(__FILE__, __LINE__, message); \
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6268
diff changeset
198 BREAKPOINT; \
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6268
diff changeset
199 } while (0)
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6268
diff changeset
200
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
201 #define Unimplemented() \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
202 do { \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
203 report_unimplemented(__FILE__, __LINE__); \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
204 BREAKPOINT; \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
205 } while (0)
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
206
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
207 #define Untested(msg) \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
208 do { \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
209 report_untested(__FILE__, __LINE__, msg); \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
210 BREAKPOINT; \
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
211 } while (0);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
212
a61af66fc99e Initial load
duke
parents:
diff changeset
213 // error reporting helper functions
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
214 void report_vm_error(const char* file, int line, const char* error_msg,
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
215 const char* detail_msg = NULL);
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
216 void report_fatal(const char* file, int line, const char* message);
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
217 void report_vm_out_of_memory(const char* file, int line, size_t size,
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
218 const char* message);
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
219 void report_should_not_call(const char* file, int line);
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
220 void report_should_not_reach_here(const char* file, int line);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6268
diff changeset
221 void report_should_not_reach_here2(const char* file, int line, const char* message);
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
222 void report_unimplemented(const char* file, int line);
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
223 void report_untested(const char* file, int line, const char* message);
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
224
0
a61af66fc99e Initial load
duke
parents:
diff changeset
225 void warning(const char* format, ...);
a61af66fc99e Initial load
duke
parents:
diff changeset
226
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2152
diff changeset
227 // out of shared space reporting
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2152
diff changeset
228 enum SharedSpaceType {
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2152
diff changeset
229 SharedPermGen,
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2152
diff changeset
230 SharedReadOnly,
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2152
diff changeset
231 SharedReadWrite,
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2152
diff changeset
232 SharedMiscData
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2152
diff changeset
233 };
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2152
diff changeset
234
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2152
diff changeset
235 void report_out_of_shared_space(SharedSpaceType space_type);
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2152
diff changeset
236
0
a61af66fc99e Initial load
duke
parents:
diff changeset
237 // out of memory reporting
a61af66fc99e Initial load
duke
parents:
diff changeset
238 void report_java_out_of_memory(const char* message);
a61af66fc99e Initial load
duke
parents:
diff changeset
239
a61af66fc99e Initial load
duke
parents:
diff changeset
240 // Support for self-destruct
a61af66fc99e Initial load
duke
parents:
diff changeset
241 bool is_error_reported();
a61af66fc99e Initial load
duke
parents:
diff changeset
242 void set_error_reported();
a61af66fc99e Initial load
duke
parents:
diff changeset
243
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
244 /* Test assert(), fatal(), guarantee(), etc. */
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
245 NOT_PRODUCT(void test_error_handler(size_t test_num);)
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 0
diff changeset
246
0
a61af66fc99e Initial load
duke
parents:
diff changeset
247 void pd_ps(frame f);
a61af66fc99e Initial load
duke
parents:
diff changeset
248 void pd_obfuscate_location(char *buf, size_t buflen);
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
249
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
250 #endif // SHARE_VM_UTILITIES_DEBUG_HPP