From 7c4cdf629b4d12ffc7ff25cb00bddc23c53d163a Mon Sep 17 00:00:00 2001 From: Kris Van Hees Date: Wed, 23 Jan 2013 04:42:32 -0500 Subject: [PATCH] Add basic development debugging framework. This patch adds some defines that can be used to provide debugging output in support of development. This is debugging output that is controlled at build time rather than runtime. For production builds, this will always be disabled. Signed-off-by: Kris Van Hees --- dtrace/dtrace.h | 2 ++ dtrace/dtrace_debug.h | 55 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 dtrace/dtrace_debug.h diff --git a/dtrace/dtrace.h b/dtrace/dtrace.h index b9cb4f296053..2c4ee746904c 100644 --- a/dtrace/dtrace.h +++ b/dtrace/dtrace.h @@ -16,6 +16,8 @@ #include #include +#include "dtrace_debug.h" + #define UINT8_MAX (0xff) #define UINT8_MIN 0 #define UINT16_MAX (0xffff) diff --git a/dtrace/dtrace_debug.h b/dtrace/dtrace_debug.h new file mode 100644 index 000000000000..9040494e1cd2 --- /dev/null +++ b/dtrace/dtrace_debug.h @@ -0,0 +1,55 @@ +#ifndef _DTRACE_DEBUG_H_ +#define _DTRACE_DEBUG_H_ + +#ifdef CONFIG_DT_DEBUG + +# undef DT_DBG_AGG +# undef DT_DBG_BUF +# define DT_DBG_DOF +# define DT_DBG_IOCTL +# undef DT_DBG_PROBE + +#else /* CONFIG_DT_DEBUG */ + +# undef DT_DBG_AGG +# undef DT_DBG_BUF +# undef DT_DBG_DOF +# undef DT_DBG_IOCTL +# undef DT_DBG_PROBE + +#endif /* CONFIG_DT_DEBUG */ + +/* + * Here are the actual actions for the various debug cases. + */ +#ifdef DT_DBG_AGG +# define dt_dbg_agg(fmt, ...) pr_info(fmt, ## __VA_ARGS__) +#else +# define dt_dbg_agg(fmt, ...) +#endif + +#ifdef DT_DBG_BUF +# define dt_dbg_buf(fmt, ...) pr_info(fmt, ## __VA_ARGS__) +#else +# define dt_dbg_buf(fmt, ...) +#endif + +#ifdef DT_DBG_DOF +# define dt_dbg_dof(fmt, ...) pr_info(fmt, ## __VA_ARGS__) +#else +# define dt_dbg_dof(fmt, ...) +#endif + +#ifdef DT_DBG_IOCTL +# define dt_dbg_ioctl(fmt, ...) pr_info(fmt, ## __VA_ARGS__) +#else +# define dt_dbg_ioctl(fmt, ...) +#endif + +#ifdef DT_DBG_PROBE +# define dt_dbg_probe(fmt, ...) pr_info(fmt, ## __VA_ARGS__) +#else +# define dt_dbg_probe(fmt, ...) +#endif + +#endif /* _DTRACE_DEBUG_H_ */ -- 2.50.1