Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
python: First working example
[simgrid.git] / src / xbt / exception.cpp
index 17c9850..94130b3 100644 (file)
@@ -21,7 +21,7 @@ xbt_ex::~xbt_ex() = default;
 
 void _xbt_throw(char* message, xbt_errcat_t errcat, int value, const char* file, int line, const char* func)
 {
-  xbt_ex e(simgrid::xbt::ThrowPoint(file, line, func, simgrid::xbt::backtrace(), xbt_procname(), xbt_getpid()),
+  xbt_ex e(simgrid::xbt::ThrowPoint(file, line, func, simgrid::xbt::Backtrace(), xbt_procname(), xbt_getpid()),
            message);
   xbt_free(message);
   e.category = errcat;
@@ -90,9 +90,8 @@ void log_exception(e_xbt_log_priority_t prio, const char* context, std::exceptio
 
     // Do we have a backtrace?
     if (with_context != nullptr && not simgrid::config::get_value<bool>("exception/cutpath")) {
-      auto backtrace = simgrid::xbt::resolve_backtrace(with_context->throw_point().backtrace_);
-      for (std::string const& s : backtrace)
-        XBT_LOG(prio, "  -> %s", s.c_str());
+      auto backtrace = with_context->resolve_backtrace();
+      XBT_LOG(prio, "  -> %s", backtrace.c_str());
     }
 
     // Do we have a nested exception?
@@ -121,10 +120,9 @@ static void show_backtrace(const simgrid::xbt::Backtrace& bt)
     XBT_LOG(xbt_log_priority_critical, "Display of current backtrace disabled by --cfg=exception/cutpath.");
     return;
   }
-  std::vector<std::string> res = resolve_backtrace(bt);
+  std::string res = bt.resolve();
   XBT_LOG(xbt_log_priority_critical, "Current backtrace:");
-  for (std::string const& s : res)
-    XBT_LOG(xbt_log_priority_critical, "  -> %s", s.c_str());
+  XBT_LOG(xbt_log_priority_critical, "  -> %s", res.c_str());
 }
 
 static std::terminate_handler previous_terminate_handler = nullptr;
@@ -141,7 +139,7 @@ static void handler()
 
   // Get the current backtrace and exception
   auto e = std::current_exception();
-  simgrid::xbt::Backtrace bt = simgrid::xbt::backtrace();
+  simgrid::xbt::Backtrace bt = simgrid::xbt::Backtrace();
   try {
     std::rethrow_exception(e);
   }