From 8f57db805f7fbe463395258b44b1fb72b249b028 Mon Sep 17 00:00:00 2001 From: Marcel Loose <loose@astron.nl> Date: Thu, 5 Jul 2012 12:48:19 +0000 Subject: [PATCH] Task #2050: Added our own terminate handler and removed catch clauses for exceptions other than LOFAR::Exception. --- .../BBSControl/src/bbs-controller.cc | 5 ----- CEP/Calibration/BBSControl/src/bbs-reducer.cc | 5 ----- .../BBSControl/src/bbs-shared-estimator.cc | 5 ----- CEP/Calibration/BBSTools/src/patchCasaFreq.cc | 9 ++++++--- CEP/Imager/LofarFT/src/awimager.cc | 19 ++++++++++--------- CEP/Imager/LofarFT/src/makefftwisdom2d.cc | 4 ++++ CEP/ParmDB/src/parmdbm.cc | 8 ++++---- CEP/ParmDB/src/parmexportcal.cc | 4 ++-- LCS/AMC/AMCImpl/src/WGS84toITRF.cc | 4 ++-- LCS/Common/include/Common/Exceptions.h | 6 +++--- MAC/APL/Appl_Controller/ACcli.cc | 3 +++ MAC/APL/Appl_Controller/ACuserMenu.cc | 4 ++++ .../src/OnlineControl/OnlineControlMain.cc | 4 ++++ .../src/PythonControl/PythonControlMain.cc | 4 ++++ .../src/CTStartDaemon/CTStartDaemonMain.cc | 4 ++++ .../src/ServiceBroker/ServiceBrokerMain.cc | 4 ++++ .../src/KeyValueLogger/KeyValueLoggerMain.cc | 4 ++++ .../src/LogProcessor/LogProcessorMain.cc | 4 ++++ .../src/SASGateway/SASGatewayMain.cc | 4 ++++ .../SoftwareMonitor/SoftwareMonitorMain.cc | 4 ++++ MAC/APL/Log_Client/src/LogClientMain.cc | 5 +++++ .../CRTriggerControl/TriggerControlMain.cc | 4 ++++ .../src/MACScheduler/MACSchedulerMain.cc | 4 ++++ .../ObservationControlMain.cc | 4 ++++ MAC/APL/PAC/Cal_Server/src/calinfo.cc | 4 ++++ .../PAC/ITRFBeamServer/src/BeamServerMain.cc | 4 ++++ MAC/APL/PAC/ITRFCalServer/src/calinfo.cc | 4 ++++ MAC/APL/RTDBCommon/src/setObjectState.cc | 4 ++++ .../src/BeamControl/BeamControlMain.cc | 5 ++++- .../CalibrationControlMain.cc | 5 ++++- .../src/ClockControl/ClockControlMain.cc | 4 ++++ MAC/APL/StationCU/src/ClockControl/clkctl.cc | 4 ++++ .../HardwareMonitor/HardwareMonitorMain.cc | 5 ++++- .../src/StationControl/StationControlMain.cc | 4 ++++ .../src/TBBControl/TBBControlMain.cc | 5 ++++- MAC/APL/TestCtlr/src/CodeLoggingTest.cc | 6 ++++++ MAC/APL/TestCtlr/src/ControllerMenuMain.cc | 5 +++++ MAC/APL/TestCtlr/src/TestControllerMain.cc | 5 +++++ RTCP/LofarStMan/src/fixlsmeta.cc | 3 +++ 39 files changed, 150 insertions(+), 42 deletions(-) diff --git a/CEP/Calibration/BBSControl/src/bbs-controller.cc b/CEP/Calibration/BBSControl/src/bbs-controller.cc index e645c69d679..06e5aa86cab 100644 --- a/CEP/Calibration/BBSControl/src/bbs-controller.cc +++ b/CEP/Calibration/BBSControl/src/bbs-controller.cc @@ -133,11 +133,6 @@ int main(int argc, char *argv[]) LOG_FATAL_STR(progName << " terminated due to an exception: " << ex); return 1; } - catch(...) - { - LOG_FATAL_STR(progName << " terminated due to an unknown exception."); - return 1; - } LOG_INFO_STR(progName << " terminated successfully."); return 0; diff --git a/CEP/Calibration/BBSControl/src/bbs-reducer.cc b/CEP/Calibration/BBSControl/src/bbs-reducer.cc index a38379cdda1..09b65500f66 100644 --- a/CEP/Calibration/BBSControl/src/bbs-reducer.cc +++ b/CEP/Calibration/BBSControl/src/bbs-reducer.cc @@ -157,11 +157,6 @@ int main(int argc, char *argv[]) LOG_FATAL_STR(progName << " terminated due to an exception: " << ex); return 1; } - catch(...) - { - LOG_FATAL_STR(progName << " terminated due to an unknown exception."); - return 1; - } LOG_INFO_STR(progName << " terminated successfully."); return 0; diff --git a/CEP/Calibration/BBSControl/src/bbs-shared-estimator.cc b/CEP/Calibration/BBSControl/src/bbs-shared-estimator.cc index 23ecf40d253..bb45bf4be43 100644 --- a/CEP/Calibration/BBSControl/src/bbs-shared-estimator.cc +++ b/CEP/Calibration/BBSControl/src/bbs-shared-estimator.cc @@ -115,11 +115,6 @@ int main(int argc, char *argv[]) LOG_FATAL_STR(progName << " terminated due to an exception: " << ex); return 1; } - catch(...) - { - LOG_FATAL_STR(progName << " terminated due to an unknown exception."); - return 1; - } LOG_INFO_STR(progName << " terminated successfully."); return 0; diff --git a/CEP/Calibration/BBSTools/src/patchCasaFreq.cc b/CEP/Calibration/BBSTools/src/patchCasaFreq.cc index 3df7fd07a6f..6cdb17803aa 100644 --- a/CEP/Calibration/BBSTools/src/patchCasaFreq.cc +++ b/CEP/Calibration/BBSTools/src/patchCasaFreq.cc @@ -8,6 +8,7 @@ #include <lofar_config.h> #include <Common/LofarLogger.h> // for ASSERT and ASSERTSTR? #include <Common/SystemUtil.h> // needed for basename +#include <Common/Exception.h> // STL/C++ includes #include <iostream> @@ -41,6 +42,8 @@ using namespace std; using namespace casa; using namespace LOFAR; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); double patchImageFreq(const string &imageName, double reffreq); void usage(const char *programname); @@ -53,7 +56,7 @@ int main(int argc, char **argv) if(argc < 3) // if not enough parameters given, display usage information { usage(argv[0]); - exit(0); + return 0; } else // Handle file arguments: MS image image (and options, e.g. -w 512) { @@ -66,7 +69,7 @@ int main(int argc, char **argv) originalfrequency << " Hz)" << endl; } - exit(0); + return 0; } @@ -112,4 +115,4 @@ double patchImageFreq(const string &imageName, double reffreq) void usage(const char *programname) { cout << "Usage: " << programname << "<imagename> <patchfrequency>" << endl; -} \ No newline at end of file +} diff --git a/CEP/Imager/LofarFT/src/awimager.cc b/CEP/Imager/LofarFT/src/awimager.cc index 2965be7e49e..28a106f40a9 100644 --- a/CEP/Imager/LofarFT/src/awimager.cc +++ b/CEP/Imager/LofarFT/src/awimager.cc @@ -27,6 +27,7 @@ //# Includes #include <lofar_config.h> +#include <LofarFT/Exceptions.h> #include <LofarFT/LofarImager.h> #include <LofarFT/Package__Version.h> #include <Common/InputParSet.h> @@ -63,7 +64,7 @@ IPosition handlePos (const IPosition& pos, const IPosition& def) return def; } if (pos.nelements() != 2) { - throw AipsError("Give 0 or 2 values in maskblc and masktrc"); + THROW(AWImagerException, "Give 0 or 2 values in maskblc and masktrc"); } IPosition npos(def); int n = npos.nelements(); @@ -90,7 +91,7 @@ Quantity readQuantity (const String& in) { Quantity res; if (!Quantity::read(res, in)) { - throw AipsError (in + " is an illegal quantity"); + THROW(AWImagerException, in << " is an illegal quantity"); } return res; } @@ -99,12 +100,12 @@ MDirection readDirection (const String& in) { Vector<String> vals = stringToVector(in); if (vals.size() > 3) { - throw AipsError ("MDirection value " + in + " is invalid;" + THROW(AWImagerException, "MDirection value " << in << " is invalid;" " up to 3 values can be given"); } MDirection::Types tp; if (! MDirection::getType (tp, vals[0])) { - throw AipsError(vals[0] + " is an invalid MDirection type"); + THROW(AWImagerException, vals[0] << " is an invalid MDirection type"); } Quantity v0(0, "deg"); Quantity v1(90, "deg"); // same default as in measures.g @@ -125,7 +126,7 @@ void readFilter (const String& filter, } Vector<String> strs = stringToVector(filter); if (strs.size() != 3) { - throw AipsError("Specify gaussian tapering filter as bmajor,bminor,bpa"); + THROW(AWImagerException, "Specify gaussian tapering filter as bmajor,bminor,bpa"); } if (! strs[0].empty()) { bmajor = readQuantity (strs[0]); @@ -154,7 +155,7 @@ Matrix<Bool> readMueller (const String& str, String stokes, Bool grid) if (s == "BAND1") { mat(0,3) = mat(1,4) = mat(3,0) = mat(4,1) = False; } else if (s != "BAND2") { - throw AipsError (str + " is an invalid Mueller specification"); + THROW(AWImagerException, str << " is an invalid Mueller specification"); } } if((stokes=="I")&&(grid)){ @@ -575,7 +576,7 @@ int main(int argc, char *argv[]) // Check and interpret input values. Quantity qcellsize = readQuantity (cellsize); if (msName.empty()) { - throw AipsError("An MS name must be given like ms=test.ms"); + THROW(AWImagerException, "An MS name must be given like ms=test.ms"); } imageType.downcase(); if (imageType == "data") { @@ -836,7 +837,7 @@ int main(int argc, char *argv[]) fitsName, 64, // memoryInMB preferVelocity)) { - throw AipsError(error); + THROW(AWImagerException, error); } } @@ -994,7 +995,7 @@ int main(int argc, char *argv[]) fitsName, 64, // memoryInMB preferVelocity)) { - throw AipsError(error); + THROW(AWImagerException, error); } } } diff --git a/CEP/Imager/LofarFT/src/makefftwisdom2d.cc b/CEP/Imager/LofarFT/src/makefftwisdom2d.cc index 9259136d5be..0b462eba241 100644 --- a/CEP/Imager/LofarFT/src/makefftwisdom2d.cc +++ b/CEP/Imager/LofarFT/src/makefftwisdom2d.cc @@ -23,6 +23,7 @@ #include <lofar_config.h> #include <LofarFT/FFTCMatrix.h> #include <Common/lofar_iostream.h> +#include <Common/Exception.h> #include <casa/OS/Path.h> #include <stdio.h> #include <errno.h> @@ -30,6 +31,9 @@ using namespace LOFAR; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + void showhelp() { cout << endl; diff --git a/CEP/ParmDB/src/parmdbm.cc b/CEP/ParmDB/src/parmdbm.cc index 7429d34e5c1..13e29cfb30b 100644 --- a/CEP/ParmDB/src/parmdbm.cc +++ b/CEP/ParmDB/src/parmdbm.cc @@ -956,8 +956,8 @@ void doIt (bool noPrompt, ostream& ostr) } } } - } catch (std::exception& x) { - cerr << "Exception: " << x.what() << endl; + } catch (Exception& ex) { + cerr << ex << endl; } } delete parmtab; @@ -978,8 +978,8 @@ int main (int argc, char *argv[]) } // Print an extra line to be sure the shell prompt is at a new line. cout << endl; - } catch (std::exception& x) { - cerr << "Caught exception: " << x.what() << endl; + } catch (Exception& ex) { + cerr << ex << endl; return 1; } diff --git a/CEP/ParmDB/src/parmexportcal.cc b/CEP/ParmDB/src/parmexportcal.cc index 3d44c8abed6..8d7e5761075 100644 --- a/CEP/ParmDB/src/parmexportcal.cc +++ b/CEP/ParmDB/src/parmexportcal.cc @@ -286,8 +286,8 @@ int main (int argc, char *argv[]) } // Do the export. doIt (nameIn, nameOut, append, skipLast, amplPerc, parmType); - } catch (std::exception& x) { - cerr << "Caught exception: " << x.what() << endl; + } catch (Exception& ex) { + cerr << ex << endl; return 1; } diff --git a/LCS/AMC/AMCImpl/src/WGS84toITRF.cc b/LCS/AMC/AMCImpl/src/WGS84toITRF.cc index a3c06f63742..134d5510ea2 100644 --- a/LCS/AMC/AMCImpl/src/WGS84toITRF.cc +++ b/LCS/AMC/AMCImpl/src/WGS84toITRF.cc @@ -78,8 +78,8 @@ int main() pos = conv(pos); showPos(pos); } - } catch (exception& e) { - cerr << "Exception: " << e.what() << endl; + } catch (Exception& e) { + cerr << e << endl; return 1; } return 0; diff --git a/LCS/Common/include/Common/Exceptions.h b/LCS/Common/include/Common/Exceptions.h index 4d3d36701a3..5ecdbc3dea7 100644 --- a/LCS/Common/include/Common/Exceptions.h +++ b/LCS/Common/include/Common/Exceptions.h @@ -1,4 +1,4 @@ -//# Exceptions.h: Declaration and definition of SINFONI specific exceptions. +//# Exceptions.h: Declaration and definition of common LOFAR exceptions. //# //# Copyright (C) 2002-2006 //# ASTRON (Netherlands Institute for Radio Astronomy) @@ -31,7 +31,7 @@ namespace LOFAR // // This exception will be thrown when an assertion fails. // - EXCEPTION_CLASS(AssertError,Exception); + EXCEPTION_CLASS(AssertError, Exception); // // This exception will be thrown when an I/O error occurs. @@ -55,6 +55,6 @@ namespace LOFAR // EXCEPTION_CLASS(APSException, Exception); -} // namespace ASTRON +} // namespace LOFAR #endif diff --git a/MAC/APL/Appl_Controller/ACcli.cc b/MAC/APL/Appl_Controller/ACcli.cc index 5c477c2b42a..dfcf191d466 100644 --- a/MAC/APL/Appl_Controller/ACcli.cc +++ b/MAC/APL/Appl_Controller/ACcli.cc @@ -22,12 +22,15 @@ #include <lofar_config.h> #include <Common/LofarLogger.h> +#include <Common/Exception.h> #include <ALC/ACSyncClient.h> using namespace LOFAR; using namespace LOFAR::ACC; using namespace LOFAR::ACC::ALC; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); void printUsage() { cout << "This program is a commandline client to ACC. It can be used from shell scripts." << endl; diff --git a/MAC/APL/Appl_Controller/ACuserMenu.cc b/MAC/APL/Appl_Controller/ACuserMenu.cc index 999b10c58fc..434111e61c1 100644 --- a/MAC/APL/Appl_Controller/ACuserMenu.cc +++ b/MAC/APL/Appl_Controller/ACuserMenu.cc @@ -25,6 +25,7 @@ #include <Common/LofarLogger.h> #include <Common/LofarLocators.h> +#include <Common/Exception.h> #include <Common/hexdump.h> #include <Common/StringUtil.h> #include <ALC/ACSyncClient.h> @@ -35,6 +36,9 @@ using namespace LOFAR; using namespace LOFAR::ACC; using namespace LOFAR::ACC::ALC; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + myACClientFunctions myACF; ApplControlClient* ACClient = 0; bool connected = false; diff --git a/MAC/APL/CEPCU/src/OnlineControl/OnlineControlMain.cc b/MAC/APL/CEPCU/src/OnlineControl/OnlineControlMain.cc index eeb52b7cdf1..df9cc9d495e 100644 --- a/MAC/APL/CEPCU/src/OnlineControl/OnlineControlMain.cc +++ b/MAC/APL/CEPCU/src/OnlineControl/OnlineControlMain.cc @@ -22,12 +22,16 @@ //# #include <lofar_config.h> #include <Common/LofarLogger.h> +#include <Common/Exception.h> #include "OnlineControl.h" using namespace LOFAR::GCF::TM; using namespace LOFAR::CEPCU; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { // args: cntlrname diff --git a/MAC/APL/CEPCU/src/PythonControl/PythonControlMain.cc b/MAC/APL/CEPCU/src/PythonControl/PythonControlMain.cc index 40f8883263e..16c67c5d9ec 100644 --- a/MAC/APL/CEPCU/src/PythonControl/PythonControlMain.cc +++ b/MAC/APL/CEPCU/src/PythonControl/PythonControlMain.cc @@ -22,12 +22,16 @@ //# #include <lofar_config.h> #include <Common/LofarLogger.h> +#include <Common/Exception.h> #include "PythonControl.h" using namespace LOFAR::GCF::TM; using namespace LOFAR::CEPCU; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { // args: cntlrname diff --git a/MAC/APL/CUDaemons/src/CTStartDaemon/CTStartDaemonMain.cc b/MAC/APL/CUDaemons/src/CTStartDaemon/CTStartDaemonMain.cc index e6f39a6ecdb..d78c0e9c478 100644 --- a/MAC/APL/CUDaemons/src/CTStartDaemon/CTStartDaemonMain.cc +++ b/MAC/APL/CUDaemons/src/CTStartDaemon/CTStartDaemonMain.cc @@ -21,12 +21,16 @@ //# $Id$ #include <lofar_config.h> #include <Common/LofarLogger.h> +#include <Common/Exception.h> #include <signal.h> #include "CTStartDaemon.h" using namespace LOFAR; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { // signal (SIGCHLD, SIG_IGN); diff --git a/MAC/APL/CUDaemons/src/ServiceBroker/ServiceBrokerMain.cc b/MAC/APL/CUDaemons/src/ServiceBroker/ServiceBrokerMain.cc index ad70a6ec896..cc23478288b 100644 --- a/MAC/APL/CUDaemons/src/ServiceBroker/ServiceBrokerMain.cc +++ b/MAC/APL/CUDaemons/src/ServiceBroker/ServiceBrokerMain.cc @@ -22,6 +22,7 @@ #include <lofar_config.h> #include <Common/LofarLogger.h> +#include <Common/Exception.h> #include <ServiceBroker.h> #include <GCF/TM/GCF_Control.h> @@ -30,6 +31,9 @@ using namespace LOFAR; using namespace LOFAR::GCF::TM; using namespace LOFAR::CUDaemons; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char *argv[]) { GCFScheduler::instance()->init(argc, argv, "ServiceBroker"); diff --git a/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLoggerMain.cc b/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLoggerMain.cc index d6bbc92522e..8bc5fdcbe7c 100644 --- a/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLoggerMain.cc +++ b/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLoggerMain.cc @@ -23,11 +23,15 @@ #include <lofar_config.h> #include <GCF/TM/GCF_Control.h> +#include <Common/Exception.h> #include "KeyValueLogger.h" using namespace LOFAR::GCF::TM; using namespace LOFAR::GCF::RTDBDaemons; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char *argv[]) { GCFScheduler::instance()->init(argc, argv, "KeyValueLogger"); diff --git a/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessorMain.cc b/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessorMain.cc index a8bb97daa58..7c9e2a7dfb1 100644 --- a/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessorMain.cc +++ b/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessorMain.cc @@ -23,11 +23,15 @@ #include <lofar_config.h> #include <GCF/TM/GCF_Control.h> +#include <Common/Exception.h> #include "LogProcessor.h" using namespace LOFAR::GCF::TM; using namespace LOFAR::GCF::RTDBDaemons; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char *argv[]) { GCFScheduler::instance()->init(argc, argv, "LogProcessor"); diff --git a/MAC/APL/CURTDBDaemons/src/SASGateway/SASGatewayMain.cc b/MAC/APL/CURTDBDaemons/src/SASGateway/SASGatewayMain.cc index 34035d6f653..57bf6d58a8c 100644 --- a/MAC/APL/CURTDBDaemons/src/SASGateway/SASGatewayMain.cc +++ b/MAC/APL/CURTDBDaemons/src/SASGateway/SASGatewayMain.cc @@ -23,11 +23,15 @@ #include <lofar_config.h> #include <GCF/TM/GCF_Control.h> +#include <Common/Exception.h> #include "SASGateway.h" using namespace LOFAR::GCF::TM; using namespace LOFAR::GCF::RTDBDaemons; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char *argv[]) { GCFScheduler::instance()->init(argc, argv, "SASGateway"); diff --git a/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitorMain.cc b/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitorMain.cc index ff5e5c53dda..a1c9969cd39 100644 --- a/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitorMain.cc +++ b/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitorMain.cc @@ -24,6 +24,7 @@ #include <Common/LofarLogger.h> #include <Common/Version.h> #include <Common/ParameterSet.h> +#include <Common/Exception.h> #include <GCF/RTDB/DP_Protocol.ph> #include "SoftwareMonitor.h" @@ -34,6 +35,9 @@ using namespace LOFAR::GCF; using namespace LOFAR::GCF::TM; using namespace LOFAR::RTDBDaemons; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { // args: cntlrname, parentHost, parentService diff --git a/MAC/APL/Log_Client/src/LogClientMain.cc b/MAC/APL/Log_Client/src/LogClientMain.cc index 277bab835f4..a05d699b499 100644 --- a/MAC/APL/Log_Client/src/LogClientMain.cc +++ b/MAC/APL/Log_Client/src/LogClientMain.cc @@ -23,11 +23,16 @@ #include <lofar_config.h> #include <GCF/TM/GCF_Control.h> +#include <Common/Exception.h> #include "LogClient.h" +using namespace LOFAR; using namespace LOFAR::GCF::TM; using namespace LOFAR::Log_Client; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char *argv[]) { GCFScheduler::instance()->init(argc, argv, "LogClient"); diff --git a/MAC/APL/MainCU/src/CRTriggerControl/TriggerControlMain.cc b/MAC/APL/MainCU/src/CRTriggerControl/TriggerControlMain.cc index 41c37901e7c..1158c2e0eb1 100644 --- a/MAC/APL/MainCU/src/CRTriggerControl/TriggerControlMain.cc +++ b/MAC/APL/MainCU/src/CRTriggerControl/TriggerControlMain.cc @@ -22,12 +22,16 @@ //# #include <lofar_config.h> #include <Common/LofarLogger.h> +#include <Common/Exception.h> #include "TriggerControl.h" using namespace LOFAR::GCF::TM; using namespace LOFAR::MainCU; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { diff --git a/MAC/APL/MainCU/src/MACScheduler/MACSchedulerMain.cc b/MAC/APL/MainCU/src/MACScheduler/MACSchedulerMain.cc index 0c166979748..5c481059bab 100644 --- a/MAC/APL/MainCU/src/MACScheduler/MACSchedulerMain.cc +++ b/MAC/APL/MainCU/src/MACScheduler/MACSchedulerMain.cc @@ -22,6 +22,7 @@ //# #include <lofar_config.h> #include <Common/LofarLogger.h> +#include <Common/Exception.h> #include "MACScheduler.h" @@ -29,6 +30,9 @@ using namespace LOFAR::GCF::TM; using namespace LOFAR::MainCU; using namespace LOFAR::APLCommon; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { GCFScheduler::instance()->init(argc, argv, "MACScheduler"); diff --git a/MAC/APL/MainCU/src/ObservationControl/ObservationControlMain.cc b/MAC/APL/MainCU/src/ObservationControl/ObservationControlMain.cc index 367967ec07b..9191d0b3f1c 100644 --- a/MAC/APL/MainCU/src/ObservationControl/ObservationControlMain.cc +++ b/MAC/APL/MainCU/src/ObservationControl/ObservationControlMain.cc @@ -22,6 +22,7 @@ //# #include <lofar_config.h> #include <Common/LofarLogger.h> +#include <Common/Exception.h> #include "ObservationControl.h" @@ -29,6 +30,9 @@ using namespace LOFAR::GCF::TM; using namespace LOFAR::MainCU; using namespace LOFAR::APLCommon; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { // args: cntlrname, parentHost, parentService diff --git a/MAC/APL/PAC/Cal_Server/src/calinfo.cc b/MAC/APL/PAC/Cal_Server/src/calinfo.cc index 6e651c4f8d4..0f01a7cdd55 100644 --- a/MAC/APL/PAC/Cal_Server/src/calinfo.cc +++ b/MAC/APL/PAC/Cal_Server/src/calinfo.cc @@ -26,6 +26,7 @@ //# Includes #include <Common/LofarLogger.h> #include <Common/StringUtil.h> +#include <Common/Exception.h> #include <APL/CAL_Protocol/CAL_Protocol.ph> #include <MACIO/MACServiceInfo.h> #include "calinfo.h" @@ -136,6 +137,9 @@ using namespace LOFAR::GCF; using namespace LOFAR::GCF::TM; using namespace LOFAR::CAL; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { string saName; diff --git a/MAC/APL/PAC/ITRFBeamServer/src/BeamServerMain.cc b/MAC/APL/PAC/ITRFBeamServer/src/BeamServerMain.cc index eb39f972ecf..00a98634007 100644 --- a/MAC/APL/PAC/ITRFBeamServer/src/BeamServerMain.cc +++ b/MAC/APL/PAC/ITRFBeamServer/src/BeamServerMain.cc @@ -22,6 +22,7 @@ //# #include <lofar_config.h> #include <Common/LofarLogger.h> +#include <Common/Exception.h> #include "BeamServer.h" @@ -29,6 +30,9 @@ using namespace LOFAR; using namespace LOFAR::GCF::TM; using namespace LOFAR::BS; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { // args: cntlrname, parentHost, parentService diff --git a/MAC/APL/PAC/ITRFCalServer/src/calinfo.cc b/MAC/APL/PAC/ITRFCalServer/src/calinfo.cc index a18290c3c9e..6e1ea2451f0 100644 --- a/MAC/APL/PAC/ITRFCalServer/src/calinfo.cc +++ b/MAC/APL/PAC/ITRFCalServer/src/calinfo.cc @@ -26,6 +26,7 @@ //# Includes #include <Common/LofarLogger.h> #include <Common/StringUtil.h> +#include <Common/Exception.h> #include <APL/ICAL_Protocol/ICAL_Protocol.ph> #include <MACIO/MACServiceInfo.h> #include "calinfo.h" @@ -137,6 +138,9 @@ using namespace LOFAR::GCF; using namespace LOFAR::GCF::TM; using namespace LOFAR::ICAL; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { string saName; diff --git a/MAC/APL/RTDBCommon/src/setObjectState.cc b/MAC/APL/RTDBCommon/src/setObjectState.cc index 292f26bf2b2..ecece1201ea 100644 --- a/MAC/APL/RTDBCommon/src/setObjectState.cc +++ b/MAC/APL/RTDBCommon/src/setObjectState.cc @@ -23,6 +23,7 @@ #include <lofar_config.h> #include <Common/LofarLogger.h> +#include <Common/Exception.h> #include <Common/lofar_fstream.h> #include <GCF/PVSS/GCF_PVTypes.h> #include <GCF/RTDB/DPservice.h> @@ -194,6 +195,9 @@ using namespace LOFAR; using namespace LOFAR::GCF; using namespace LOFAR::APL::RTDBCommon; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { if (argc != 3 && argc != 4) { diff --git a/MAC/APL/StationCU/src/BeamControl/BeamControlMain.cc b/MAC/APL/StationCU/src/BeamControl/BeamControlMain.cc index e309ff0d9ac..c842e8ec9bf 100644 --- a/MAC/APL/StationCU/src/BeamControl/BeamControlMain.cc +++ b/MAC/APL/StationCU/src/BeamControl/BeamControlMain.cc @@ -22,12 +22,15 @@ //# #include <lofar_config.h> #include <Common/LofarLogger.h> - +#include <Common/Exception.h> #include "BeamControl.h" using namespace LOFAR::GCF::TM; using namespace LOFAR::StationCU; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { // args: cntlrname, parentHost, parentService diff --git a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlMain.cc b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlMain.cc index d78ef29546a..0d2db572780 100644 --- a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlMain.cc +++ b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlMain.cc @@ -22,12 +22,15 @@ //# #include <lofar_config.h> #include <Common/LofarLogger.h> - +#include <Common/Exception.h> #include "CalibrationControl.h" using namespace LOFAR::GCF::TM; using namespace LOFAR::StationCU; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { // args: cntlrname, parentHost, parentService diff --git a/MAC/APL/StationCU/src/ClockControl/ClockControlMain.cc b/MAC/APL/StationCU/src/ClockControl/ClockControlMain.cc index ff30754e77e..8c0d8722719 100644 --- a/MAC/APL/StationCU/src/ClockControl/ClockControlMain.cc +++ b/MAC/APL/StationCU/src/ClockControl/ClockControlMain.cc @@ -22,12 +22,16 @@ //# #include <lofar_config.h> #include <Common/LofarLogger.h> +#include <Common/Exception.h> #include "ClockControl.h" using namespace LOFAR::GCF::TM; using namespace LOFAR::StationCU; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { if (argc < 3) { diff --git a/MAC/APL/StationCU/src/ClockControl/clkctl.cc b/MAC/APL/StationCU/src/ClockControl/clkctl.cc index c4442081101..8b01db1c409 100644 --- a/MAC/APL/StationCU/src/ClockControl/clkctl.cc +++ b/MAC/APL/StationCU/src/ClockControl/clkctl.cc @@ -22,6 +22,7 @@ //# #include <lofar_config.h> #include <Common/LofarLogger.h> +#include <Common/Exception.h> #include <MACIO/MACServiceInfo.h> #include "Clock_Protocol.ph" @@ -170,6 +171,9 @@ void ClkCtl::doHelp() using namespace LOFAR; using namespace LOFAR::GCF::TM; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { if (argc < 2) { diff --git a/MAC/APL/StationCU/src/HardwareMonitor/HardwareMonitorMain.cc b/MAC/APL/StationCU/src/HardwareMonitor/HardwareMonitorMain.cc index 3ea35f5a162..f671ca5b3a4 100644 --- a/MAC/APL/StationCU/src/HardwareMonitor/HardwareMonitorMain.cc +++ b/MAC/APL/StationCU/src/HardwareMonitor/HardwareMonitorMain.cc @@ -23,7 +23,7 @@ #include <lofar_config.h> #include <Common/LofarLogger.h> #include <Common/Version.h> - +#include <Common/Exception.h> #include <Common/ParameterSet.h> #include <APL/RSP_Protocol/RSP_Protocol.ph> #include <GCF/RTDB/DP_Protocol.ph> @@ -37,6 +37,9 @@ using namespace LOFAR::GCF; using namespace LOFAR::GCF::TM; using namespace LOFAR::StationCU; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { // args: cntlrname, parentHost, parentService diff --git a/MAC/APL/StationCU/src/StationControl/StationControlMain.cc b/MAC/APL/StationCU/src/StationControl/StationControlMain.cc index 38ff113ea9e..9773aeab400 100644 --- a/MAC/APL/StationCU/src/StationControl/StationControlMain.cc +++ b/MAC/APL/StationCU/src/StationControl/StationControlMain.cc @@ -22,6 +22,7 @@ //# #include <lofar_config.h> #include <Common/LofarLogger.h> +#include <Common/Exception.h> #include <Common/SystemUtil.h> #include <APL/APLCommon/ChildControl.h> #include <APL/APLCommon/ParentControl.h> @@ -33,6 +34,9 @@ using namespace LOFAR::GCF::TM; using namespace LOFAR::APLCommon; using namespace LOFAR::StationCU; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { using LOFAR::basename; diff --git a/MAC/APL/StationCU/src/TBBControl/TBBControlMain.cc b/MAC/APL/StationCU/src/TBBControl/TBBControlMain.cc index 18fd7601624..e1efb83bb13 100644 --- a/MAC/APL/StationCU/src/TBBControl/TBBControlMain.cc +++ b/MAC/APL/StationCU/src/TBBControl/TBBControlMain.cc @@ -22,12 +22,15 @@ //# #include <lofar_config.h> #include <Common/LofarLogger.h> - +#include <Common/Exception.h> #include "TBBControl.h" using namespace LOFAR::GCF::TM; using namespace LOFAR::StationCU; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { // args: cntlrname, parentHost, parentService diff --git a/MAC/APL/TestCtlr/src/CodeLoggingTest.cc b/MAC/APL/TestCtlr/src/CodeLoggingTest.cc index 546da5e6e50..b0d6efa9a77 100644 --- a/MAC/APL/TestCtlr/src/CodeLoggingTest.cc +++ b/MAC/APL/TestCtlr/src/CodeLoggingTest.cc @@ -23,12 +23,18 @@ #include <lofar_config.h> #include <Common/LofarLogger.h> #include <Common/SystemUtil.h> +#include <Common/Exception.h> #include <time.h> #include <unistd.h> #include <cstdio> #include <cstring> +using namespace LOFAR; + +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main(int argc, char* argv[]) { if (argc != 2) { diff --git a/MAC/APL/TestCtlr/src/ControllerMenuMain.cc b/MAC/APL/TestCtlr/src/ControllerMenuMain.cc index c0f9b369f36..6f0598b4828 100644 --- a/MAC/APL/TestCtlr/src/ControllerMenuMain.cc +++ b/MAC/APL/TestCtlr/src/ControllerMenuMain.cc @@ -22,11 +22,16 @@ //# #include <lofar_config.h> #include <Common/LofarLogger.h> +#include <Common/Exception.h> #include "ControllerMenu.h" using namespace LOFAR::GCF::TM; using namespace LOFAR::Test; +using namespace LOFAR; + +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); int main(int argc, char* argv[]) { diff --git a/MAC/APL/TestCtlr/src/TestControllerMain.cc b/MAC/APL/TestCtlr/src/TestControllerMain.cc index fe7bc45c6c4..9d1dfb04def 100644 --- a/MAC/APL/TestCtlr/src/TestControllerMain.cc +++ b/MAC/APL/TestCtlr/src/TestControllerMain.cc @@ -22,11 +22,16 @@ //# #include <lofar_config.h> #include <Common/LofarLogger.h> +#include <Common/Exception.h> #include "TestController.h" using namespace LOFAR::GCF::TM; using namespace LOFAR::Test; +using namespace LOFAR; + +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); int main(int argc, char* argv[]) { diff --git a/RTCP/LofarStMan/src/fixlsmeta.cc b/RTCP/LofarStMan/src/fixlsmeta.cc index 7e94dc13e15..4ce99510fef 100644 --- a/RTCP/LofarStMan/src/fixlsmeta.cc +++ b/RTCP/LofarStMan/src/fixlsmeta.cc @@ -33,6 +33,9 @@ using namespace casa; using namespace LOFAR; +// Use a terminate handler that can produce a backtrace. +Exception::TerminateHandler t(Exception::terminate); + int main (int argc, char* argv[]) { try { -- GitLab