aboutsummaryrefslogtreecommitdiff
path: root/src/include/debug.h
diff options
context:
space:
mode:
authorMichael Brown <mcb30@etherboot.org>2005-03-08 18:53:11 +0000
committerMichael Brown <mcb30@etherboot.org>2005-03-08 18:53:11 +0000
commit3d6123e69ab879c72ff489afc5bf93ef0b7a94ce (patch)
tree9f3277569153a550fa8d81ebd61bd88f266eb8da /src/include/debug.h
downloadipxe-3d6123e69ab879c72ff489afc5bf93ef0b7a94ce.zip
ipxe-3d6123e69ab879c72ff489afc5bf93ef0b7a94ce.tar.gz
ipxe-3d6123e69ab879c72ff489afc5bf93ef0b7a94ce.tar.bz2
Initial revision
Diffstat (limited to 'src/include/debug.h')
-rw-r--r--src/include/debug.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/include/debug.h b/src/include/debug.h
new file mode 100644
index 0000000..bb5d33f
--- /dev/null
+++ b/src/include/debug.h
@@ -0,0 +1,28 @@
+#ifndef DEBUG_H
+#define DEBUG_H
+
+//#include <lib.h>
+extern int last_putchar;
+
+/* Defining DEBUG_THIS before including this file enables debug() macro
+ * for the file. DEBUG_ALL is for global control. */
+
+#if DEBUG_THIS || DEBUG_ALL
+#define DEBUG 1
+#else
+#undef DEBUG
+#endif
+
+#if DEBUG
+# define debug(...) \
+ ((last_putchar=='\n' ? printf("%s: ", __FUNCTION__) : 0), \
+ printf(__VA_ARGS__))
+# define debug_hexdump hexdump
+#else
+# define debug(...) /* nothing */
+# define debug_hexdump(...) /* nothing */
+#endif
+
+#define debugx debug
+
+#endif /* DEBUG_H */