40 return "Stack-trace currently not available on Mac OS";
44 std::string
const cmd =
"gdb --batch -n -ex bt -p " +
std::to_string(getpid()) +
" 2>&1";
45 std::string
const py_sentinel =
"libpython";
47 constexpr int max_buffer = 256;
48 std::array<char, max_buffer> buffer{};
49 std::string pipe_output;
50 if (FILE *stream = popen(cmd.c_str(),
"r"); stream !=
nullptr) {
51 while (fgets(buffer.data(), max_buffer, stream) !=
nullptr) pipe_output.append(buffer.data());
55 std::stringstream ss(pipe_output);
59 while (std::getline(ss, to,
'\n') and (to.find(
"triqs::exception::exception") == std::string::npos)) {}
61 while (std::getline(ss, to,
'\n')) {
62 if (to.find(py_sentinel) != std::string::npos)
break;