MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / handler

Method handler

Src/Base/AMReX_BLBackTrace.cpp:49–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47std::stack<std::pair<std::string, std::string> > BLBackTrace::bt_stack;
48
49void
50BLBackTrace::handler(int s)
51{
52
53 std::signal(s, SIG_DFL);
54
55 AsyncOut::Finalize();
56
57 switch (s) {
58 case SIGSEGV:
59 amrex::ErrorStream() << "Segfault\n";
60 break;
61 case SIGFPE:
62 amrex::ErrorStream() << "Erroneous arithmetic operation\n";
63 break;
64 case SIGILL:
65 amrex::ErrorStream() << "SIGILL Invalid, privileged, or ill-formed instruction\n";
66 break;
67 case SIGTERM:
68 amrex::ErrorStream() << "SIGTERM\n";
69 break;
70 case SIGINT:
71 amrex::ErrorStream() << "SIGINT\n";
72 break;
73 case SIGABRT:
74 amrex::ErrorStream() << "SIGABRT\n";
75 break;
76 default: break;
77 }
78
79#if defined(AMREX_BACKTRACE_SUPPORTED) || defined(AMREX_TINY_PROFILING)
80
81 std::string errfilename;
82 {
83 std::ostringstream ss;
84#ifdef AMREX_USE_MPI
85 if (MPMD::Initialized()) {
86 ss << "Backtrace.prog" << MPMD::MyProgId() << ".";
87 } else
88#endif
89 {
90 ss << "Backtrace.";
91 }
92 ss << ParallelDescriptor::MyProc();
93#ifdef AMREX_USE_OMP
94 ss << "." << omp_get_thread_num();
95#endif
96 errfilename = ss.str();
97 }
98
99 if (FILE* p = fopen(errfilename.c_str(), "w")) {
100#if defined(AMREX_BACKTRACE_SUPPORTED)
101 BLBackTrace::print_backtrace_info(p);
102#endif
103 fclose(p);
104 }
105
106 amrex::ErrorStream() << "See " << errfilename << " file for details" << '\n';

Callers

nothing calls this directly

Calls 9

InitializedFunction · 0.85
MyProgIdFunction · 0.85
AbortFunction · 0.85
topMethod · 0.80
FinalizeFunction · 0.70
MyProcFunction · 0.70
NProcsFunction · 0.70
emptyMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected