summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_debug.h
diff options
context:
space:
mode:
authorJakob Bornecrantz <wallbraker@gmail.com>2011-01-23 21:28:44 +0100
committerJakob Bornecrantz <wallbraker@gmail.com>2011-01-24 03:37:57 +0100
commitb7d2919e8e079f2ba77741a6b3f9d038b17cc799 (patch)
tree5e6b4e75fd13c84d0423b8b8b48653fe4473e9d5 /src/gallium/auxiliary/util/u_debug.h
parenta82408c3537afe09e40b3ee6b3a6cb1acc62f715 (diff)
util: Add function logger helpers
Diffstat (limited to 'src/gallium/auxiliary/util/u_debug.h')
-rw-r--r--src/gallium/auxiliary/util/u_debug.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
index 1c9624ea3e..c47c13c64c 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -280,6 +280,43 @@ debug_dump_flags(const struct debug_named_value *names,
/**
+ * Function enter exit loggers
+ */
+#ifdef DEBUG
+int debug_funclog_enter(const char* f, const int line, const char* file);
+void debug_funclog_exit(const char* f, const int line, const char* file);
+void debug_funclog_enter_exit(const char* f, const int line, const char* file);
+
+#define DEBUG_FUNCLOG_ENTER() \
+ int __debug_decleration_work_around = \
+ debug_funclog_enter(__FUNCTION__, __LINE__, __FILE__)
+#define DEBUG_FUNCLOG_EXIT() \
+ do { \
+ (void)__debug_decleration_work_around; \
+ debug_funclog_exit(__FUNCTION__, __LINE__, __FILE__); \
+ return; \
+ } while(0)
+#define DEBUG_FUNCLOG_EXIT_RET(ret) \
+ do { \
+ (void)__debug_decleration_work_around; \
+ debug_funclog_exit(__FUNCTION__, __LINE__, __FILE__); \
+ return ret; \
+ } while(0)
+#define DEBUG_FUNCLOG_ENTER_EXIT() \
+ debug_funclog_enter_exit(__FUNCTION__, __LINE__, __FILE__)
+
+#else
+#define DEBUG_FUNCLOG_ENTER() \
+ int __debug_decleration_work_around
+#define DEBUG_FUNCLOG_EXIT() \
+ do { (void)__debug_decleration_work_around; return; } while(0)
+#define DEBUG_FUNCLOG_EXIT_RET(ret) \
+ do { (void)__debug_decleration_work_around; return ret; } while(0)
+#define DEBUG_FUNCLOG_ENTER_EXIT()
+#endif
+
+
+/**
* Get option.
*
* It is an alias for getenv on Linux.