Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-10-08 02:27:20

0001 #include "FWCore/MessageService/test/makeSignals.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 #include "FWCore/MessageLogger/interface/MessageDrop.h"
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "FWCore/Framework/interface/MakerMacros.h"
0006 
0007 #include <iostream>
0008 #include <string>
0009 #include <csignal>
0010 
0011 #define RAISE_SEGV
0012 //#define RAISE_USR2
0013 
0014 namespace edmtest {
0015 
0016   void makeSignals::analyze(edm::StreamID, edm::Event const& e, edm::EventSetup const& /*unused*/
0017   ) const {
0018 #ifdef RAISE_SEGV
0019     int signum = 11;
0020     std::string SigName("SIGSEGV");
0021 #endif
0022 
0023 #ifdef RAISE_USR2
0024     int signum = 12;
0025     std::string SigName("SIGUSR2");
0026 #endif
0027     edm::MessageDrop::instance()->debugEnabled = true;
0028 
0029     LogTrace("cat_A") << "LogTrace was used to send this mess"
0030                       << "age";
0031     LogDebug("cat_B") << "LogDebug was used to send this other message";
0032     edm::LogVerbatim("cat_A") << "LogVerbatim was us"
0033                               << "ed to send this message";
0034     if (edm::isInfoEnabled())
0035       edm::LogInfo("cat_B") << "LogInfo was used to send this other message\n";
0036 
0037     if (e.id().event() == 5) {
0038       std::cerr << "Raising Signal " << SigName << " = " << signum << std::endl;
0039       edm::LogInfo("Signals") << "Raising Signal " << SigName << " = " << signum;
0040 #ifdef RAISE_SEGV
0041       raise(SIGSEGV);
0042 #endif
0043 
0044 #ifdef RAISE_USR2
0045       raise(SIGUSR2);
0046 #endif
0047 
0048       //  Force a Seg Fault
0049       //  int * pint = 0;
0050       //  int rint = *pint;
0051     }
0052   }  // makeSignals::analyze()
0053 }  // namespace edmtest
0054 
0055 using edmtest::makeSignals;
0056 DEFINE_FWK_MODULE(makeSignals);