- New functions: Comm::sendto_{init,async} to initiate a communication
on between two (possibly remote) hosts.
+XBT:
+ - Drop simgrid::xbt::demangle. Please use boost::core::demangle instead.
+
Documentation:
- New section: Configuring the logs from the command line.
- New section: Programming API of logs.
namespace simgrid {
namespace xbt {
-/** Try to demangle a C++ name
- *
- * Return the origin string if this fails.
- */
-XBT_PUBLIC std::unique_ptr<char, std::function<void(char*)>> demangle(const char* name);
-
class BacktraceImpl;
/** A backtrace
*
#include "src/surf/HostImpl.hpp"
#include "src/surf/cpu_interface.hpp"
+#include <boost/core/demangle.hpp>
#include <boost/range/algorithm.hpp>
#include <utility>
try {
std::rethrow_exception(std::move(exception));
} catch (const simgrid::Exception& e) {
- std::string name = simgrid::xbt::demangle(typeid(e).name()).get();
- e.rethrow_nested(XBT_THROW_POINT, name + " raised in kernel mode.");
+ e.rethrow_nested(XBT_THROW_POINT, boost::core::demangle(typeid(e).name()) + " raised in kernel mode.");
}
}
#include "src/kernel/context/ContextSwapped.hpp"
+#include <boost/core/demangle.hpp>
#include <memory>
#ifdef _WIN32
} catch (simgrid::ForcefulKillException const&) {
XBT_DEBUG("Caught a ForcefulKillException");
} catch (simgrid::Exception const& e) {
- XBT_INFO("Actor killed by an uncaught exception %s", simgrid::xbt::demangle(typeid(e).name()).get());
+ XBT_INFO("Actor killed by an uncaught exception %s", boost::core::demangle(typeid(e).name()).c_str());
throw;
}
#if HAVE_SANITIZER_ADDRESS_FIBER_SUPPORT
#include "src/xbt_modinter.h" /* prototype of os thread module's init/exit in XBT */
#include "xbt/function_types.h"
+#include <boost/core/demangle.hpp>
#include <functional>
#include <utility>
XBT_DEBUG("Caught a ForcefulKillException in Thread::wrapper");
xbt_assert(not context->is_maestro(), "Maestro shall not receive ForcefulKillExceptions, even when detached.");
} catch (simgrid::Exception const& e) {
- XBT_INFO("Actor killed by an uncaught exception %s", simgrid::xbt::demangle(typeid(e).name()).get());
+ XBT_INFO("Actor killed by an uncaught exception %s", boost::core::demangle(typeid(e).name()).c_str());
throw;
}
// Signal to the caller (normally the maestro) that we have finished:
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/kernel/lmm/maxmin.hpp"
-#include "xbt/backtrace.hpp"
+#include <boost/core/demangle.hpp>
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_maxmin, surf, "Logging specific to SURF (maxmin)");
Constraint* cnst;
while ((var = extract_variable())) {
- auto demangled = simgrid::xbt::demangle(var->id_ ? typeid(*var->id_).name() : "(unidentified)");
- XBT_WARN("Probable bug: a %s variable (#%d) not removed before the LMM system destruction.", demangled.get(),
+ std::string demangled = boost::core::demangle(var->id_ ? typeid(*var->id_).name() : "(unidentified)");
+ XBT_WARN("Probable bug: a %s variable (#%d) not removed before the LMM system destruction.", demangled.c_str(),
var->rank_);
var_free(var);
}
#include "src/mc/mc_smx.hpp"
#include "src/mc/remote/AppSide.hpp"
#include "src/mc/sosp/Snapshot.hpp"
-#include "xbt/backtrace.hpp"
#include <array>
+#include <boost/core/demangle.hpp>
#include <libunwind.h>
#endif
do {
const char* name = not unw_get_proc_name(cursor, buffer.data(), buffer.size(), &off) ? buffer.data() : "?";
// Unmangle C++ names:
- auto realname = simgrid::xbt::demangle(name);
+ std::string realname = boost::core::demangle(name);
#if defined(__x86_64__)
unw_word_t rip = 0;
unw_word_t rsp = 0;
unw_get_reg(cursor, UNW_X86_64_RIP, &rip);
unw_get_reg(cursor, UNW_X86_64_RSP, &rsp);
- fprintf(file, " %i: %s (RIP=0x%" PRIx64 " RSP=0x%" PRIx64 ")\n", nframe, realname.get(), (std::uint64_t)rip,
+ fprintf(file, " %i: %s (RIP=0x%" PRIx64 " RSP=0x%" PRIx64 ")\n", nframe, realname.c_str(), (std::uint64_t)rip,
(std::uint64_t)rsp);
#else
- fprintf(file, " %i: %s\n", nframe, realname.get());
+ fprintf(file, " %i: %s\n", nframe, realname.c_str());
#endif
++nframe;
#include <cstdlib>
#include <sstream>
-// Try to detect and use the C++ itanium ABI for name demangling:
-#ifdef __GXX_ABI_VERSION
-#include <cxxabi.h>
-#endif
-
#if HAVE_BOOST_STACKTRACE_BACKTRACE
#define BOOST_STACKTRACE_USE_BACKTRACE
#include <boost/stacktrace.hpp>
namespace simgrid {
namespace xbt {
-std::unique_ptr<char, std::function<void(char*)>> demangle(const char* name)
-{
-#ifdef __GXX_ABI_VERSION
- int status;
- std::unique_ptr<char, std::function<void(char*)>> res(abi::__cxa_demangle(name, nullptr, nullptr, &status),
- &std::free);
- if (res != nullptr)
- return res;
- // We did not manage to resolve this. Probably because this is not a mangled symbol:
-#endif
- // Return the symbol:
- return std::unique_ptr<char, std::function<void(char*)>>(xbt_strdup(name), &xbt_free_f);
-}
-
class BacktraceImpl {
#if HAVE_BOOST_STACKTRACE_BACKTRACE || HAVE_BOOST_STACKTRACE_ADDR2LINE
const boost::stacktrace::stacktrace st;
#include <xbt/config.hpp>
#include <xbt/log.hpp>
+#include <boost/core/demangle.hpp>
#include <mutex>
#include <sstream>
void log_exception(e_xbt_log_priority_t prio, const char* context, std::exception const& exception)
{
try {
- auto name = simgrid::xbt::demangle(typeid(exception).name());
+ std::string name = boost::core::demangle(typeid(exception).name());
auto* with_context = dynamic_cast<const simgrid::Exception*>(&exception);
if (with_context != nullptr) {
- XBT_LOG(prio, "%s %s by %s/%d: %s", context, name.get(), with_context->throw_point().procname_.c_str(),
+ XBT_LOG(prio, "%s %s by %s/%d: %s", context, name.c_str(), with_context->throw_point().procname_.c_str(),
with_context->throw_point().pid_, exception.what());
// Do we have a backtrace?
if (not simgrid::config::get_value<bool>("exception/cutpath")) {
XBT_LOG(prio, "Backtrace:\n%s", backtrace.c_str());
}
} else {
- XBT_LOG(prio, "%s %s: %s", context, name.get(), exception.what());
+ XBT_LOG(prio, "%s %s: %s", context, name.c_str(), exception.what());
}
} catch (...) {
// Don't log exceptions we got when trying to log exception