src/share/vm/utilities/vmError.hpp

Tue, 03 Aug 2010 08:13:38 -0400

author
bobv
date
Tue, 03 Aug 2010 08:13:38 -0400
changeset 2036
126ea7725993
parent 1907
c18cbe5936b8
child 2314
f95d63e2154a
permissions
-rw-r--r--

6953477: Increase portability and flexibility of building Hotspot
Summary: A collection of portability improvements including shared code support for PPC, ARM platforms, software floating point, cross compilation support and improvements in error crash detail.
Reviewed-by: phh, never, coleenp, dholmes

     1 /*
     2  * Copyright (c) 2003, 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  */
    26 class VM_ReportJavaOutOfMemory;
    28 class VMError : public StackObj {
    29   friend class VM_ReportJavaOutOfMemory;
    31   enum ErrorType {
    32     internal_error = 0xe0000000,
    33     oom_error      = 0xe0000001
    34   };
    35   int          _id;          // Solaris/Linux signals: 0 - SIGRTMAX
    36                              // Windows exceptions: 0xCxxxxxxx system errors
    37                              //                     0x8xxxxxxx system warnings
    39   const char * _message;
    40   const char * _detail_msg;
    42   Thread *     _thread;      // NULL if it's native thread
    45   // additional info for crashes
    46   address      _pc;          // faulting PC
    47   void *       _siginfo;     // ExceptionRecord on Windows,
    48                              // siginfo_t on Solaris/Linux
    49   void *       _context;     // ContextRecord on Windows,
    50                              // ucontext_t on Solaris/Linux
    52   // additional info for VM internal errors
    53   const char * _filename;
    54   int          _lineno;
    56   // used by fatal error handler
    57   int          _current_step;
    58   const char * _current_step_info;
    59   int          _verbose;
    60   // First error, and its thread id. We must be able to handle native thread,
    61   // so use thread id instead of Thread* to identify thread.
    62   static VMError* volatile first_error;
    63   static volatile jlong    first_error_tid;
    65   // used by reporting about OOM
    66   size_t       _size;
    68   // set signal handlers on Solaris/Linux or the default exception filter
    69   // on Windows, to handle recursive crashes.
    70   void reset_signal_handlers();
    72   // handle -XX:+ShowMessageBoxOnError. buf is used to format the message string
    73   void show_message_box(char* buf, int buflen);
    75   // generate an error report
    76   void report(outputStream* st);
    78   // generate a stack trace
    79   static void print_stack_trace(outputStream* st, JavaThread* jt,
    80                                 char* buf, int buflen, bool verbose = false);
    82   // accessor
    83   const char* message() const    { return _message; }
    84   const char* detail_msg() const { return _detail_msg; }
    86 public:
    87   // Constructor for crashes
    88   VMError(Thread* thread, int sig, address pc, void* siginfo, void* context);
    89   // Constructor for VM internal errors
    90   VMError(Thread* thread, const char* filename, int lineno,
    91           const char* message, const char * detail_msg);
    93   // Constructor for VM OOM errors
    94   VMError(Thread* thread, const char* filename, int lineno, size_t size,
    95           const char* message);
    96   // Constructor for non-fatal errors
    97   VMError(const char* message);
    99   // return a string to describe the error
   100   char *error_string(char* buf, int buflen);
   102   // main error reporting function
   103   void report_and_die();
   105   // reporting OutOfMemoryError
   106   void report_java_out_of_memory();
   108   // returns original flags for signal, if it was resetted, or -1 if
   109   // signal was not changed by error reporter
   110   static int get_resetted_sigflags(int sig);
   112   // returns original handler for signal, if it was resetted, or NULL if
   113   // signal was not changed by error reporter
   114   static address get_resetted_sighandler(int sig);
   116   // check to see if fatal error reporting is in progress
   117   static bool fatal_error_in_progress() { return first_error != NULL; }
   118 };

mercurial