mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 07:47:50 +00:00
dyndbg: add source filename to prefix
Printing the line number without the file is of limited usefulness.
Knowing the filename also makes it also easier to relate the logged
information to the controlfile.
Example:
# modprobe test_dynamic_debug
# echo 'file test_dynamic_debug.c =pfsl' > /proc/dynamic_debug/control
# echo 1 > /sys/module/test_dynamic_debug/parameters/do_prints
# dmesg | tail -2
[ 71.802212] do_cats:lib/test_dynamic_debug.c:103: test_dd: doing categories
[ 71.802227] do_levels:lib/test_dynamic_debug.c:123: test_dd: doing levels
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Jim Cromie <jim.cromie@gmail.com>
Acked-by: Jason Baron <jbaron@akamai.com>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/20230709-dyndbg-filename-v2-3-fd83beef0925@weissschuh.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
3bdaf73905
commit
31ed379b7c
@@ -92,6 +92,7 @@ static const struct { unsigned flag:8; char opt_char; } opt_array[] = {
|
||||
{ _DPRINTK_FLAGS_PRINT, 'p' },
|
||||
{ _DPRINTK_FLAGS_INCL_MODNAME, 'm' },
|
||||
{ _DPRINTK_FLAGS_INCL_FUNCNAME, 'f' },
|
||||
{ _DPRINTK_FLAGS_INCL_SOURCENAME, 's' },
|
||||
{ _DPRINTK_FLAGS_INCL_LINENO, 'l' },
|
||||
{ _DPRINTK_FLAGS_INCL_TID, 't' },
|
||||
{ _DPRINTK_FLAGS_NONE, '_' },
|
||||
@@ -836,6 +837,9 @@ static char *__dynamic_emit_prefix(const struct _ddebug *desc, char *buf)
|
||||
if (desc->flags & _DPRINTK_FLAGS_INCL_FUNCNAME)
|
||||
pos += snprintf(buf + pos, remaining(pos), "%s:",
|
||||
desc->function);
|
||||
if (desc->flags & _DPRINTK_FLAGS_INCL_SOURCENAME)
|
||||
pos += snprintf(buf + pos, remaining(pos), "%s:",
|
||||
trim_prefix(desc->filename));
|
||||
if (desc->flags & _DPRINTK_FLAGS_INCL_LINENO)
|
||||
pos += snprintf(buf + pos, remaining(pos), "%d:",
|
||||
desc->lineno);
|
||||
|
||||
Reference in New Issue
Block a user