Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics around backtraces
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 27 Oct 2018 15:20:25 +0000 (17:20 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 27 Oct 2018 16:15:29 +0000 (18:15 +0200)
- Use a type hiding the vector
- Remove a deprecated function that nobody uses

This is the first step toward the rewriting of the backtraces. My
motivation is that our ugly hack with addr2line is not working anymore
on my Debian while boost::stacktrace entered testing. I plan to
convert to that new system.

include/xbt/asserts.h
include/xbt/backtrace.hpp
include/xbt/sysdep.h
src/xbt/backtrace.cpp
src/xbt/backtrace_dummy.cpp
src/xbt/backtrace_linux.cpp

index 5e78a3b..07a9ff0 100644 (file)
@@ -15,6 +15,8 @@
 SG_BEGIN_DECL()
 XBT_PUBLIC_DATA int xbt_log_no_loc; /* Do not show the backtrace on failed backtrace when doing our tests */
 
 SG_BEGIN_DECL()
 XBT_PUBLIC_DATA int xbt_log_no_loc; /* Do not show the backtrace on failed backtrace when doing our tests */
 
+XBT_PUBLIC void xbt_backtrace_display_current();
+
 /**
  * @addtogroup XBT_error
  * @brief Those are the SimGrid version of the good ol' assert macro.
 /**
  * @addtogroup XBT_error
  * @brief Those are the SimGrid version of the good ol' assert macro.
index 291f792..1542188 100644 (file)
@@ -33,14 +33,13 @@ typedef std::vector<xbt_backtrace_location_t> Backtrace;
 XBT_PUBLIC std::unique_ptr<char, void (*)(void*)> demangle(const char* name);
 
 /** Get the current backtrace */
 XBT_PUBLIC std::unique_ptr<char, void (*)(void*)> demangle(const char* name);
 
 /** Get the current backtrace */
-XBT_PUBLIC std::vector<xbt_backtrace_location_t> backtrace();
+XBT_PUBLIC Backtrace backtrace();
 
 /* Translate the backtrace in a human friendly form
  *
  *  Try resolve symbols and source code location.
  */
 XBT_PUBLIC std::vector<std::string> resolve_backtrace(xbt_backtrace_location_t const* loc, std::size_t count);
 
 /* Translate the backtrace in a human friendly form
  *
  *  Try resolve symbols and source code location.
  */
 XBT_PUBLIC std::vector<std::string> resolve_backtrace(xbt_backtrace_location_t const* loc, std::size_t count);
-XBT_ATTRIB_DEPRECATED_v323("Please use xbt::resolve_backtrace()") XBT_PUBLIC std::vector<std::string> resolveBacktrace(xbt_backtrace_location_t const* loc, std::size_t count);
 }
 }
 
 }
 }
 
index 86d62bb..51dcebc 100644 (file)
@@ -70,8 +70,6 @@ static XBT_ALWAYS_INLINE char *xbt_strdup(const char *s) {
   return res;
 }
 
   return res;
 }
 
-XBT_PUBLIC void xbt_backtrace_display_current();
-
 /** @brief Like malloc, but xbt_die() on error
     @hideinitializer */
 static XBT_ALWAYS_INLINE void *xbt_malloc(size_t n) {
 /** @brief Like malloc, but xbt_die() on error
     @hideinitializer */
 static XBT_ALWAYS_INLINE void *xbt_malloc(size_t n) {
index 0fc1168..5be4b01 100644 (file)
@@ -80,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);
 }
 
   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);
 {
   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);
 }
 
 }
 }
 
 }
index 95bf87a..5f978bb 100644 (file)
@@ -23,11 +23,6 @@ int xbt_backtrace_no_malloc(void **array, int size) {
 namespace simgrid {
 namespace xbt {
 
 namespace simgrid {
 namespace xbt {
 
-std::vector<std::string> resolveBacktrace(xbt_backtrace_location_t const* loc, std::size_t count) // deprecated
-{
-  return resolve_backtrace(loc, count);
-}
-
 std::vector<std::string> resolve_backtrace(xbt_backtrace_location_t const* loc, std::size_t count)
 {
   return std::vector<std::string>();
 std::vector<std::string> resolve_backtrace(xbt_backtrace_location_t const* loc, std::size_t count)
 {
   return std::vector<std::string>();
index 80de20a..232e1f7 100644 (file)
@@ -136,11 +136,6 @@ static std::string get_binary_path()
   return "";
 }
 
   return "";
 }
 
-std::vector<std::string> resolveBacktrace(xbt_backtrace_location_t const* loc, std::size_t count) // deprecated
-{
-  return resolve_backtrace(loc, count);
-}
-
 //FIXME: This code could be greatly improved/simplifyied with
 //   http://cairo.sourcearchive.com/documentation/1.9.4/backtrace-symbols_8c-source.html
 std::vector<std::string> resolve_backtrace(xbt_backtrace_location_t const* loc, std::size_t count)
 //FIXME: This code could be greatly improved/simplifyied with
 //   http://cairo.sourcearchive.com/documentation/1.9.4/backtrace-symbols_8c-source.html
 std::vector<std::string> resolve_backtrace(xbt_backtrace_location_t const* loc, std::size_t count)