src/share/vm/utilities/vmError.hpp

Sat, 18 May 2013 20:41:01 -0700

author
iklam
date
Sat, 18 May 2013 20:41:01 -0700
changeset 5144
a5d6f0c3585f
parent 4993
746b070f5022
child 5333
068b406e307f
permissions
-rw-r--r--

8014262: PrintStringTableStatistics should include more footprint info
Summary: Added info for the string/symbol objects and the hash entries
Reviewed-by: coleenp, rbackman

     1 /*
     2  * Copyright (c) 2003, 2012, 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  */
    25 #ifndef SHARE_VM_UTILITIES_VMERROR_HPP
    26 #define SHARE_VM_UTILITIES_VMERROR_HPP
    28 #include "utilities/globalDefinitions.hpp"
    30 class Decoder;
    31 class VM_ReportJavaOutOfMemory;
    33 class VMError : public StackObj {
    34   friend class VM_ReportJavaOutOfMemory;
    35   friend class Decoder;
    37   int          _id;          // Solaris/Linux signals: 0 - SIGRTMAX
    38                              // Windows exceptions: 0xCxxxxxxx system errors
    39                              //                     0x8xxxxxxx system warnings
    41   const char * _message;
    42   const char * _detail_msg;
    44   Thread *     _thread;      // NULL if it's native thread
    47   // additional info for crashes
    48   address      _pc;          // faulting PC
    49   void *       _siginfo;     // ExceptionRecord on Windows,
    50                              // siginfo_t on Solaris/Linux
    51   void *       _context;     // ContextRecord on Windows,
    52                              // ucontext_t on Solaris/Linux
    54   // additional info for VM internal errors
    55   const char * _filename;
    56   int          _lineno;
    58   // used by fatal error handler
    59   int          _current_step;
    60   const char * _current_step_info;
    61   int          _verbose;
    62   // First error, and its thread id. We must be able to handle native thread,
    63   // so use thread id instead of Thread* to identify thread.
    64   static VMError* volatile first_error;
    65   static volatile jlong    first_error_tid;
    67   // Core dump status, false if we have been unable to write a core/minidump for some reason
    68   static bool coredump_status;
    70   // When coredump_status is set to true this will contain the name/path to the core/minidump,
    71   // if coredump_status if false, this will (hopefully) contain a useful error explaining why
    72   // no core/minidump has been written to disk
    73   static char coredump_message[O_BUFLEN];
    75   // used by reporting about OOM
    76   size_t       _size;
    78   // set signal handlers on Solaris/Linux or the default exception filter
    79   // on Windows, to handle recursive crashes.
    80   void reset_signal_handlers();
    82   // handle -XX:+ShowMessageBoxOnError. buf is used to format the message string
    83   void show_message_box(char* buf, int buflen);
    85   // generate an error report
    86   void report(outputStream* st);
    88   // generate a stack trace
    89   static void print_stack_trace(outputStream* st, JavaThread* jt,
    90                                 char* buf, int buflen, bool verbose = false);
    92   // accessor
    93   const char* message() const    { return _message; }
    94   const char* detail_msg() const { return _detail_msg; }
    95   bool should_report_bug(unsigned int id) {
    96     return (id != OOM_MALLOC_ERROR) && (id != OOM_MMAP_ERROR);
    97   }
    99 public:
   101   // Constructor for crashes
   102   VMError(Thread* thread, unsigned int sig, address pc, void* siginfo,
   103           void* context);
   104   // Constructor for VM internal errors
   105   VMError(Thread* thread, const char* filename, int lineno,
   106           const char* message, const char * detail_msg);
   108   // Constructor for VM OOM errors
   109   VMError(Thread* thread, const char* filename, int lineno, size_t size,
   110           VMErrorType vm_err_type, const char* message);
   111   // Constructor for non-fatal errors
   112   VMError(const char* message);
   114   // return a string to describe the error
   115   char *error_string(char* buf, int buflen);
   117   // Report status of core/minidump
   118   static void report_coredump_status(const char* message, bool status);
   120   // main error reporting function
   121   void report_and_die();
   123   // reporting OutOfMemoryError
   124   void report_java_out_of_memory();
   126   // returns original flags for signal, if it was resetted, or -1 if
   127   // signal was not changed by error reporter
   128   static int get_resetted_sigflags(int sig);
   130   // returns original handler for signal, if it was resetted, or NULL if
   131   // signal was not changed by error reporter
   132   static address get_resetted_sighandler(int sig);
   134   // check to see if fatal error reporting is in progress
   135   static bool fatal_error_in_progress() { return first_error != NULL; }
   136 };
   138 #endif // SHARE_VM_UTILITIES_VMERROR_HPP

mercurial