1 /*
2 * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include <stdarg.h>
26
27 // Simple class to format the ctor arguments into a fixed-sized buffer.
28 template <size_t bufsz = 256>
29 class FormatBuffer {
30 public:
31 inline FormatBuffer(const char * format, ...);
32 operator const char *() const { return _buf; }
33
34 private:
35 FormatBuffer(const FormatBuffer &); // prevent copies
36
37 private:
38 char _buf[bufsz];
39 };
40
41 template <size_t bufsz>
42 FormatBuffer<bufsz>::FormatBuffer(const char * format, ...) {
43 va_list argp;
44 va_start(argp, format);
152 const char* message);
153 void report_should_not_call(const char* file, int line);
154 void report_should_not_reach_here(const char* file, int line);
155 void report_unimplemented(const char* file, int line);
156 void report_untested(const char* file, int line, const char* message);
157
158 void warning(const char* format, ...);
159
160 // out of memory reporting
161 void report_java_out_of_memory(const char* message);
162
163 // Support for self-destruct
164 bool is_error_reported();
165 void set_error_reported();
166
167 /* Test assert(), fatal(), guarantee(), etc. */
168 NOT_PRODUCT(void test_error_handler(size_t test_num);)
169
170 void pd_ps(frame f);
171 void pd_obfuscate_location(char *buf, size_t buflen);
|
1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_UTILITIES_DEBUG_HPP
26 #define SHARE_VM_UTILITIES_DEBUG_HPP
27
28 #include "utilities/globalDefinitions.hpp"
29
30 #include <stdarg.h>
31
32 // Simple class to format the ctor arguments into a fixed-sized buffer.
33 template <size_t bufsz = 256>
34 class FormatBuffer {
35 public:
36 inline FormatBuffer(const char * format, ...);
37 operator const char *() const { return _buf; }
38
39 private:
40 FormatBuffer(const FormatBuffer &); // prevent copies
41
42 private:
43 char _buf[bufsz];
44 };
45
46 template <size_t bufsz>
47 FormatBuffer<bufsz>::FormatBuffer(const char * format, ...) {
48 va_list argp;
49 va_start(argp, format);
157 const char* message);
158 void report_should_not_call(const char* file, int line);
159 void report_should_not_reach_here(const char* file, int line);
160 void report_unimplemented(const char* file, int line);
161 void report_untested(const char* file, int line, const char* message);
162
163 void warning(const char* format, ...);
164
165 // out of memory reporting
166 void report_java_out_of_memory(const char* message);
167
168 // Support for self-destruct
169 bool is_error_reported();
170 void set_error_reported();
171
172 /* Test assert(), fatal(), guarantee(), etc. */
173 NOT_PRODUCT(void test_error_handler(size_t test_num);)
174
175 void pd_ps(frame f);
176 void pd_obfuscate_location(char *buf, size_t buflen);
177
178 #endif // SHARE_VM_UTILITIES_DEBUG_HPP
|