diff --git a/src/add-ons/kernel/file_systems/udf/UdfDebug.cpp b/src/add-ons/kernel/file_systems/udf/UdfDebug.cpp index f934350aeb..e585b7935d 100644 --- a/src/add-ons/kernel/file_systems/udf/UdfDebug.cpp +++ b/src/add-ons/kernel/file_systems/udf/UdfDebug.cpp @@ -304,7 +304,7 @@ private: int fFile; }; -DebugOutputFile out; +DebugOutputFile *out = NULL; /*! \brief It doesn't appear that the constructor for the global \c out variable is called when built as an R5 filesystem add-on, @@ -313,7 +313,16 @@ DebugOutputFile out; */ void initialize_debugger(const char *filename) { - out.Init(filename); +#if DEBUG_TO_FILE + if (!out) { + out = new DebugOutputFile(filename); + dbg_printf("out was NULL!\n"); + } else { + DebugOutputFile *temp = out; + out = new DebugOutputFile(filename); + dbg_printf("out was %p!\n", temp); + } +#endif } // dbg_printf, stolen from Ingo's ReiserFS::Debug.cpp. @@ -321,6 +330,9 @@ void dbg_printf(const char *format,...) { #if DEBUG_TO_FILE + if (!out) + return; + char buffer[1024]; va_list args; va_start(args, format); @@ -332,7 +344,7 @@ dbg_printf(const char *format,...) #endif va_end(args); buffer[sizeof(buffer) - 1] = '\0'; - write(out.File(), buffer, strlen(buffer)); + write(out->File(), buffer, strlen(buffer)); #endif } diff --git a/src/add-ons/kernel/file_systems/udf/UdfDebug.h b/src/add-ons/kernel/file_systems/udf/UdfDebug.h index c9e48472b7..1642657388 100644 --- a/src/add-ons/kernel/file_systems/udf/UdfDebug.h +++ b/src/add-ons/kernel/file_systems/udf/UdfDebug.h @@ -22,7 +22,7 @@ #endif #include -#define DEBUG_TO_FILE 0 +#define DEBUG_TO_FILE 1 #if DEBUG_TO_FILE # include @@ -61,12 +61,17 @@ enum _DebugCategoryFlags { CF_ATTRIBUTE_OPS = 0x00000040, CF_INDEX_OPS = 0x00000080, CF_QUERY_OPS = 0x00000100, + // Misc categories CF_HIGH_VOLUME = 0x00000200, //!< often-called functions CF_HELPER = 0x00000400, //!< helper functions and classes (i.e. Array, CS0String, etc.) CF_DEBUGGING = 0x00000800, //!< internal debugging functions CF_DUMP = 0x00001000, //!< dump() functions + + // Specific entry functions + CF_UDF_READ_FS_STAT = 0x00002000, + CF_UDF_READ = 0x00004000, //------------------------------- @@ -83,6 +88,8 @@ enum _DebugCategoryFlags { \brief Bitmask of currently enabled debugging categories. */ #define CATEGORY_FILTER CF_ALL +//#define CATEGORY_FILTER ~CF_DIRECTORY_OPS & ~CF_HIGH_VOLUME & ~CF_HELPER +//#define CATEGORY_FILTER CF_UDF_READ //#define CATEGORY_FILTER ~CF_DUMP //#define CATEGORY_FILTER ~CF_DUMP & ~CF_HIGH_VOLUME //#define CATEGORY_FILTER CF_ALL_STANDARD