X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/34cc424dffb95939f16753a42462f10df5b96dbf..39c935d6d5ee86d153f6f7e6a10d723ae7c57f6f:/src/xbt/backtrace.cpp diff --git a/src/xbt/backtrace.cpp b/src/xbt/backtrace.cpp index 4e26ce0c60..693ef556ab 100644 --- a/src/xbt/backtrace.cpp +++ b/src/xbt/backtrace.cpp @@ -1,4 +1,4 @@ -/* 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. */ @@ -10,15 +10,9 @@ #include #include -#include +#include #include -#include -#include #include -#include -#include - -#include // Try to detect and use the C++ itanium ABI for name demangling: #ifdef __GXX_ABI_VERSION @@ -59,9 +53,6 @@ std::unique_ptr> demangle(const char* name) 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 { @@ -69,6 +60,10 @@ public: ss << st; return ss.str(); } +#else +public: + std::string resolve() const { return ""; } // fallback value +#endif }; Backtrace::Backtrace() : impl_(std::make_shared()) {} @@ -81,8 +76,8 @@ std::string Backtrace::resolve() const 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