Hi,

On Mon, Jan 25, 2021 at 11:55 PM Stephen Zhang
<stephenzhang...@gmail.com> wrote:
>
> Since there are many debugging information with a
> function name,it's better to replace them with %s.
>
> Notice that there are many similar code patterns, so I
> defined two macros. One is kdb_func_printf, which is used
> for debugging information that requires function names.
> As below:
>
> -               kdb_printf("func_name: ...",args);
>
> The other is kdb_ardbg_printf, which adds a conditional
> statement to the former.This is used for:
>
> -               if (KDB_DEBUG(AR))
> -                       kdb_printf("func_name: ...",args);
>
> In addition, I changed the format code of size_t to %zu.
>
> Signed-off-by: Stephen Zhang <stephenzhang...@gmail.com>
> ---
>  kernel/debug/kdb/kdb_support.c | 64 
> ++++++++++++++++++++++--------------------
>  1 file changed, 33 insertions(+), 31 deletions(-)

BTW: can I convince you to CC LKML on your patches?  The
"kgdb-bugreport@lists.sourceforge.net" doesn't get archived in many
places (lore.kernel.org or patchwork) so it makes it hard to find your
emails or refer to previous emails.


> diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c
> index 6226502..d255003 100644
> --- a/kernel/debug/kdb/kdb_support.c
> +++ b/kernel/debug/kdb/kdb_support.c
> @@ -27,6 +27,15 @@
>  #include <linux/slab.h>
>  #include "kdb_private.h"
>
> +#define kdb_func_printf(format, args...) \
> +       kdb_printf("%s: " format, __func__, ##args)
> +
> +#define kdb_ardbg_printf(format, args...) \
> +       do { \
> +               if (KDB_DEBUG(AR)) \
> +                       kdb_func_printf(format, ##args); \
> +       } while (0)

In response to your v1 Daniel said he preferred:

  kdb_dbg_printf(AR, "symname=%s, symtab=%px\n", symname

So I think you'd want this (untested):

#define kdb_dbg_printf(format, mask, args...) \
       do { \
               if (KDB_DEBUG(mask)) \
                       kdb_func_printf(format, ##args); \
       } while (0)

Presumably then we'd want this promoted to "kernel/debug/kdb/kdb_private.h" ?


-Doug


_______________________________________________
Kgdb-bugreport mailing list
Kgdb-bugreport@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to