X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fpbd%2Fpbd%2Fstacktrace.h;h=99fc9d5c574f742e400532f8fb8144928fee9b2c;hb=94a136a6bf9f8e8d402b97c95924f253e505e9ac;hp=f3c7baf7d78fb6bb72dfec10d2b1ac2f5460244a;hpb=5e0e41e068a04603198a4e50464d794156f42c47;p=ardour.git diff --git a/libs/pbd/pbd/stacktrace.h b/libs/pbd/pbd/stacktrace.h index f3c7baf7d7..99fc9d5c57 100644 --- a/libs/pbd/pbd/stacktrace.h +++ b/libs/pbd/pbd/stacktrace.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,13 +34,16 @@ #include #endif +#include "pbd/libpbd_visibility.h" + + namespace PBD { - void stacktrace (std::ostream& out, int levels = 0); - void trace_twb(); - std::string demangle (const std::string&); + + LIBPBD_API void stacktrace (std::ostream& out, int levels = 0); + LIBPBD_API void trace_twb(); template -class thing_with_backtrace +class /*LIBPBD_API*/ thing_with_backtrace { public: thing_with_backtrace () { @@ -48,7 +51,7 @@ class thing_with_backtrace #ifdef HAVE_EXECINFO allocation_backtrace = new void*[50]; allocation_backtrace_size = backtrace (allocation_backtrace, 50); -#else +#else allocation_backtrace_size = 0; #endif Glib::Threads::Mutex::Lock lm (all_mutex); @@ -60,14 +63,14 @@ class thing_with_backtrace #ifdef HAVE_EXECINFO allocation_backtrace = new void*[50]; allocation_backtrace_size = backtrace (allocation_backtrace, 50); -#else +#else allocation_backtrace_size = 0; #endif Glib::Threads::Mutex::Lock lm (all_mutex); all.push_back (this); } - ~thing_with_backtrace() { + ~thing_with_backtrace() { if (allocation_backtrace_size) { delete [] allocation_backtrace; } @@ -86,9 +89,9 @@ class thing_with_backtrace for (x = all.begin(); x != all.end(); ++x) { char **strings; size_t i; - + strings = backtrace_symbols ((*x)->allocation_backtrace, (*x)->allocation_backtrace_size); - + if (strings) { stream << "--- ALLOCATED SHARED_PTR @ " << (*x) << std::endl; for (i = 0; i < (*x)->allocation_backtrace_size && i < 50U; i++) { @@ -109,11 +112,9 @@ private: static Glib::Threads::Mutex all_mutex; }; -template std::list *> PBD::thing_with_backtrace::all; -template Glib::Threads::Mutex PBD::thing_with_backtrace::all_mutex; +template /*LIBPBD_API*/ std::list *> PBD::thing_with_backtrace::all; +template /*LIBPBD_API*/ Glib::Threads::Mutex PBD::thing_with_backtrace::all_mutex; } // namespace PBD - - #endif /* __libpbd_stacktrace_h__ */