annotate src/share/vm/utilities/vmError.hpp @ 1721:413ad0331a0c

6977924: Changes for 6975078 produce build error with certain gcc versions Summary: The changes introduced for 6975078 assign badHeapOopVal to the _allocation field in the ResourceObj class. In 32 bit linux builds with certain versions of gcc this assignment will be flagged as an error while compiling allocation.cpp. In 32 bit builds the constant value badHeapOopVal (which is cast to an intptr_t) is negative. The _allocation field is typed as an unsigned intptr_t and gcc catches this as an error. Reviewed-by: jcoomes, ysr, phh
author johnc
date Wed, 18 Aug 2010 10:59:06 -0700
parents 126ea7725993
children f95d63e2154a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1490
diff changeset
2 * Copyright (c) 2003, 2010, 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
a61af66fc99e Initial load
duke
parents:
diff changeset
25
a61af66fc99e Initial load
duke
parents:
diff changeset
26 class VM_ReportJavaOutOfMemory;
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28 class VMError : public StackObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
29 friend class VM_ReportJavaOutOfMemory;
a61af66fc99e Initial load
duke
parents:
diff changeset
30
a61af66fc99e Initial load
duke
parents:
diff changeset
31 enum ErrorType {
a61af66fc99e Initial load
duke
parents:
diff changeset
32 internal_error = 0xe0000000,
a61af66fc99e Initial load
duke
parents:
diff changeset
33 oom_error = 0xe0000001
a61af66fc99e Initial load
duke
parents:
diff changeset
34 };
a61af66fc99e Initial load
duke
parents:
diff changeset
35 int _id; // Solaris/Linux signals: 0 - SIGRTMAX
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // Windows exceptions: 0xCxxxxxxx system errors
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // 0x8xxxxxxx system warnings
a61af66fc99e Initial load
duke
parents:
diff changeset
38
a61af66fc99e Initial load
duke
parents:
diff changeset
39 const char * _message;
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 1384
diff changeset
40 const char * _detail_msg;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
41
a61af66fc99e Initial load
duke
parents:
diff changeset
42 Thread * _thread; // NULL if it's native thread
a61af66fc99e Initial load
duke
parents:
diff changeset
43
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // additional info for crashes
a61af66fc99e Initial load
duke
parents:
diff changeset
46 address _pc; // faulting PC
a61af66fc99e Initial load
duke
parents:
diff changeset
47 void * _siginfo; // ExceptionRecord on Windows,
a61af66fc99e Initial load
duke
parents:
diff changeset
48 // siginfo_t on Solaris/Linux
a61af66fc99e Initial load
duke
parents:
diff changeset
49 void * _context; // ContextRecord on Windows,
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // ucontext_t on Solaris/Linux
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // additional info for VM internal errors
a61af66fc99e Initial load
duke
parents:
diff changeset
53 const char * _filename;
603
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 513
diff changeset
54 int _lineno;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 // used by fatal error handler
a61af66fc99e Initial load
duke
parents:
diff changeset
57 int _current_step;
a61af66fc99e Initial load
duke
parents:
diff changeset
58 const char * _current_step_info;
a61af66fc99e Initial load
duke
parents:
diff changeset
59 int _verbose;
1681
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1552
diff changeset
60 // First error, and its thread id. We must be able to handle native thread,
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1552
diff changeset
61 // so use thread id instead of Thread* to identify thread.
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1552
diff changeset
62 static VMError* volatile first_error;
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1552
diff changeset
63 static volatile jlong first_error_tid;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // used by reporting about OOM
a61af66fc99e Initial load
duke
parents:
diff changeset
66 size_t _size;
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // set signal handlers on Solaris/Linux or the default exception filter
a61af66fc99e Initial load
duke
parents:
diff changeset
69 // on Windows, to handle recursive crashes.
a61af66fc99e Initial load
duke
parents:
diff changeset
70 void reset_signal_handlers();
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 // handle -XX:+ShowMessageBoxOnError. buf is used to format the message string
a61af66fc99e Initial load
duke
parents:
diff changeset
73 void show_message_box(char* buf, int buflen);
a61af66fc99e Initial load
duke
parents:
diff changeset
74
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // generate an error report
a61af66fc99e Initial load
duke
parents:
diff changeset
76 void report(outputStream* st);
a61af66fc99e Initial load
duke
parents:
diff changeset
77
1384
c544d979f886 6944503: Improved Zero crash dump
twisti
parents: 628
diff changeset
78 // generate a stack trace
c544d979f886 6944503: Improved Zero crash dump
twisti
parents: 628
diff changeset
79 static void print_stack_trace(outputStream* st, JavaThread* jt,
c544d979f886 6944503: Improved Zero crash dump
twisti
parents: 628
diff changeset
80 char* buf, int buflen, bool verbose = false);
c544d979f886 6944503: Improved Zero crash dump
twisti
parents: 628
diff changeset
81
0
a61af66fc99e Initial load
duke
parents:
diff changeset
82 // accessor
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 1384
diff changeset
83 const char* message() const { return _message; }
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 1384
diff changeset
84 const char* detail_msg() const { return _detail_msg; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
87 // Constructor for crashes
a61af66fc99e Initial load
duke
parents:
diff changeset
88 VMError(Thread* thread, int sig, address pc, void* siginfo, void* context);
a61af66fc99e Initial load
duke
parents:
diff changeset
89 // Constructor for VM internal errors
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 1384
diff changeset
90 VMError(Thread* thread, const char* filename, int lineno,
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 1384
diff changeset
91 const char* message, const char * detail_msg);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
92
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 1384
diff changeset
93 // Constructor for VM OOM errors
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 1384
diff changeset
94 VMError(Thread* thread, const char* filename, int lineno, size_t size,
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 1384
diff changeset
95 const char* message);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // Constructor for non-fatal errors
a61af66fc99e Initial load
duke
parents:
diff changeset
97 VMError(const char* message);
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // return a string to describe the error
a61af66fc99e Initial load
duke
parents:
diff changeset
100 char *error_string(char* buf, int buflen);
a61af66fc99e Initial load
duke
parents:
diff changeset
101
a61af66fc99e Initial load
duke
parents:
diff changeset
102 // main error reporting function
a61af66fc99e Initial load
duke
parents:
diff changeset
103 void report_and_die();
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // reporting OutOfMemoryError
a61af66fc99e Initial load
duke
parents:
diff changeset
106 void report_java_out_of_memory();
a61af66fc99e Initial load
duke
parents:
diff changeset
107
a61af66fc99e Initial load
duke
parents:
diff changeset
108 // returns original flags for signal, if it was resetted, or -1 if
a61af66fc99e Initial load
duke
parents:
diff changeset
109 // signal was not changed by error reporter
a61af66fc99e Initial load
duke
parents:
diff changeset
110 static int get_resetted_sigflags(int sig);
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112 // returns original handler for signal, if it was resetted, or NULL if
a61af66fc99e Initial load
duke
parents:
diff changeset
113 // signal was not changed by error reporter
a61af66fc99e Initial load
duke
parents:
diff changeset
114 static address get_resetted_sighandler(int sig);
1681
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1552
diff changeset
115
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1552
diff changeset
116 // check to see if fatal error reporting is in progress
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1552
diff changeset
117 static bool fatal_error_in_progress() { return first_error != NULL; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
118 };