Add file, line nb. and function to debug error
authorDavid Goulet <david.goulet@polymtl.ca>
Thu, 26 May 2011 18:45:40 +0000 (14:45 -0400)
committerDavid Goulet <david.goulet@polymtl.ca>
Thu, 26 May 2011 18:47:59 +0000 (14:47 -0400)
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
include/lttngerr.h

index 1feb6cc4ded1ba9ad9e7fb7a04db46cb43790449..2ba5b32b219f9c4d1066bfbeeced6bb419a6f6c1 100644 (file)
 #include <errno.h>
 #include <stdio.h>
 
+/* Stringify the expansion of a define */
+#define XSTR(d) STR(d)
+#define STR(s) #s
+
 extern int opt_quiet;
 extern int opt_verbose;
 
@@ -54,6 +58,6 @@ enum __lttng_print_type {
 #define ERR(fmt, args...) __lttng_print(PRINT_ERR, "Error: " fmt "\n", ## args)
 #define WARN(fmt, args...) __lttng_print(PRINT_WARN, "Warning: " fmt "\n", ## args)
 #define BUG(fmt, args...) __lttng_print(PRINT_BUG, "BUG: " fmt "\n", ## args)
-#define DBG(fmt, args...) __lttng_print(PRINT_DBG, "DEBUG: " fmt "\n", ## args)
+#define DBG(fmt, args...) __lttng_print(PRINT_DBG, "DEBUG: " fmt " [in %s() at " __FILE__ ":" XSTR(__LINE__) "]\n", ## args, __func__)
 
 #endif /* _LTTNGERR_H */
This page took 0.025005 seconds and 4 git commands to generate.