3 #include "TEveManager.h"
5 #include "TApplication.h"
6 #include "TSysEvtHandler.h"
33 SilentMLscribe(
const SilentMLscribe&) =
delete;
35 const SilentMLscribe&
operator=(
const SilentMLscribe&) =
delete;
44 edm::ErrorObj* errorobj_p = static_cast<edm::ErrorObj*>(operand);
52 std::string* string_p = static_cast<std::string*>(operand);
64 void signal_handler_wrapper(
int sid, siginfo_t* sinfo,
void* sctx) {
66 std::cerr <<
"Program received signal ID = " << sid << std::endl;
67 std::cerr <<
"Printing stack trace ... " << std::endl;
69 TString gdbCommand(
"scripts/gdb-backtrace.sh");
73 gdbCommand += gSystem->GetPid();
75 gSystem->Exec(gdbCommand.Data());
77 Getlinem(kCleanUp,
nullptr);
85 std::shared_ptr<edm::service::AbstractMLscribe>(std::make_shared<SilentMLscribe>()));
92 gSystem->ResetSignal(kSigBus);
93 gSystem->ResetSignal(kSigSegmentationViolation);
94 gSystem->ResetSignal(kSigIllegalInstruction);
95 gSystem->ResetSignal(kSigSystem);
96 gSystem->ResetSignal(kSigPipe);
97 gSystem->ResetSignal(kSigFloatingException);
100 sac.sa_sigaction = signal_handler_wrapper;
101 sigemptyset(&sac.sa_mask);
102 sac.sa_flags = SA_SIGINFO;
103 sigaction(SIGILL, &sac,
nullptr);
104 sigaction(SIGSEGV, &sac,
nullptr);
105 sigaction(SIGBUS, &sac,
nullptr);
106 sigaction(SIGFPE, &sac,
nullptr);
111 TEveManager::Terminate();
119 const char* dummyArgvArray[] = {
"cmsShow"};
120 char** dummyArgv = const_cast<char**>(dummyArgvArray);
122 gEnv->SetValue(
"Gui.BackgroundColor",
"#9f9f9f");
126 if (gSystem->Getenv(
"CMSSW_VERSION")) {
127 infoText = gSystem->Getenv(
"CMSSW_VERSION");
129 TString infoFileName(
"data/version.txt");
131 std::ifstream infoFile(infoFileName);
132 infoText.ReadLine(infoFile);
135 printf(
"Starting cmsShow, version %s.\n", infoText.Data());
140 for (Int_t
i = 0;
i <
argc;
i++) {
141 if (strncmp(
argv[
i],
"-r", 2) == 0 || strncmp(
argv[
i],
"--root", 6) == 0) {
149 std::cerr <<
"WARNING:You are running cmsShow with ROOT prompt enabled." << std::endl;
150 std::cerr <<
"If you encounter an issue you suspect to be a bug in " << std::endl;
151 std::cerr <<
"cmsShow, please re-run without this option and try to " << std::endl;
152 std::cerr <<
"reproduce it before submitting a bug-report. " << std::endl;
155 TRint app(
"cmsShow", &dummyArgc, dummyArgv);
158 TApplication app(
"cmsShow", &dummyArgc, dummyArgv);
162 std::cerr <<
"CmsShow unhandled exception " << iException.what() << std::endl;