112852Sgabeblack@google.com/* 212852Sgabeblack@google.com * Copyright 2018 Google, Inc. 312852Sgabeblack@google.com * 412852Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 512852Sgabeblack@google.com * modification, are permitted provided that the following conditions are 612852Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 712852Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 812852Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 912852Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1012852Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1112852Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1212852Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1312852Sgabeblack@google.com * this software without specific prior written permission. 1412852Sgabeblack@google.com * 1512852Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1612852Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1712852Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1812852Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1912852Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2012852Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2112852Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2212852Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2312852Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2412852Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2512852Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2612852Sgabeblack@google.com * 2712852Sgabeblack@google.com * Authors: Gabe Black 2812852Sgabeblack@google.com */ 2912852Sgabeblack@google.com 3012997Sgabeblack@google.com#include <fstream> 3112997Sgabeblack@google.com#include <map> 3212997Sgabeblack@google.com#include <sstream> 3312997Sgabeblack@google.com#include <string> 3412997Sgabeblack@google.com 3513335Sgabeblack@google.com#include "base/cprintf.hh" 3612997Sgabeblack@google.com#include "systemc/core/process.hh" 3712997Sgabeblack@google.com#include "systemc/core/scheduler.hh" 3812997Sgabeblack@google.com#include "systemc/ext/core/sc_main.hh" 3913324Sgabeblack@google.com#include "systemc/ext/utils/messages.hh" 4012852Sgabeblack@google.com#include "systemc/ext/utils/sc_report_handler.hh" 4113312Sgabeblack@google.com#include "systemc/utils/report.hh" 4212852Sgabeblack@google.com 4312852Sgabeblack@google.comnamespace sc_core 4412852Sgabeblack@google.com{ 4512852Sgabeblack@google.com 4612997Sgabeblack@google.comnamespace 4712997Sgabeblack@google.com{ 4812997Sgabeblack@google.com 4912997Sgabeblack@google.comstd::unique_ptr<std::string> logFileName; 5012997Sgabeblack@google.comstd::unique_ptr<std::ofstream> logFile; 5112997Sgabeblack@google.com 5212997Sgabeblack@google.com} // anonymous namespace 5312997Sgabeblack@google.com 5412852Sgabeblack@google.comvoid 5512997Sgabeblack@google.comsc_report_handler::report(sc_severity severity, const char *msg_type, 5612997Sgabeblack@google.com const char *msg, const char *file, int line) 5712852Sgabeblack@google.com{ 5812997Sgabeblack@google.com report(severity, msg_type, msg, SC_MEDIUM, file, line); 5912852Sgabeblack@google.com} 6012852Sgabeblack@google.com 6112852Sgabeblack@google.comvoid 6212997Sgabeblack@google.comsc_report_handler::report(sc_severity severity, const char *msg_type, 6312997Sgabeblack@google.com const char *msg, int verbosity, const char *file, 6412997Sgabeblack@google.com int line) 6512852Sgabeblack@google.com{ 6613324Sgabeblack@google.com if (!msg_type) 6713324Sgabeblack@google.com msg_type = SC_ID_UNKNOWN_ERROR_; 6813324Sgabeblack@google.com 6913312Sgabeblack@google.com if (severity == SC_INFO && verbosity > sc_gem5::reportVerbosityLevel) 7012997Sgabeblack@google.com return; 7112997Sgabeblack@google.com 7213312Sgabeblack@google.com sc_gem5::ReportSevInfo &sevInfo = sc_gem5::reportSevInfos[severity]; 7313401Sgabeblack@google.com sc_gem5::ReportMsgInfo &msgInfo = sc_gem5::reportMsgInfoMap()[msg_type]; 7412997Sgabeblack@google.com 7512997Sgabeblack@google.com sevInfo.count++; 7612997Sgabeblack@google.com msgInfo.count++; 7713312Sgabeblack@google.com msgInfo.sevCounts[severity]++; 7812997Sgabeblack@google.com 7912997Sgabeblack@google.com sc_actions actions = SC_UNSPECIFIED; 8013312Sgabeblack@google.com if (msgInfo.sevActions[severity] != SC_UNSPECIFIED) 8113312Sgabeblack@google.com actions = msgInfo.sevActions[severity]; 8212997Sgabeblack@google.com else if (msgInfo.actions != SC_UNSPECIFIED) 8312997Sgabeblack@google.com actions = msgInfo.actions; 8412997Sgabeblack@google.com else if (sevInfo.actions != SC_UNSPECIFIED) 8512997Sgabeblack@google.com actions = sevInfo.actions; 8612997Sgabeblack@google.com 8713312Sgabeblack@google.com actions &= ~sc_gem5::reportSuppressedActions; 8813312Sgabeblack@google.com actions |= sc_gem5::reportForcedActions; 8912997Sgabeblack@google.com 9013312Sgabeblack@google.com msgInfo.checkLimits(severity, actions); 9113312Sgabeblack@google.com sevInfo.checkLimit(actions); 9212997Sgabeblack@google.com 9312997Sgabeblack@google.com ::sc_gem5::Process *current = ::sc_gem5::scheduler.current(); 9412997Sgabeblack@google.com sc_report report(severity, msg_type, msg, verbosity, file, line, 9512997Sgabeblack@google.com sc_time::from_value(::sc_gem5::scheduler.getCurTick()), 9613313Sgabeblack@google.com current ? current->name() : nullptr, msgInfo.id); 9712997Sgabeblack@google.com 9812997Sgabeblack@google.com if (actions & SC_CACHE_REPORT) { 9912997Sgabeblack@google.com if (current) { 10012997Sgabeblack@google.com current->lastReport(&report); 10112997Sgabeblack@google.com } else { 10213312Sgabeblack@google.com sc_gem5::globalReportCache = 10312997Sgabeblack@google.com std::unique_ptr<sc_report>(new sc_report(report)); 10412997Sgabeblack@google.com } 10512997Sgabeblack@google.com } 10612997Sgabeblack@google.com 10713312Sgabeblack@google.com sc_gem5::reportHandlerProc(report, actions); 10812852Sgabeblack@google.com} 10912852Sgabeblack@google.com 11012902Sgabeblack@google.comvoid 11113313Sgabeblack@google.comsc_report_handler::report(sc_severity severity, int id, const char *msg, 11212902Sgabeblack@google.com const char *file, int line) 11312902Sgabeblack@google.com{ 11413401Sgabeblack@google.com std::string &msg_type = sc_gem5::reportIdToMsgMap()[id]; 11513313Sgabeblack@google.com 11613313Sgabeblack@google.com if (sc_gem5::reportWarningsAsErrors && severity == SC_WARNING) 11713313Sgabeblack@google.com severity = SC_ERROR; 11813313Sgabeblack@google.com 11913313Sgabeblack@google.com report(severity, msg_type.c_str(), msg, file, line); 12012902Sgabeblack@google.com} 12112902Sgabeblack@google.com 12212852Sgabeblack@google.comsc_actions 12312997Sgabeblack@google.comsc_report_handler::set_actions(sc_severity severity, sc_actions actions) 12412852Sgabeblack@google.com{ 12513312Sgabeblack@google.com sc_gem5::ReportSevInfo &info = sc_gem5::reportSevInfos[severity]; 12612997Sgabeblack@google.com sc_actions previous = info.actions; 12712997Sgabeblack@google.com info.actions = actions; 12812997Sgabeblack@google.com return previous; 12912852Sgabeblack@google.com} 13012852Sgabeblack@google.com 13112852Sgabeblack@google.comsc_actions 13212997Sgabeblack@google.comsc_report_handler::set_actions(const char *msg_type, sc_actions actions) 13312852Sgabeblack@google.com{ 13413324Sgabeblack@google.com if (!msg_type) 13513324Sgabeblack@google.com msg_type = SC_ID_UNKNOWN_ERROR_; 13613324Sgabeblack@google.com 13713401Sgabeblack@google.com sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap()[msg_type]; 13812997Sgabeblack@google.com sc_actions previous = info.actions; 13912997Sgabeblack@google.com info.actions = actions; 14012997Sgabeblack@google.com return previous; 14112852Sgabeblack@google.com} 14212852Sgabeblack@google.com 14312852Sgabeblack@google.comsc_actions 14412997Sgabeblack@google.comsc_report_handler::set_actions( 14512997Sgabeblack@google.com const char *msg_type, sc_severity severity, sc_actions actions) 14612852Sgabeblack@google.com{ 14713324Sgabeblack@google.com if (!msg_type) 14813324Sgabeblack@google.com msg_type = SC_ID_UNKNOWN_ERROR_; 14913324Sgabeblack@google.com 15013401Sgabeblack@google.com sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap()[msg_type]; 15113312Sgabeblack@google.com sc_actions previous = info.sevActions[severity]; 15213312Sgabeblack@google.com info.sevActions[severity] = actions; 15312997Sgabeblack@google.com return previous; 15412852Sgabeblack@google.com} 15512852Sgabeblack@google.com 15612852Sgabeblack@google.comint 15712997Sgabeblack@google.comsc_report_handler::stop_after(sc_severity severity, int limit) 15812852Sgabeblack@google.com{ 15913312Sgabeblack@google.com sc_gem5::ReportSevInfo &info = sc_gem5::reportSevInfos[severity]; 16012997Sgabeblack@google.com int previous = info.limit; 16112997Sgabeblack@google.com info.limit = limit; 16212997Sgabeblack@google.com return previous; 16312852Sgabeblack@google.com} 16412852Sgabeblack@google.com 16512852Sgabeblack@google.comint 16612852Sgabeblack@google.comsc_report_handler::stop_after(const char *msg_type, int limit) 16712852Sgabeblack@google.com{ 16813324Sgabeblack@google.com if (!msg_type) 16913324Sgabeblack@google.com msg_type = SC_ID_UNKNOWN_ERROR_; 17013324Sgabeblack@google.com 17113401Sgabeblack@google.com sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap()[msg_type]; 17212997Sgabeblack@google.com int previous = info.limit; 17312997Sgabeblack@google.com info.limit = limit; 17412997Sgabeblack@google.com return previous; 17512852Sgabeblack@google.com} 17612852Sgabeblack@google.com 17712852Sgabeblack@google.comint 17812997Sgabeblack@google.comsc_report_handler::stop_after( 17912997Sgabeblack@google.com const char *msg_type, sc_severity severity, int limit) 18012852Sgabeblack@google.com{ 18113324Sgabeblack@google.com if (!msg_type) 18213324Sgabeblack@google.com msg_type = SC_ID_UNKNOWN_ERROR_; 18313324Sgabeblack@google.com 18413401Sgabeblack@google.com sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap()[msg_type]; 18513312Sgabeblack@google.com int previous = info.sevLimits[severity]; 18613312Sgabeblack@google.com info.sevLimits[severity] = limit; 18712997Sgabeblack@google.com return previous; 18812852Sgabeblack@google.com} 18912852Sgabeblack@google.com 19012852Sgabeblack@google.comint 19112997Sgabeblack@google.comsc_report_handler::get_count(sc_severity severity) 19212852Sgabeblack@google.com{ 19313312Sgabeblack@google.com return sc_gem5::reportSevInfos[severity].count; 19412852Sgabeblack@google.com} 19512852Sgabeblack@google.com 19612852Sgabeblack@google.comint 19712852Sgabeblack@google.comsc_report_handler::get_count(const char *msg_type) 19812852Sgabeblack@google.com{ 19913324Sgabeblack@google.com if (!msg_type) 20013324Sgabeblack@google.com msg_type = SC_ID_UNKNOWN_ERROR_; 20113324Sgabeblack@google.com 20213401Sgabeblack@google.com return sc_gem5::reportMsgInfoMap()[msg_type].count; 20312852Sgabeblack@google.com} 20412852Sgabeblack@google.com 20512852Sgabeblack@google.comint 20612997Sgabeblack@google.comsc_report_handler::get_count(const char *msg_type, sc_severity severity) 20712852Sgabeblack@google.com{ 20813324Sgabeblack@google.com if (!msg_type) 20913324Sgabeblack@google.com msg_type = SC_ID_UNKNOWN_ERROR_; 21013324Sgabeblack@google.com 21113401Sgabeblack@google.com return sc_gem5::reportMsgInfoMap()[msg_type].sevCounts[severity]; 21212852Sgabeblack@google.com} 21312852Sgabeblack@google.com 21412852Sgabeblack@google.comint 21512997Sgabeblack@google.comsc_report_handler::set_verbosity_level(int vl) 21612852Sgabeblack@google.com{ 21713312Sgabeblack@google.com int previous = sc_gem5::reportVerbosityLevel; 21813312Sgabeblack@google.com sc_gem5::reportVerbosityLevel = vl; 21912997Sgabeblack@google.com return previous; 22012852Sgabeblack@google.com} 22112852Sgabeblack@google.com 22212852Sgabeblack@google.comint 22312852Sgabeblack@google.comsc_report_handler::get_verbosity_level() 22412852Sgabeblack@google.com{ 22513312Sgabeblack@google.com return sc_gem5::reportVerbosityLevel; 22612852Sgabeblack@google.com} 22712852Sgabeblack@google.com 22812852Sgabeblack@google.com 22912852Sgabeblack@google.comsc_actions 23012997Sgabeblack@google.comsc_report_handler::suppress(sc_actions actions) 23112852Sgabeblack@google.com{ 23213312Sgabeblack@google.com sc_actions previous = sc_gem5::reportSuppressedActions; 23313312Sgabeblack@google.com sc_gem5::reportSuppressedActions = actions; 23412997Sgabeblack@google.com return previous; 23512852Sgabeblack@google.com} 23612852Sgabeblack@google.com 23712852Sgabeblack@google.comsc_actions 23812852Sgabeblack@google.comsc_report_handler::suppress() 23912852Sgabeblack@google.com{ 24012997Sgabeblack@google.com return suppress(SC_UNSPECIFIED); 24112852Sgabeblack@google.com} 24212852Sgabeblack@google.com 24312852Sgabeblack@google.comsc_actions 24412997Sgabeblack@google.comsc_report_handler::force(sc_actions actions) 24512852Sgabeblack@google.com{ 24613312Sgabeblack@google.com sc_actions previous = sc_gem5::reportForcedActions; 24713312Sgabeblack@google.com sc_gem5::reportForcedActions = actions; 24812997Sgabeblack@google.com return previous; 24912852Sgabeblack@google.com} 25012852Sgabeblack@google.com 25112852Sgabeblack@google.comsc_actions 25212852Sgabeblack@google.comsc_report_handler::force() 25312852Sgabeblack@google.com{ 25412997Sgabeblack@google.com return force(SC_UNSPECIFIED); 25512852Sgabeblack@google.com} 25612852Sgabeblack@google.com 25712852Sgabeblack@google.com 25812911Sgabeblack@google.comsc_actions 25912997Sgabeblack@google.comsc_report_handler::set_catch_actions(sc_actions actions) 26012911Sgabeblack@google.com{ 26113312Sgabeblack@google.com sc_actions previous = sc_gem5::reportCatchActions; 26213312Sgabeblack@google.com sc_gem5::reportCatchActions = actions; 26312997Sgabeblack@google.com return previous; 26412911Sgabeblack@google.com} 26512911Sgabeblack@google.com 26612911Sgabeblack@google.comsc_actions 26712911Sgabeblack@google.comsc_report_handler::get_catch_actions() 26812911Sgabeblack@google.com{ 26913312Sgabeblack@google.com return sc_gem5::reportCatchActions; 27012911Sgabeblack@google.com} 27112911Sgabeblack@google.com 27212911Sgabeblack@google.com 27312852Sgabeblack@google.comvoid 27412997Sgabeblack@google.comsc_report_handler::set_handler(sc_report_handler_proc proc) 27512852Sgabeblack@google.com{ 27613312Sgabeblack@google.com sc_gem5::reportHandlerProc = proc; 27712852Sgabeblack@google.com} 27812852Sgabeblack@google.com 27912852Sgabeblack@google.comvoid 28012997Sgabeblack@google.comsc_report_handler::default_handler( 28112997Sgabeblack@google.com const sc_report &report, const sc_actions &actions) 28212852Sgabeblack@google.com{ 28312997Sgabeblack@google.com if (actions & SC_DISPLAY) 28412997Sgabeblack@google.com cprintf("\n%s\n", sc_report_compose_message(report)); 28512997Sgabeblack@google.com 28612997Sgabeblack@google.com if ((actions & SC_LOG) && logFile) { 28712997Sgabeblack@google.com ccprintf(*logFile, "%s: %s\n", report.get_time().to_string(), 28812997Sgabeblack@google.com sc_report_compose_message(report)); 28912997Sgabeblack@google.com } 29012997Sgabeblack@google.com if (actions & SC_STOP) { 29112997Sgabeblack@google.com sc_stop_here(report.get_msg_type(), report.get_severity()); 29212997Sgabeblack@google.com sc_stop(); 29312997Sgabeblack@google.com } 29412997Sgabeblack@google.com if (actions & SC_INTERRUPT) 29512997Sgabeblack@google.com sc_interrupt_here(report.get_msg_type(), report.get_severity()); 29612997Sgabeblack@google.com if (actions & SC_ABORT) 29712997Sgabeblack@google.com sc_abort(); 29812997Sgabeblack@google.com if (actions & SC_THROW) { 29912997Sgabeblack@google.com ::sc_gem5::Process *current = ::sc_gem5::scheduler.current(); 30012997Sgabeblack@google.com if (current) 30112997Sgabeblack@google.com current->isUnwinding(false); 30212997Sgabeblack@google.com throw report; 30312997Sgabeblack@google.com } 30412852Sgabeblack@google.com} 30512852Sgabeblack@google.com 30612852Sgabeblack@google.comsc_actions 30712852Sgabeblack@google.comsc_report_handler::get_new_action_id() 30812852Sgabeblack@google.com{ 30913312Sgabeblack@google.com static sc_actions maxAction = SC_ABORT; 31012997Sgabeblack@google.com maxAction = maxAction << 1; 31112997Sgabeblack@google.com return maxAction; 31212852Sgabeblack@google.com} 31312852Sgabeblack@google.com 31412852Sgabeblack@google.comsc_report * 31512852Sgabeblack@google.comsc_report_handler::get_cached_report() 31612852Sgabeblack@google.com{ 31712997Sgabeblack@google.com ::sc_gem5::Process *current = ::sc_gem5::scheduler.current(); 31812997Sgabeblack@google.com if (current) 31912997Sgabeblack@google.com return current->lastReport(); 32013312Sgabeblack@google.com return ::sc_gem5::globalReportCache.get(); 32112852Sgabeblack@google.com} 32212852Sgabeblack@google.com 32312852Sgabeblack@google.comvoid 32412852Sgabeblack@google.comsc_report_handler::clear_cached_report() 32512852Sgabeblack@google.com{ 32612997Sgabeblack@google.com ::sc_gem5::Process *current = ::sc_gem5::scheduler.current(); 32712997Sgabeblack@google.com if (current) { 32812997Sgabeblack@google.com current->lastReport(nullptr); 32912997Sgabeblack@google.com } else { 33013312Sgabeblack@google.com ::sc_gem5::globalReportCache = nullptr; 33112997Sgabeblack@google.com } 33212852Sgabeblack@google.com} 33312852Sgabeblack@google.com 33412852Sgabeblack@google.combool 33512997Sgabeblack@google.comsc_report_handler::set_log_file_name(const char *new_name) 33612852Sgabeblack@google.com{ 33712997Sgabeblack@google.com if (!new_name) { 33812997Sgabeblack@google.com logFile = nullptr; 33912997Sgabeblack@google.com logFileName = nullptr; 34012997Sgabeblack@google.com return false; 34112997Sgabeblack@google.com } else { 34212997Sgabeblack@google.com if (logFileName) 34312997Sgabeblack@google.com return false; 34412997Sgabeblack@google.com logFileName = std::unique_ptr<std::string>(new std::string(new_name)); 34512997Sgabeblack@google.com logFile = std::unique_ptr<std::ofstream>(new std::ofstream(new_name)); 34612997Sgabeblack@google.com return true; 34712997Sgabeblack@google.com } 34812852Sgabeblack@google.com} 34912852Sgabeblack@google.com 35012852Sgabeblack@google.comconst char * 35112852Sgabeblack@google.comsc_report_handler::get_log_file_name() 35212852Sgabeblack@google.com{ 35312997Sgabeblack@google.com if (!logFileName) 35412997Sgabeblack@google.com return nullptr; 35512997Sgabeblack@google.com else 35612997Sgabeblack@google.com return logFileName->c_str(); 35712852Sgabeblack@google.com} 35812852Sgabeblack@google.com 35912852Sgabeblack@google.comvoid 36012852Sgabeblack@google.comsc_interrupt_here(const char *msg_type, sc_severity) 36112852Sgabeblack@google.com{ 36212997Sgabeblack@google.com // Purposefully empty, for setting breakpoints supposedly. 36312852Sgabeblack@google.com} 36412852Sgabeblack@google.com 36512852Sgabeblack@google.comvoid 36612852Sgabeblack@google.comsc_stop_here(const char *msg_type, sc_severity) 36712852Sgabeblack@google.com{ 36812997Sgabeblack@google.com // Purposefully empty, for setting breakpoints supposedly. 36912852Sgabeblack@google.com} 37012852Sgabeblack@google.com 37112921Sgabeblack@google.comconst std::string 37212997Sgabeblack@google.comsc_report_compose_message(const sc_report &report) 37312921Sgabeblack@google.com{ 37412997Sgabeblack@google.com std::ostringstream str; 37512997Sgabeblack@google.com 37613312Sgabeblack@google.com const char *sevName = sc_gem5::reportSeverityNames[report.get_severity()]; 37712997Sgabeblack@google.com int id = report.get_id(); 37812997Sgabeblack@google.com 37912997Sgabeblack@google.com str << sevName << ": "; 38012997Sgabeblack@google.com if (id >= 0) { 38112997Sgabeblack@google.com ccprintf(str, "(%c%d) ", sevName[0], id); 38212997Sgabeblack@google.com } 38312997Sgabeblack@google.com str << report.get_msg_type(); 38412997Sgabeblack@google.com 38512997Sgabeblack@google.com const char *msg = report.get_msg(); 38613080Sgabeblack@google.com if (msg && msg[0]) 38712997Sgabeblack@google.com str << ": " << msg; 38812997Sgabeblack@google.com 38912997Sgabeblack@google.com if (report.get_severity() > SC_INFO) { 39012997Sgabeblack@google.com ccprintf(str, "\nIn file: %s:%d", report.get_file_name(), 39112997Sgabeblack@google.com report.get_line_number()); 39212997Sgabeblack@google.com 39312997Sgabeblack@google.com ::sc_gem5::Process *current = ::sc_gem5::scheduler.current(); 39412997Sgabeblack@google.com const char *name = report.get_process_name(); 39512997Sgabeblack@google.com if (current && sc_is_running() && name) { 39612997Sgabeblack@google.com ccprintf(str, "\nIn process: %s @ %s", name, 39712997Sgabeblack@google.com report.get_time().to_string()); 39812997Sgabeblack@google.com } 39912997Sgabeblack@google.com } 40012997Sgabeblack@google.com 40112997Sgabeblack@google.com return str.str(); 40212921Sgabeblack@google.com} 40312921Sgabeblack@google.com 40412921Sgabeblack@google.combool 40512921Sgabeblack@google.comsc_report_close_default_log() 40612921Sgabeblack@google.com{ 40712997Sgabeblack@google.com if (logFile) { 40812997Sgabeblack@google.com logFile = nullptr; 40912997Sgabeblack@google.com logFileName = nullptr; 41012997Sgabeblack@google.com return false; 41112997Sgabeblack@google.com } 41212997Sgabeblack@google.com return true; 41312921Sgabeblack@google.com} 41412921Sgabeblack@google.com 41512852Sgabeblack@google.com} // namespace sc_core 416