MCPcopy Create free account
hub / github.com/boostorg/stacktrace / run_2

Function run_2

example/terminate_handler.cpp:109–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109int run_2(const char* argv[]) {
110 if (!boost::filesystem::exists("./backtrace.dump")) {
111 if (std::string(argv[0]).find("noop") == std::string::npos) {
112 return 21;
113 }
114
115 boost::stacktrace::stacktrace st = boost::stacktrace::stacktrace::from_dump(std::cin);
116 if (st) {
117 return 22;
118 }
119 return 0;
120 }
121
122//[getting_started_on_program_restart
123 if (boost::filesystem::exists("./backtrace.dump")) {
124 // there is a backtrace
125 std::ifstream ifs("./backtrace.dump");
126
127 boost::stacktrace::stacktrace st = boost::stacktrace::stacktrace::from_dump(ifs);
128 std::cout << "Previous run crashed:\n" << st << std::endl; /*<-*/
129
130 if (!st) {
131 return 23;
132 } /*->*/
133
134 // cleaning up
135 ifs.close();
136 boost::filesystem::remove("./backtrace.dump");
137 }
138//]
139
140 return 0;
141}
142
143#include <sstream>
144

Callers

nothing calls this directly

Calls 1

from_dumpFunction · 0.85

Tested by

no test coverage detected