summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2014-12-02 20:36:14 +0700
committerTim Mayberry <mojofunk@gmail.com>2014-12-03 17:31:05 +0700
commitd360bc3906e9ad3c47a0cfd5f58bbe059ef105a1 (patch)
tree8acc4f396b5fb4a268f0abdea29ebf42d492c825
parent9eb8b73b43806b5d90973f2028beb6322d686295 (diff)
Add ability to set libpbd debug options via PBD_DEBUG environment var
-rw-r--r--libs/pbd/pbd.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/pbd/pbd.cc b/libs/pbd/pbd.cc
index 738a676d4c..145e1b91a8 100644
--- a/libs/pbd/pbd.cc
+++ b/libs/pbd/pbd.cc
@@ -19,6 +19,7 @@
#include <iostream>
#include <cstdlib>
+#include <string>
#ifdef PLATFORM_WINDOWS
#include <fcntl.h>
@@ -43,6 +44,19 @@ static bool libpbd_initialized = false;
}
+void
+set_debug_options_from_env ()
+{
+ bool set;
+ std::string options;
+
+ options = Glib::getenv ("PBD_DEBUG", set);
+ if (set) {
+ std::cerr << "PBD_DEBUG=" << options << std::endl;
+ PBD::parse_debug_options (options.c_str());
+ }
+}
+
bool
PBD::init ()
{
@@ -66,6 +80,8 @@ PBD::init ()
setup_libpbd_enums ();
+ set_debug_options_from_env ();
+
libpbd_initialized = true;
return true;
}