Path: blob/master/runtime/gc_check/CheckReporter.hpp
5990 views
1/*******************************************************************************2* Copyright (c) 1991, 2014 IBM Corp. and others3*4* This program and the accompanying materials are made available under5* the terms of the Eclipse Public License 2.0 which accompanies this6* distribution and is available at https://www.eclipse.org/legal/epl-2.0/7* or the Apache License, Version 2.0 which accompanies this distribution and8* is available at https://www.apache.org/licenses/LICENSE-2.0.9*10* This Source Code may also be made available under the following11* Secondary Licenses when the conditions for such availability set12* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU13* General Public License, version 2 with the GNU Classpath14* Exception [1] and GNU General Public License, version 2 with the15* OpenJDK Assembly Exception [2].16*17* [1] https://www.gnu.org/software/classpath/license.html18* [2] http://openjdk.java.net/legal/assembly-exception.html19*20* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception21*******************************************************************************/2223/**24* @file25* @ingroup GC_Check26*/2728#if !defined(CHECKREPORTER_HPP_)29#define CHECKREPORTER_HPP_3031#include "j9.h"32#include "j9cfg.h"3334#include "Base.hpp"35#include "CheckError.hpp"36#include "CheckElement.hpp"3738/**39* Output reports.40* Accepts an GC_CheckError object and outputs the contents of the error report41* to the appropriate device.42* @ingroup GC_Check43*/44class GC_CheckReporter : public MM_Base45{46/*47* Data members48*/49private:5051protected:52UDATA _maxErrorsToReport;53J9PortLibrary *_portLibrary;5455public:56J9JavaVM *_javaVM;5758/*59* Function members60*/61private:62protected:63public:6465/**66* Release any required resources for the reporter.67*/68virtual void kill() = 0;6970/**71* Report an error.72*73* Accepts an error object and outputs error to the appropriate device.74* @param error The error to be reported75*/76virtual void report(GC_CheckError *error) = 0;7778/*79* Report information from an object header, class, or some other type80*/81virtual void reportGenericType(GC_CheckError *error, GC_CheckElement reference, const char *prefix);8283/**84* Report information from an object header.85*/86virtual void reportObjectHeader(GC_CheckError *error, J9Object *objectPtr, const char *prefix) = 0;8788/**89* Report information from a class90*/91virtual void reportClass(GC_CheckError *error, J9Class *clazz, const char *prefix) = 0;9293/**94* Report the fact that a fatal error has occurred.95*/96virtual void reportFatalError(GC_CheckError *error) = 0;9798/**99* Report the fact that an error has occurred while walking the heap.100*/101virtual void reportHeapWalkError(102GC_CheckError *error,103GC_CheckElement previousObjectPtr1,104GC_CheckElement previousObjectPtr2,105GC_CheckElement previousObjectPtr3) = 0;106107void setMaxErrorsToReport(UDATA count) { _maxErrorsToReport = count; }108bool shouldReport(GC_CheckError *error) {109return (_maxErrorsToReport == 0) || (error->_errorNumber <= _maxErrorsToReport);110}111112/**113* Create a new CheckReporter object.114*/115GC_CheckReporter(J9JavaVM *javaVM)116: MM_Base()117, _maxErrorsToReport(0)118, _portLibrary(javaVM->portLibrary)119, _javaVM(javaVM)120{}121};122123#endif /* CHECKREPORTER_HPP_ */124125126