fprime/Svc/FatalHandler/FatalHandlerComponentLinuxImpl.cpp
M Starch 7159e7e347
Implements #2723: Adds Os::Console to replace Os::Log (#2831)
* Initial logging refactor - WIP

* Removing LogAssert as it is not used

* Working on Fw::Logger rewrite

* Initial Os::Console refactor

* Fixing Fw::Logger unit tests

* Fixing up UT build

* Adding Os::Stub::Console implementation

* Added interface UTs

* Adding posix console tests

* Fixing Linux errors

* Spelling

* Initial review requests

* Fixing RPI build issues

* Fixing codeql errors

* Fixing code QL

* Validating 'message' parameter
2024-08-15 18:53:36 -07:00

38 lines
1.3 KiB
C++

// ======================================================================
// \title FatalHandlerImpl.cpp
// \author tcanham
// \brief cpp file for FatalHandler component implementation class
//
// \copyright
// Copyright 2009-2015, by the California Institute of Technology.
// ALL RIGHTS RESERVED. United States Government Sponsorship
// acknowledged.
//
// ======================================================================
#include <cstdlib>
#include <csignal>
#include <Fw/Logger/Logger.hpp>
#include <Svc/FatalHandler/FatalHandlerComponentImpl.hpp>
#include <Os/Task.hpp>
#include <FpConfig.hpp>
namespace Svc {
// ----------------------------------------------------------------------
// Handler implementations for user-defined typed input ports
// ----------------------------------------------------------------------
void FatalHandlerComponentImpl::FatalReceive_handler(
const NATIVE_INT_TYPE portNum,
FwEventIdType Id) {
// for **nix, delay then exit with error code
Fw::Logger::log("FATAL %d handled.\n",Id);
(void)Os::Task::delay(Fw::Time(1, 0));
Fw::Logger::log("Exiting with abort signal and core dump file.\n");
(void)raise( SIGABRT );
exit(1);
}
} // end namespace Svc