aboutsummaryrefslogtreecommitdiff
path: root/debug.h
diff options
context:
space:
mode:
authorJuan Cespedes <cespedes@debian.org>2003-01-31 18:58:58 +0100
committerJuan Cespedes <cespedes@debian.org>2003-01-31 18:58:58 +0100
commitcac15c3f170b5ec2cc6304c8c0763a78103e1778 (patch)
tree248b244dc9c366275033db39187d1060da81e37b /debug.h
parentde5a7eb873c05a698e4267b554e25124dc92e7f4 (diff)
downloadltrace-cac15c3f170b5ec2cc6304c8c0763a78103e1778.tar.gz
Version 0.3.27
* Removed dependency on libdl (it is no longer needed) * Wrote generic dictionary, used in demangle.c and breakpoints.c * Added debug.c for better debugging output
Diffstat (limited to 'debug.h')
-rw-r--r--debug.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/debug.h b/debug.h
new file mode 100644
index 0000000..90a10e5
--- /dev/null
+++ b/debug.h
@@ -0,0 +1,20 @@
+#include <features.h>
+
+void debug_(int level, char *file, int line, char *func, char *fmt, ...);
+
+# define debug(level, expr...) debug_(level, __FILE__, __LINE__, DEBUG_FUNCTION, expr)
+
+/* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
+ which contains the name of the function currently being defined.
+ This is broken in G++ before version 2.6.
+ C9x has a similar variable called __func__, but prefer the GCC one since
+ it demangles C++ function names. */
+# if __GNUC_PREREQ (2, 4)
+# define DEBUG_FUNCTION __PRETTY_FUNCTION__
+# else
+# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+# define DEBUG_FUNCTION __func__
+# else
+# define DEBUG_FUNCTION ((__const char *) 0)
+# endif
+# endif