aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbg.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dbg.h')
-rw-r--r--src/dbg.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/dbg.h b/src/dbg.h
index 28f4118..114b6ca 100644
--- a/src/dbg.h
+++ b/src/dbg.h
@@ -76,10 +76,13 @@ static void disabledbg(void)
close(DEBUG_FD);
}
-#define DPRINTF_D(x) xprintf(DEBUG_FD, #x "=%d [ln %d]\n", x, __LINE__)
-#define DPRINTF_U(x) xprintf(DEBUG_FD, #x "=%u [ln %d]\n", x, __LINE__)
-#define DPRINTF_S(x) xprintf(DEBUG_FD, #x "=%s [ln %d]\n", x, __LINE__)
-#define DPRINTF_P(x) xprintf(DEBUG_FD, #x "=%p [ln %d]\n", x, __LINE__)
+#define STRINGIFY(x) #x
+#define TOSTRING(x) STRINGIFY(x)
+
+#define DPRINTF_D(x) xprintf(DEBUG_FD, "ln " TOSTRING(__LINE__) ": " #x "=%d\n", x, __LINE__)
+#define DPRINTF_U(x) xprintf(DEBUG_FD, "ln " TOSTRING(__LINE__) ": " #x "=%u\n", x)
+#define DPRINTF_S(x) xprintf(DEBUG_FD, "ln " TOSTRING(__LINE__) ": " #x "=%s\n", x)
+#define DPRINTF_P(x) xprintf(DEBUG_FD, "ln " TOSTRING(__LINE__) ": " #x "=%p\n", x)
#else
#define DPRINTF_D(x)
#define DPRINTF_U(x)