diff options
author | Jakob Bornecrantz <[email protected]> | 2011-01-23 21:28:44 +0100 |
---|---|---|
committer | Jakob Bornecrantz <[email protected]> | 2011-01-24 03:37:57 +0100 |
commit | b7d2919e8e079f2ba77741a6b3f9d038b17cc799 (patch) | |
tree | 5e6b4e75fd13c84d0423b8b8b48653fe4473e9d5 /src/gallium/auxiliary/util/u_debug.c | |
parent | a82408c3537afe09e40b3ee6b3a6cb1acc62f715 (diff) |
util: Add function logger helpers
Diffstat (limited to 'src/gallium/auxiliary/util/u_debug.c')
-rw-r--r-- | src/gallium/auxiliary/util/u_debug.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index f4ad545bee7..59b76136ad1 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -359,6 +359,41 @@ const char *u_prim_name( unsigned prim ) +#ifdef DEBUG +int fl_indent = 0; +const char* fl_function[1024]; + +int debug_funclog_enter(const char* f, const int line, const char* file) +{ + int i; + + for (i = 0; i < fl_indent; i++) + debug_printf(" "); + debug_printf("%s\n", f); + + assert(fl_indent < 1023); + fl_function[fl_indent++] = f; + + return 0; +} + +void debug_funclog_exit(const char* f, const int line, const char* file) +{ + --fl_indent; + assert(fl_indent >= 0); + assert(fl_function[fl_indent] == f); +} + +void debug_funclog_enter_exit(const char* f, const int line, const char* file) +{ + int i; + for (i = 0; i < fl_indent; i++) + debug_printf(" "); + debug_printf("%s\n", f); +} +#endif + + #ifdef DEBUG /** |