kdb: kdb_support: Fix debugging information problem
PATCH 1/1 kdb: kdb_support: Fix debugging information problem
There are several common patterns.
0:
kdb_printf("...",...);which is the normal one.
1:
kdb_printf("%s: "...,__func__,...)We could improve '1' to this :
#define kdb_func_printf(format, args...) \
kdb_printf("%s: " format, __func__, ## args)2:
if(KDB_DEBUG(AR))
kdb_printf("%s "...,__func__,...);We could improve '2' to this :
#define kdb_dbg_printf(mask, format, args...) \
do { \
if (KDB_DEBUG(mask)) \
kdb_func_printf(format, ## args); \
} while (0)In additon, we changed the format code of size_t to %zu.
Signed-off-by Stephen Zhang <[email protected]>
--- kernel/debug/kdb/kdb_private.h | 10 ++++++++ kernel/debug/kdb/kdb_support.c | 56 +++++++++++++++++++----------------------- 2 files changed, 35 insertions(+), 31 deletions(-)
kernel/debug/kdb/kdb_private.h +10 -0
@@ -254,4 +254,14 @@ extern unsigned long kdb_task_state(const struct task_struct *p,#define KDB_WORD_SIZE ((int)sizeof(unsigned long))#endif /* CONFIG_KGDB_KDB */ + +#define kdb_func_printf(format, args...) \ + kdb_printf("%s: " format, __func__, ## args) + +#define kdb_dbg_printf(mask, format, args...) \ + do { \ + if (KDB_DEBUG(mask)) \ + kdb_func_printf(format, ## args); \ + } while (0) +#endif /* !_KDBPRIVATE_H */
kernel/debug/kdb/kdb_support.c +25 -31
140 lines not on this page · raw message
Signature · 1 line
1.8.3.1