Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics around backtraces
[simgrid.git] / src / xbt / backtrace.cpp
index 022ae52..5be4b01 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2005-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2005-2018. 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 "src/internal_config.h"
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_backtrace, xbt, "Backtrace");
 
-}
-
 static bool startWith(std::string str, const char* prefix)
 {
   return strncmp(str.c_str(), prefix, strlen(prefix)) == 0;
@@ -36,7 +32,7 @@ static bool startWith(std::string str, const char* prefix)
 void xbt_backtrace_display(xbt_backtrace_location_t* loc, std::size_t count)
 {
 #ifdef HAVE_BACKTRACE
-  std::vector<std::string> backtrace = simgrid::xbt::resolveBacktrace(loc, count);
+  std::vector<std::string> backtrace = simgrid::xbt::resolve_backtrace(loc, count);
   if (backtrace.empty()) {
     fprintf(stderr, "(backtrace not set)\n");
     return;
@@ -84,12 +80,12 @@ std::unique_ptr<char, void(*)(void*)> demangle(const char* name)
   return std::unique_ptr<char, void(*)(void*)>(xbt_strdup(name), std::free);
 }
 
-std::vector<xbt_backtrace_location_t> backtrace()
+Backtrace backtrace()
 {
   const std::size_t size = 10;
   xbt_backtrace_location_t loc[size];
   size_t used = xbt_backtrace_current(loc, size);
-  return std::vector<xbt_backtrace_location_t>(loc, loc + used);
+  return Backtrace(loc, loc + used);
 }
 
 }