X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=libs%2Fpbd%2Fdebug.cc;h=049ac9efa7748beb334a288170dcbe39e4b66e9d;hb=6e017eff224209935eed67ade6f60c504cb0a01c;hp=0c9119d002c0550e7d131e53959437820d7ff9ab;hpb=76a0c823caab700725fe8318d1a4c4e33f067847;p=ardour.git diff --git a/libs/pbd/debug.cc b/libs/pbd/debug.cc index 0c9119d002..049ac9efa7 100644 --- a/libs/pbd/debug.cc +++ b/libs/pbd/debug.cc @@ -28,7 +28,7 @@ #include "pbd/debug.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; using PBD::DebugBits; @@ -56,6 +56,8 @@ DebugBits PBD::DEBUG::Configuration = PBD::new_debug_bit ("configuration"); DebugBits PBD::DEBUG::UndoHistory = PBD::new_debug_bit ("undohistory"); DebugBits PBD::DEBUG::Timing = PBD::new_debug_bit ("timing"); DebugBits PBD::DEBUG::Threads = PBD::new_debug_bit ("threads"); +DebugBits PBD::DEBUG::Locale = PBD::new_debug_bit ("locale"); +DebugBits PBD::DEBUG::StringConvert = PBD::new_debug_bit ("stringconvert"); /* These are debug bits that are used by backends. Since these are loaded dynamically, after command-line parsing, defining them in code that is part of the backend @@ -74,16 +76,28 @@ DebugBits PBD::debug_bits; DebugBits PBD::new_debug_bit (const char* name) { - DebugBits ret; - ret.set (_debug_bit++, 1); - _debug_bit_map().insert (make_pair (name, ret)); + DebugBits ret; + DebugMap::iterator i =_debug_bit_map().find (name); + + if (i != _debug_bit_map().end()) { + return i->second; + } + + if (_debug_bit >= debug_bits.size()) { + cerr << "Too many debug bits defined, offender was " << name << endl; + abort (); + /*NOTREACHED*/ + } + + ret.set (_debug_bit++, 1); + _debug_bit_map().insert (make_pair (name, ret)); return ret; } void PBD::debug_print (const char* prefix, string str) { - cerr << prefix << ": " << str; + cout << prefix << ": " << str; } int @@ -111,13 +125,13 @@ PBD::parse_debug_options (const char* str) if (strncasecmp (cstr, i->first, strlen (cstr)) == 0) { bits |= i->second; - cerr << i->first << " set ... debug bits now set to " << bits << " using " << i->second << endl; + cout << i->first << " set ... debug bits now set to " << bits << " using " << i->second << endl; } } } - + debug_bits = bits; - + return 0; } @@ -125,7 +139,7 @@ void PBD::list_debug_options () { cout << _("The following debug options are available. Separate multiple options with commas.\nNames are case-insensitive and can be abbreviated.") << endl << endl; - cout << '\t' << X_("all") << endl; + cout << '\t' << X_("all") << endl; vector options;