32 |
32 |
33 class VMError : public StackObj { |
33 class VMError : public StackObj { |
34 friend class VM_ReportJavaOutOfMemory; |
34 friend class VM_ReportJavaOutOfMemory; |
35 friend class Decoder; |
35 friend class Decoder; |
36 |
36 |
37 enum ErrorType { |
|
38 internal_error = 0xe0000000, |
|
39 oom_error = 0xe0000001 |
|
40 }; |
|
41 int _id; // Solaris/Linux signals: 0 - SIGRTMAX |
37 int _id; // Solaris/Linux signals: 0 - SIGRTMAX |
42 // Windows exceptions: 0xCxxxxxxx system errors |
38 // Windows exceptions: 0xCxxxxxxx system errors |
43 // 0x8xxxxxxx system warnings |
39 // 0x8xxxxxxx system warnings |
44 |
40 |
45 const char * _message; |
41 const char * _message; |
94 char* buf, int buflen, bool verbose = false); |
90 char* buf, int buflen, bool verbose = false); |
95 |
91 |
96 // accessor |
92 // accessor |
97 const char* message() const { return _message; } |
93 const char* message() const { return _message; } |
98 const char* detail_msg() const { return _detail_msg; } |
94 const char* detail_msg() const { return _detail_msg; } |
99 bool should_report_bug(unsigned int id) { return id != oom_error; } |
95 bool should_report_bug(unsigned int id) { |
|
96 return (id != OOM_MALLOC_ERROR) && (id != OOM_MMAP_ERROR); |
|
97 } |
100 |
98 |
101 public: |
99 public: |
|
100 |
102 // Constructor for crashes |
101 // Constructor for crashes |
103 VMError(Thread* thread, unsigned int sig, address pc, void* siginfo, |
102 VMError(Thread* thread, unsigned int sig, address pc, void* siginfo, |
104 void* context); |
103 void* context); |
105 // Constructor for VM internal errors |
104 // Constructor for VM internal errors |
106 VMError(Thread* thread, const char* filename, int lineno, |
105 VMError(Thread* thread, const char* filename, int lineno, |
107 const char* message, const char * detail_msg); |
106 const char* message, const char * detail_msg); |
108 |
107 |
109 // Constructor for VM OOM errors |
108 // Constructor for VM OOM errors |
110 VMError(Thread* thread, const char* filename, int lineno, size_t size, |
109 VMError(Thread* thread, const char* filename, int lineno, size_t size, |
111 const char* message); |
110 VMErrorType vm_err_type, const char* message); |
112 // Constructor for non-fatal errors |
111 // Constructor for non-fatal errors |
113 VMError(const char* message); |
112 VMError(const char* message); |
114 |
113 |
115 // return a string to describe the error |
114 // return a string to describe the error |
116 char *error_string(char* buf, int buflen); |
115 char *error_string(char* buf, int buflen); |