git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34149 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-11-20 08:14:03 +00:00
parent 9136af73da
commit 2425ac35d9
@@ -82,7 +82,8 @@ void dbg_printf_end();
// Short overview over the debug output macros: // Short overview over the debug output macros:
// PRINT() // PRINT()
// is for general messages that very unlikely should appear in a release build // is for general messages that very unlikely should appear in a release
// build
// FATAL() // FATAL()
// this is for fatal messages, when something has really gone wrong // this is for fatal messages, when something has really gone wrong
// INFORM() // INFORM()
@@ -96,14 +97,47 @@ void dbg_printf_end();
#define DEBUG_THREAD find_thread(NULL) #define DEBUG_THREAD find_thread(NULL)
#define DEBUG_CONTEXT(x) { dbg_printf_begin(); __out(DEBUG_APP " [%Ld: %5ld] ", system_time(), DEBUG_THREAD); x; dbg_printf_end(); } #define DEBUG_CONTEXT(x) \
#define DEBUG_CONTEXT_FUNCTION(prefix, x) { dbg_printf_begin(); __out(DEBUG_APP " [%Ld: %5ld] %s" prefix, system_time(), DEBUG_THREAD, __PRETTY_FUNCTION__); x; dbg_printf_end(); } { \
#define DEBUG_CONTEXT_LINE(x) { dbg_printf_begin(); __out(DEBUG_APP " [%Ld: %5ld] %s:%d: ", system_time(), DEBUG_THREAD, __PRETTY_FUNCTION__, __LINE__); x; dbg_printf_end(); } dbg_printf_begin(); \
__out(DEBUG_APP " [%Ld: %5ld] ", system_time(), DEBUG_THREAD); \
x; \
dbg_printf_end(); \
}
#define DEBUG_CONTEXT_FUNCTION(prefix, x) \
{ \
dbg_printf_begin(); \
__out(DEBUG_APP " [%Ld: %5ld] %s" prefix, system_time(), DEBUG_THREAD, \
__PRETTY_FUNCTION__); \
x; \
dbg_printf_end(); \
}
#define DEBUG_CONTEXT_LINE(x) \
{ \
dbg_printf_begin(); \
__out(DEBUG_APP " [%Ld: %5ld] %s:%d: ", system_time(), DEBUG_THREAD, \
__PRETTY_FUNCTION__, __LINE__); \
x; \
dbg_printf_end(); \
}
#define TPRINT(x...) DEBUG_CONTEXT( __out(x) ) #define TPRINT(x...) DEBUG_CONTEXT( __out(x) )
#define TREPORT_ERROR(status) DEBUG_CONTEXT_LINE( __out("%s\n", strerror(status)) ) #define TREPORT_ERROR(status) \
#define TRETURN_ERROR(err) { status_t _status = err; if (_status < B_OK) TREPORT_ERROR(_status); return _status;} DEBUG_CONTEXT_LINE( __out("%s\n", strerror(status)) )
#define TSET_ERROR(var, err) { status_t _status = err; if (_status < B_OK) TREPORT_ERROR(_status); var = _status; } #define TRETURN_ERROR(err) \
{ \
status_t _status = err; \
if (_status < B_OK) \
TREPORT_ERROR(_status); \
return _status; \
}
#define TSET_ERROR(var, err) \
{ \
status_t _status = err; \
if (_status < B_OK) \
TREPORT_ERROR(_status); \
var = _status; \
}
#define TFUNCTION(x...) DEBUG_CONTEXT_FUNCTION( ": ", __out(x) ) #define TFUNCTION(x...) DEBUG_CONTEXT_FUNCTION( ": ", __out(x) )
#define TFUNCTION_START() DEBUG_CONTEXT_FUNCTION( "\n", ) #define TFUNCTION_START() DEBUG_CONTEXT_FUNCTION( "\n", )
#define TFUNCTION_END() DEBUG_CONTEXT_FUNCTION( " done\n", ) #define TFUNCTION_END() DEBUG_CONTEXT_FUNCTION( " done\n", )