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