-/* Copyright (c) 2005-2020. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2005-2021. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <xbt/sysdep.h>
#include <xbt/virtu.h>
-#include <cstddef>
+#include <cstdio>
#include <cstdlib>
-#include <cstring>
-#include <fstream>
#include <sstream>
-#include <sys/stat.h>
-#include <vector>
-
-#include <boost/algorithm/string.hpp>
// Try to detect and use the C++ itanium ABI for name demangling:
#ifdef __GXX_ABI_VERSION
class BacktraceImpl {
#if HAVE_BOOST_STACKTRACE_BACKTRACE || HAVE_BOOST_STACKTRACE_ADDR2LINE
const boost::stacktrace::stacktrace st = boost::stacktrace::stacktrace();
-#else
- const char st[1] = ""; // fallback value
-#endif
public:
std::string resolve() const
{
ss << st;
return ss.str();
}
+#else
+public:
+ std::string resolve() const { return ""; } // fallback value
+#endif
};
Backtrace::Backtrace() : impl_(std::make_shared<BacktraceImpl>()) {}
void Backtrace::display() const
{
std::string backtrace = resolve();
- fprintf(stderr, "Backtrace (displayed in actor %s):\n%s\n", xbt_procname(),
- backtrace.empty() ? "(backtrace not set -- did you install Boost.Stacktrace?)" : backtrace.c_str());
+ std::fprintf(stderr, "Backtrace (displayed in actor %s):\n%s\n", xbt_procname(),
+ backtrace.empty() ? "(backtrace not set -- did you install Boost.Stacktrace?)" : backtrace.c_str());
}
} // namespace xbt