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_VMERROR_HPP
26 #define SHARE_VM_UTILITIES_VMERROR_HPP
27
28 #include "utilities/globalDefinitions.hpp"
29
30 class Decoder;
31 class VM_ReportJavaOutOfMemory;
32
33 class VMError : public AllStatic {
34 friend class VM_ReportJavaOutOfMemory;
35 friend class Decoder;
36 friend class VMStructs;
37
38 static int _id; // Solaris/Linux signals: 0 - SIGRTMAX
39 // Windows exceptions: 0xCxxxxxxx system errors
40 // 0x8xxxxxxx system warnings
41
42 static const char* _message;
43 static char _detail_msg[1024];
44
45 static Thread* _thread; // NULL if it's native thread
46
47 // additional info for crashes
48 static address _pc; // faulting PC
49 static void* _siginfo; // ExceptionRecord on Windows,
50 // siginfo_t on Solaris/Linux
81 static volatile bool _reporting_did_timeout;
82 // Timestamp at which the last error reporting step started; -1 if no error reporting
83 // in progress.
84 static volatile jlong _step_start_time;
85 // Whether or not the last error reporting step did timeout.
86 static volatile bool _step_did_timeout;
87
88 // set signal handlers on Solaris/Linux or the default exception filter
89 // on Windows, to handle recursive crashes.
90 static void reset_signal_handlers();
91
92 // handle -XX:+ShowMessageBoxOnError. buf is used to format the message string
93 static void show_message_box(char* buf, int buflen);
94
95 // generate an error report
96 static void report(outputStream* st, bool verbose);
97
98 // generate a stack trace
99 static void print_stack_trace(outputStream* st, JavaThread* jt,
100 char* buf, int buflen, bool verbose = false);
101
102 static bool should_report_bug(unsigned int id) {
103 return (id != OOM_MALLOC_ERROR) && (id != OOM_MMAP_ERROR);
104 }
105
106 // Write a hint to the stream in case siginfo relates to a segv/bus error
107 // and the offending address points into CDS store.
108 static void check_failing_cds_access(outputStream* st, const void* siginfo);
109
110 static void report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo,
111 void* context, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(6, 7);
112 static void report_and_die(const char* message, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(2, 3);
113
114 static fdStream out;
115 static fdStream log; // error log used by VMError::report_and_die()
116
117 // Timeout handling.
118 // Hook functions for platform dependend functionality:
119 static void reporting_started();
120 static void interrupt_reporting_thread();
|
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_VMERROR_HPP
26 #define SHARE_VM_UTILITIES_VMERROR_HPP
27
28 #include "utilities/globalDefinitions.hpp"
29
30 class Decoder;
31 class frame;
32 class VM_ReportJavaOutOfMemory;
33
34 class VMError : public AllStatic {
35 friend class VM_ReportJavaOutOfMemory;
36 friend class Decoder;
37 friend class VMStructs;
38
39 static int _id; // Solaris/Linux signals: 0 - SIGRTMAX
40 // Windows exceptions: 0xCxxxxxxx system errors
41 // 0x8xxxxxxx system warnings
42
43 static const char* _message;
44 static char _detail_msg[1024];
45
46 static Thread* _thread; // NULL if it's native thread
47
48 // additional info for crashes
49 static address _pc; // faulting PC
50 static void* _siginfo; // ExceptionRecord on Windows,
51 // siginfo_t on Solaris/Linux
82 static volatile bool _reporting_did_timeout;
83 // Timestamp at which the last error reporting step started; -1 if no error reporting
84 // in progress.
85 static volatile jlong _step_start_time;
86 // Whether or not the last error reporting step did timeout.
87 static volatile bool _step_did_timeout;
88
89 // set signal handlers on Solaris/Linux or the default exception filter
90 // on Windows, to handle recursive crashes.
91 static void reset_signal_handlers();
92
93 // handle -XX:+ShowMessageBoxOnError. buf is used to format the message string
94 static void show_message_box(char* buf, int buflen);
95
96 // generate an error report
97 static void report(outputStream* st, bool verbose);
98
99 // generate a stack trace
100 static void print_stack_trace(outputStream* st, JavaThread* jt,
101 char* buf, int buflen, bool verbose = false);
102
103 // public for use by the internal non-product debugger.
104 NOT_PRODUCT(public:)
105 static void print_native_stack(outputStream* st, frame fr, Thread* t,
106 char* buf, int buf_size);
107 NOT_PRODUCT(private:)
108
109 static bool should_report_bug(unsigned int id) {
110 return (id != OOM_MALLOC_ERROR) && (id != OOM_MMAP_ERROR);
111 }
112
113 // Write a hint to the stream in case siginfo relates to a segv/bus error
114 // and the offending address points into CDS store.
115 static void check_failing_cds_access(outputStream* st, const void* siginfo);
116
117 static void report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo,
118 void* context, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(6, 7);
119 static void report_and_die(const char* message, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(2, 3);
120
121 static fdStream out;
122 static fdStream log; // error log used by VMError::report_and_die()
123
124 // Timeout handling.
125 // Hook functions for platform dependend functionality:
126 static void reporting_started();
127 static void interrupt_reporting_thread();
|