On Mon, Jan 25, 2021 at 09:55:58AM -0800, Doug Anderson wrote:
> On Sat, Jan 23, 2021 at 3:14 AM Stephen Zhang <stephenzhang...@gmail.com> 
> wrote:
> >
> > Better to replace function name by %s in case of changes.
> >
> > Signed-off-by: Stephen Zhang <stephenzhang...@gmail.com>
> > ---
> >  kernel/debug/kdb/kdb_support.c | 32 ++++++++++++++++----------------
> >  1 file changed, 16 insertions(+), 16 deletions(-)
> >
> > diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c
> > index 6226502..7a536fc 100644
> > --- a/kernel/debug/kdb/kdb_support.c
> > +++ b/kernel/debug/kdb/kdb_support.c
> > @@ -40,19 +40,19 @@
> >  int kdbgetsymval(const char *symname, kdb_symtab_t *symtab)
> >  {
> >         if (KDB_DEBUG(AR))
> > -               kdb_printf("kdbgetsymval: symname=%s, symtab=%px\n", 
> > symname,
> > +               kdb_printf("%s: symname=%s, symtab=%px\n", __func__, 
> > symname,
> 
> Given the common pattern:
> 
> if (KDB_DEBUG(AR))
>   kdb_printf(...)
> 
> I wonder if we could improve this to this (untested):
> 
> #define kdb_ardbg_printf(format, ...) \
>   do { \
>     if (KDB_DEBUG(AR)) \
>       kdb_printf("%s: " format, __func__, __VA_ARGS__); \
>   } while (0)
> 
> Then the above just becomes:
> 
> kdb_ardbg_printf("symname=%s, symtab=%px\n", symname,

I'd prefer this to be:

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

That way the other examples of the if (KDB_DEBUG(xxx)) kdb_printf(...)
pattern could adopt the same macro.


Daniel.


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

Reply via email to