KDB_TRACE and no backend

Attilio Rao attilio at freebsd.org
Sat Sep 18 20:35:49 UTC 2010


2010/9/18 Andriy Gapon <avg at freebsd.org>:
> on 18/09/2010 22:00 Andriy Gapon said the following:
>> Oh, wow, and I totally overlooked stack_print().
>> Should have read stack(9) from the start.
>
> New patch.  Hope this is better.
> I don't like that the printf is duplicated, but couldn't figure out a way to
> combine pre-processor and C conditions.
>
> --- a/sys/kern/subr_kdb.c
> +++ b/sys/kern/subr_kdb.c
> @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
>  #include <sys/pcpu.h>
>  #include <sys/proc.h>
>  #include <sys/smp.h>
> +#include <sys/stack.h>
>  #include <sys/sysctl.h>
>
>  #include <machine/kdb.h>
> @@ -300,6 +301,15 @@ kdb_backtrace(void)
>                printf("KDB: stack backtrace:\n");
>                kdb_dbbe->dbbe_trace();
>        }
> +#ifdef STACK
> +       else {
> +               struct stack st;
> +
> +               printf("KDB: stack backtrace:\n");
> +               stack_save(&st);
> +               stack_print(&st);
> +       }
> +#endif
>  }
>
>  /*
>

It is still missing checking on opt_stack.h
Besides, I'd reconsider having KDB_TRACE explanation in ddb(4) manpage
(right now it is rightly there because it is DDB specific only, as
long as it offers the backend, but with your change it is a global
functionality. Not sure if it worths changing it but however you may
have more opinions).

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein


More information about the freebsd-hackers mailing list