svn commit: r212964 - head/sys/kern

mdf at FreeBSD.org mdf at FreeBSD.org
Tue Sep 21 15:17:03 UTC 2010


On Tue, Sep 21, 2010 at 8:07 AM, Andriy Gapon <avg at freebsd.org> wrote:
> Author: avg
> Date: Tue Sep 21 15:07:44 2010
> New Revision: 212964
> URL: http://svn.freebsd.org/changeset/base/212964
>
> Log:
>  kdb_backtrace: stack(9)-based code to print backtrace without any backend
>
>  The idea is to add KDB and KDB_TRACE options to GENERIC kernels on
>  stable branches, so that at least the minimal information is produced
>  for non-specific panics like traps on page faults.
>  The GENERICs in stable branches seem to already include STACK option.
>
>  Reviewed by:  attilio
>  MFC after:    2 weeks
>
> Modified:
>  head/sys/kern/subr_kdb.c
>
> Modified: head/sys/kern/subr_kdb.c
> ==============================================================================
> --- head/sys/kern/subr_kdb.c    Tue Sep 21 12:57:43 2010        (r212963)
> +++ head/sys/kern/subr_kdb.c    Tue Sep 21 15:07:44 2010        (r212964)
> @@ -28,6 +28,7 @@
>  __FBSDID("$FreeBSD$");
>
>  #include "opt_kdb.h"
> +#include "opt_stack.h"
>
>  #include <sys/param.h>
>  #include <sys/systm.h>
> @@ -37,6 +38,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 +302,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);

I'd recommend using stack_print_ddb(), as that avoids any locking
which may hang depending on how the kernel panic'd.

Thanks,
matthew

> +       }
> +#endif
>  }
>
>  /*
>


More information about the svn-src-head mailing list