summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-02-25 22:23:30 +0100
committerRobin Gareus <robin@gareus.org>2020-02-25 22:23:30 +0100
commitbcfe16610ac588dffb5b639b033d60fa59a29717 (patch)
tree25f868d0f96d12a318d2156a50927efc90dda0b6
parent9e6435ff145ed7c99312e0d51d9dd23a1a8c3997 (diff)
Consolidate shared-ptr debugging
-rw-r--r--libs/ardour/ardour/boost_debug.h19
-rw-r--r--libs/ardour/region_factory.cc26
-rw-r--r--libs/ardour/source_factory.cc46
-rw-r--r--libs/ardour/transport_master_manager.cc17
4 files changed, 39 insertions, 69 deletions
diff --git a/libs/ardour/ardour/boost_debug.h b/libs/ardour/ardour/boost_debug.h
index bdd3e63531..132c17cd02 100644
--- a/libs/ardour/ardour/boost_debug.h
+++ b/libs/ardour/ardour/boost_debug.h
@@ -25,15 +25,24 @@
unless the program was configured with --boost-sp-debug
*/
-//#define BOOST_MARK_ROUTE(p) boost_debug_shared_ptr_mark_interesting((p).get(),"Route")
-//#define BOOST_MARK_TRACK(p) boost_debug_shared_ptr_mark_interesting((p).get(),"Track")
-//#define BOOST_MARK_VCA(p) boost_debug_shared_ptr_mark_interesting((p).get(),"ControlMaster")
-//#define BOOST_SHOW_POINTERS() boost_debug_list_ptrs()
+//#define BOOST_MARK_ROUTE(p) boost_debug_shared_ptr_mark_interesting ((p).get(),"Route")
+//#define BOOST_MARK_TRACK(p) boost_debug_shared_ptr_mark_interesting ((p).get(),"Track")
+//#define BOOST_MARK_VCA(p) boost_debug_shared_ptr_mark_interesting ((p).get(),"ControlMaster")
+//#define BOOST_MARK_REGION(p) boost_debug_shared_ptr_mark_interesting ((p).get(), "Region")
+//#define BOOST_MARK_SOURCE(p) boost_debug_shared_ptr_mark_interesting ((p).get(), "Source")
+//#define BOOST_MARK_TMM(p) boost_debug_shared_ptr_mark_interesting ((p).get(), "TransportMaster")
#define BOOST_MARK_ROUTE(p)
#define BOOST_MARK_TRACK(p)
#define BOOST_MARK_VCA(p)
-#define BOOST_SHOW_POINTERS()
+#define BOOST_MARK_REGION(p)
+#define BOOST_MARK_SOURCE(p)
+#define BOOST_MARK_TMM(p)
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+#define BOOST_SHOW_POINTERS() boost_debug_list_ptrs()
+#else
+#define BOOST_SHOW_POINTERS()
+#endif
#endif /* __libardour_boost_debug_h__ */
diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc
index 1242ec8aba..9709467281 100644
--- a/libs/ardour/region_factory.cc
+++ b/libs/ardour/region_factory.cc
@@ -37,8 +37,6 @@
#include "pbd/i18n.h"
-// #define BOOST_DEBUG_REGION
-
using namespace ARDOUR;
using namespace PBD;
using namespace std;
@@ -101,9 +99,7 @@ RegionFactory::create (boost::shared_ptr<const Region> region, bool announce, bo
}
}
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_REGION
- boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
-#endif
+ BOOST_MARK_REGION (ret);
return ret;
}
@@ -142,9 +138,7 @@ RegionFactory::create (boost::shared_ptr<Region> region, const PropertyList& pli
}
}
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_REGION
- boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
-#endif
+ BOOST_MARK_REGION (ret);
return ret;
}
@@ -183,9 +177,7 @@ RegionFactory::create (boost::shared_ptr<Region> region, MusicSample offset, con
}
}
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_REGION
- boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
-#endif
+ BOOST_MARK_REGION (ret);
return ret;
}
@@ -224,9 +216,7 @@ RegionFactory::create (boost::shared_ptr<Region> region, const SourceList& srcs,
}
}
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_REGION
- boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
-#endif
+ BOOST_MARK_REGION (ret);
return ret;
}
@@ -268,9 +258,7 @@ RegionFactory::create (const SourceList& srcs, const PropertyList& plist, bool a
}
}
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_REGION
- boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
-#endif
+ BOOST_MARK_REGION (ret);
return ret;
}
@@ -313,9 +301,7 @@ RegionFactory::create (SourceList& srcs, const XMLNode& node)
}
}
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_REGION
- boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
-#endif
+ BOOST_MARK_REGION (ret);
return ret;
}
diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc
index de9d255a70..4eaf0b40fd 100644
--- a/libs/ardour/source_factory.cc
+++ b/libs/ardour/source_factory.cc
@@ -46,8 +46,6 @@
#include "ardour/coreaudiosource.h"
#endif
-// #define BOOST_DEBUG_SOURCE
-
#include "pbd/i18n.h"
using namespace ARDOUR;
@@ -141,10 +139,8 @@ boost::shared_ptr<Source>
SourceFactory::createSilent (Session& s, const XMLNode& node, samplecnt_t nframes, float sr)
{
Source* src = new SilentFileSource (s, node, nframes, sr);
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_SOURCE
- boost_debug_shared_ptr_mark_interesting ((void*)src, "Source");
-#endif
boost::shared_ptr<Source> ret (src);
+ BOOST_MARK_SOURCE (ret);
// no analysis data - the file is non-existent
SourceCreated (ret);
return ret;
@@ -186,10 +182,8 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
try {
Source* src = new SndFileSource (s, node);
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_SOURCE
- boost_debug_shared_ptr_mark_interesting ((void*)src, "Source");
-#endif
boost::shared_ptr<Source> ret (src);
+ BOOST_MARK_SOURCE (ret);
if (setup_peakfile (ret, defer_peaks)) {
return boost::shared_ptr<Source>();
}
@@ -201,10 +195,8 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
#ifdef HAVE_COREAUDIO
try {
Source* src = new CoreAudioSource (s, node);
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_SOURCE
- boost_debug_shared_ptr_mark_interesting ((void*)src, "Source");
-#endif
boost::shared_ptr<Source> ret (src);
+ BOOST_MARK_SOURCE (ret);
if (setup_peakfile (ret, defer_peaks)) {
return boost::shared_ptr<Source>();
@@ -224,9 +216,7 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
boost::shared_ptr<SMFSource> src (new SMFSource (s, node));
Source::Lock lock(src->mutex());
src->load_model (lock, true);
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_SOURCE
- boost_debug_shared_ptr_mark_interesting (src.get(), "Source");
-#endif
+ BOOST_MARK_SOURCE (src);
src->check_for_analysis_data_on_disk ();
SourceCreated (src);
return src;
@@ -247,10 +237,8 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
try {
Source* src = new SndFileSource (s, path, chn, flags);
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_SOURCE
- boost_debug_shared_ptr_mark_interesting ((void*)src, "Source");
-#endif
boost::shared_ptr<Source> ret (src);
+ BOOST_MARK_SOURCE (ret);
if (setup_peakfile (ret, defer_peaks)) {
return boost::shared_ptr<Source>();
}
@@ -264,10 +252,8 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
#ifdef HAVE_COREAUDIO
try {
Source* src = new CoreAudioSource (s, path, chn, flags);
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_SOURCE
- boost_debug_shared_ptr_mark_interesting ((void*)src, "Source");
-#endif
boost::shared_ptr<Source> ret (src);
+ BOOST_MARK_SOURCE (ret);
if (setup_peakfile (ret, defer_peaks)) {
return boost::shared_ptr<Source>();
}
@@ -283,10 +269,8 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
if (!announce && (!AudioFileSource::get_build_peakfiles () || defer_peaks)) {
try {
Source* src = new Mp3FileSource (s, path, chn, flags);
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_SOURCE
- boost_debug_shared_ptr_mark_interesting ((void*)src, "Source");
-#endif
boost::shared_ptr<Source> ret (src);
+ BOOST_MARK_SOURCE (ret);
return ret;
} catch (failed_constructor& err) { }
@@ -305,9 +289,7 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
boost::shared_ptr<SMFSource> src (new SMFSource (s, path));
Source::Lock lock(src->mutex());
src->load_model (lock, true);
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_SOURCE
- boost_debug_shared_ptr_mark_interesting (src.get(), "Source");
-#endif
+ BOOST_MARK_SOURCE (src);
if (announce) {
SourceCreated (src);
@@ -336,10 +318,8 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat
(destructive
? Source::Flag (SndFileSource::default_writable_flags | Source::Destructive)
: SndFileSource::default_writable_flags));
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_SOURCE
- boost_debug_shared_ptr_mark_interesting ((void*)src, "Source");
-#endif
boost::shared_ptr<Source> ret (src);
+ BOOST_MARK_SOURCE (ret);
if (setup_peakfile (ret, defer_peaks)) {
return boost::shared_ptr<Source>();
@@ -361,9 +341,7 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat
Source::Lock lock(src->mutex());
src->load_model (lock, true);
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_SOURCE
- boost_debug_shared_ptr_mark_interesting (src.get(), "Source");
-#endif
+ BOOST_MARK_SOURCE (src);
// no analysis data - this is a new file
@@ -388,10 +366,8 @@ SourceFactory::createForRecovery (DataType type, Session& s, const std::string&
if (type == DataType::AUDIO) {
Source* src = new SndFileSource (s, path, chn);
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_SOURCE
- boost_debug_shared_ptr_mark_interesting ((void*)src, "Source");
-#endif
boost::shared_ptr<Source> ret (src);
+ BOOST_MARK_SOURCE (ret);
if (setup_peakfile (ret, false)) {
return boost::shared_ptr<Source>();
diff --git a/libs/ardour/transport_master_manager.cc b/libs/ardour/transport_master_manager.cc
index db3739c7e9..eb39fc2507 100644
--- a/libs/ardour/transport_master_manager.cc
+++ b/libs/ardour/transport_master_manager.cc
@@ -16,17 +16,19 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "pbd/stateful.h"
+
#include "ardour/audioengine.h"
+#include "ardour/boost_debug.h"
#include "ardour/debug.h"
#include "ardour/disk_reader.h"
#include "ardour/session.h"
#include "ardour/rc_configuration.h"
#include "ardour/transport_master_manager.h"
-#include "pbd/boost_debug.cc"
#include "pbd/i18n.h"
-#include "pbd/stateful.h"
+using namespace std;
using namespace ARDOUR;
using namespace PBD;
@@ -356,9 +358,8 @@ TransportMasterManager::add (SyncSource type, std::string const & name, bool rem
return -1;
}
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_TMM
- boost_debug_shared_ptr_mark_interesting (tm.get(), "tm");
-#endif
+ BOOST_MARK_TMM (tm);
+
ret = add_locked (tm);
}
@@ -531,7 +532,7 @@ TransportMasterManager::set_state (XMLNode const & node, int version)
Glib::Threads::RWLock::WriterLock lm (lock);
_current_master.reset ();
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_TMM
+#if 0
boost_debug_list_ptrs ();
#endif
@@ -551,9 +552,7 @@ TransportMasterManager::set_state (XMLNode const & node, int version)
continue;
}
-#if defined BOOST_SP_ENABLE_DEBUG_HOOKS && defined BOOST_DEBUG_TMM
- boost_debug_shared_ptr_mark_interesting (tm.get(), "tm");
-#endif
+ BOOST_MARK_TMM (tm);
if (add_locked (tm)) {
continue;