13
0

Distinguish Threads and ThreadName debugging

This also allows for -DThread to enable both.

We celebrate the 128th debug bit and look forward to
the next 64!
This commit is contained in:
Robin Gareus 2024-09-28 00:33:27 +02:00
parent c4fdd5356c
commit 8d3ebde60e
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 4 additions and 2 deletions

View File

@ -61,6 +61,7 @@ DebugBits PBD::DEBUG::Configuration = PBD::new_debug_bit ("configuration");
DebugBits PBD::DEBUG::UndoHistory = PBD::new_debug_bit ("undohistory"); DebugBits PBD::DEBUG::UndoHistory = PBD::new_debug_bit ("undohistory");
DebugBits PBD::DEBUG::Timing = PBD::new_debug_bit ("timing"); DebugBits PBD::DEBUG::Timing = PBD::new_debug_bit ("timing");
DebugBits PBD::DEBUG::Threads = PBD::new_debug_bit ("threads"); DebugBits PBD::DEBUG::Threads = PBD::new_debug_bit ("threads");
DebugBits PBD::DEBUG::ThreadName = PBD::new_debug_bit ("threadname");
DebugBits PBD::DEBUG::Locale = PBD::new_debug_bit ("locale"); DebugBits PBD::DEBUG::Locale = PBD::new_debug_bit ("locale");
DebugBits PBD::DEBUG::StringConvert = PBD::new_debug_bit ("stringconvert"); DebugBits PBD::DEBUG::StringConvert = PBD::new_debug_bit ("stringconvert");
DebugBits PBD::DEBUG::DebugTimestamps = PBD::new_debug_bit ("debugtimestamps"); DebugBits PBD::DEBUG::DebugTimestamps = PBD::new_debug_bit ("debugtimestamps");
@ -103,7 +104,7 @@ PBD::new_debug_bit (const char* name)
void void
PBD::debug_only_print (const char* prefix, string str) PBD::debug_only_print (const char* prefix, string str)
{ {
if ((PBD::debug_bits & DEBUG::Threads).any()) { if ((PBD::debug_bits & DEBUG::ThreadName).any()) {
printf ("0x%lx (%s) ", (intptr_t) DEBUG_THREAD_SELF, pthread_name()); printf ("0x%lx (%s) ", (intptr_t) DEBUG_THREAD_SELF, pthread_name());
} }

View File

@ -39,7 +39,7 @@
namespace PBD { namespace PBD {
typedef std::bitset<128> DebugBits; typedef std::bitset<192> DebugBits;
LIBPBD_API extern DebugBits debug_bits; LIBPBD_API extern DebugBits debug_bits;
LIBPBD_API DebugBits new_debug_bit (const char* name); LIBPBD_API DebugBits new_debug_bit (const char* name);
@ -64,6 +64,7 @@ namespace PBD {
LIBPBD_API extern DebugBits UndoHistory; LIBPBD_API extern DebugBits UndoHistory;
LIBPBD_API extern DebugBits Timing; LIBPBD_API extern DebugBits Timing;
LIBPBD_API extern DebugBits Threads; LIBPBD_API extern DebugBits Threads;
LIBPBD_API extern DebugBits ThreadName;
LIBPBD_API extern DebugBits Locale; LIBPBD_API extern DebugBits Locale;
LIBPBD_API extern DebugBits StringConvert; LIBPBD_API extern DebugBits StringConvert;
LIBPBD_API extern DebugBits DebugTimestamps; LIBPBD_API extern DebugBits DebugTimestamps;