kill db_print_backtrace()
authorAggelos Economopoulos <aoiko@cc.ece.ntua.gr>
Thu, 5 Feb 2009 22:27:34 +0000 (00:27 +0200)
committerAggelos Economopoulos <aoiko@cc.ece.ntua.gr>
Thu, 5 Feb 2009 22:27:34 +0000 (00:27 +0200)
Use print_backtrace() which is always available. Remove
a bunch of #ifdef DDB and #include <ddb/ddb.h> lines.

17 files changed:
sys/ddb/ddb.h
sys/dev/acpica5/Osd/OsdSynch.c
sys/kern/kern_debug.c
sys/kern/kern_shutdown.c
sys/kern/kern_spinlock.c
sys/kern/kern_timeout.c
sys/kern/lwkt_thread.c
sys/kern/uipc_mbuf.c
sys/net/route.c
sys/netinet/ip_output.c
sys/platform/pc32/i386/db_trace.c
sys/platform/pc32/i386/pmap.c
sys/platform/pc64/amd64/db_trace.c
sys/platform/pc64/amd64/pmap.c
sys/platform/vkernel/i386/db_trace.c
sys/sys/systm.h
sys/vm/vm_vmspace.c

index 7b7063e..fbd9630 100644 (file)
@@ -144,11 +144,6 @@ db_cmdfcn_t        ipc_port_print;
 db_cmdfcn_t    vm_page_print;
 #endif
 
-/*
- * Print backtrace. (Machine-Dependant)
- */
-void           db_print_backtrace(void);
-
 /*
  * Command table.
  */
index c307be9..39c9300 100644 (file)
@@ -355,9 +355,6 @@ AcpiOsDeleteLock (ACPI_SPINLOCK Spin)
     kfree(Spin, M_ACPISEM);
 }
 
-#ifdef ACPI_DEBUG_LOCKS
-void db_print_backtrace(void);
-#endif
 /*
  * OS-dependent locking primitives.  These routines should be able to be
  * called from an interrupt-handler or cpu_idle thread.
@@ -379,7 +376,7 @@ AcpiOsAcquireLock (ACPI_SPINLOCK Spin)
        kprintf("%p(%s:%d): acpi_spinlock %p already held by %p(%s:%d)\n",
                curthread, func, line, Spin, Spin->owner, Spin->func,
                Spin->line);
-       db_print_backtrace();
+       print_backtrace();
     } else {
        Spin->owner = curthread;
        Spin->func = func;
@@ -397,7 +394,7 @@ AcpiOsReleaseLock (ACPI_SPINLOCK Spin, UINT32 Flags)
        if (Spin->owner != NULL) {
            kprintf("%p: acpi_spinlock %p is unexectedly held by %p(%s:%d)\n",
                    curthread, Spin, Spin->owner, Spin->func, Spin->line);
-           db_print_backtrace();
+           print_backtrace();
        } else
            return;
     }
index 18be479..bb6115f 100644 (file)
 /*
  * Simple DDB stack trace funtionality.
  */
+#ifndef DDB
 void
-backtrace(void)
+print_backtrace(void)
 {
-
-#ifdef DDB
-               kprintf("Stack backtrace:\n");
-               db_print_backtrace();
-#else
                kprintf("Cannot print stack trace.\n");
                kprintf("DDB kernel option is needed.\n");
-#endif
 }
+#endif
index 015c8e1..2e87eb7 100644 (file)
@@ -96,6 +96,7 @@
 #include <machine/stdarg.h>
 
 #ifdef DDB
+#include <ddb/ddb.h>
 #ifdef DDB_UNATTENDED
 int debugger_on_panic = 0;
 #else
@@ -104,8 +105,6 @@ int debugger_on_panic = 1;
 SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, CTLFLAG_RW,
        &debugger_on_panic, 0, "Run debugger on kernel panic");
 
-extern void db_print_backtrace(void);
-
 #ifdef DDB_TRACE
 int trace_on_panic = 1;
 #else
@@ -794,7 +793,7 @@ panic(const char *fmt, ...)
 
 #if defined(DDB)
        if (newpanic && trace_on_panic)
-               db_print_backtrace();
+               print_backtrace();
        if (debugger_on_panic)
                Debugger("panic");
 #endif
index d1f31b8..11026bf 100644 (file)
@@ -32,8 +32,6 @@
  * $DragonFly: src/sys/kern/kern_spinlock.c,v 1.16 2008/09/11 01:11:42 y0netan1 Exp $
  */
 
-#include "opt_ddb.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/types.h>
@@ -43,7 +41,6 @@
 #include <sys/proc.h>
 #endif
 #include <sys/priv.h>
-#include <ddb/ddb.h>
 #include <machine/atomic.h>
 #include <machine/cpufunc.h>
 #include <machine/specialreg.h>
@@ -307,16 +304,16 @@ exponential_backoff(struct exponential_backoff *bo)
                kprintf("spin_lock: %p, indefinite wait!\n", bo->mtx);
                if (panicstr)
                        return (TRUE);
-#if defined(INVARIANTS) && defined(DDB)
+#if defined(INVARIANTS)
                if (spin_lock_test_mode) {
-                       db_print_backtrace();
+                       print_backtrace();
                        return (TRUE);
                }
 #endif
                ++bo->nsec;
-#if defined(INVARIANTS) && defined(DDB)
+#if defined(INVARIANTS)
                if (bo->nsec == 11)
-                       db_print_backtrace();
+                       print_backtrace();
 #endif
                if (bo->nsec == 60)
                        panic("spin_lock: %p, indefinite wait!\n", bo->mtx);
index 5f833d2..91ebfae 100644 (file)
@@ -99,8 +99,6 @@
  * The per-cpu augmentation was done by Matthew Dillon.
  */
 
-#include "opt_ddb.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/callout.h>
 #include <sys/interrupt.h>
 #include <sys/thread.h>
 #include <sys/thread2.h>
-#include <ddb/ddb.h>
 
 #ifndef MAX_SOFTCLOCK_STEPS
 #define MAX_SOFTCLOCK_STEPS 100 /* Maximum allowed value of steps. */
@@ -360,9 +357,7 @@ callout_reset(struct callout *c, int to_ticks, void (*ftn)(void *),
                kprintf(
                    "callout_reset(%p) from %p: callout was not initialized\n",
                    c, ((int **)&c)[-1]);
-#ifdef DDB
-               db_print_backtrace();
-#endif
+               print_backtrace();
        }
 #endif
        gd = mycpu;
@@ -415,9 +410,7 @@ callout_stop(struct callout *c)
                kprintf(
                    "callout_stop(%p) from %p: callout was not initialized\n",
                    c, ((int **)&c)[-1]);
-#ifdef DDB
-               db_print_backtrace();
-#endif
+               print_backtrace();
        }
 #endif
        crit_enter_gd(gd);
index a1ce259..dde44a9 100644 (file)
@@ -40,7 +40,6 @@
  * to use a critical section to avoid problems.  Foreign thread 
  * scheduling is queued via (async) IPIs.
  */
-#include "opt_ddb.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -71,9 +70,6 @@
 #include <machine/stdarg.h>
 #include <machine/smp.h>
 
-#ifdef DDB
-#include <ddb/ddb.h>
-#endif
 
 static MALLOC_DEFINE(M_THREAD, "thread", "lwkt threads");
 
@@ -501,9 +497,7 @@ lwkt_switch(void)
                td->td_flags |= TDF_PANICWARN;
                kprintf("Warning: thread switch from interrupt or IPI, "
                        "thread %p (%s)\n", td, td->td_comm);
-#ifdef DDB
-               db_print_backtrace();
-#endif
+               print_backtrace();
            }
            lwkt_switch();
            gd->gd_intr_nesting_level = savegdnest;
index 560f01c..02129a6 100644 (file)
@@ -69,7 +69,6 @@
  */
 
 #include "opt_param.h"
-#include "opt_ddb.h"
 #include "opt_mbuf_stress_test.h"
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -890,8 +889,6 @@ m_mclfree(void *arg)
                objcache_put(mclmeta_cache, mcl);
 }
 
-extern void db_print_backtrace(void);
-
 /*
  * Free a single mbuf and any associated external storage.  The successor,
  * if any, is returned.
@@ -921,14 +918,12 @@ m_free(struct mbuf *m)
        KKASSERT(m->m_nextpkt == NULL);
 #else
        if (m->m_nextpkt != NULL) {
-#ifdef DDB
                static int afewtimes = 10;
 
                if (afewtimes-- > 0) {
                        kprintf("mfree: m->m_nextpkt != NULL\n");
-                       db_print_backtrace();
+                       print_backtrace();
                }
-#endif
                m->m_nextpkt = NULL;
        }
 #endif
index f03c68c..76fd5ff 100644 (file)
@@ -380,7 +380,7 @@ rtfree_remote(struct rtentry *rt, int allow_panic)
        } else {
                kprintf("rt remote free rt_cpuid %d, mycpuid %d\n",
                        rt->rt_cpuid, mycpuid);
-               backtrace();
+               print_backtrace();
        }
 
        netmsg_init(&nmsg, &curthread->td_msgport, 0, rtfree_remote_dispatch);
@@ -1391,7 +1391,7 @@ rt_addrinfo_print(int cmd, struct rt_addrinfo *rti)
 
 #ifdef ROUTE_DEBUG
        if (cmd == RTM_DELETE && route_debug > 1)
-               backtrace();
+               print_backtrace();
 #endif
 
        switch(cmd) {
index b8b82e2..9004ec9 100644 (file)
@@ -227,7 +227,7 @@ ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro,
                                kprintf("ip_output: "
                                        "rt rt_cpuid %d accessed on cpu %d\n",
                                        ro->ro_rt->rt_cpuid, mycpuid);
-                               backtrace();
+                               print_backtrace();
                        }
                }
 
index f1ed532..7f5c367 100644 (file)
@@ -435,7 +435,7 @@ db_stack_trace_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count,
 }
 
 void
-db_print_backtrace(void)
+print_backtrace(void)
 {
        register_t  ebp;
 
index 2102002..11d8f3b 100644 (file)
 #include <machine/pmap.h>
 #include <machine/pmap_inval.h>
 
-#include <ddb/ddb.h>
-
 #define PMAP_KEEP_PDIRS
 #ifndef PMAP_SHPGPERPROC
 #define PMAP_SHPGPERPROC 200
@@ -1964,15 +1962,11 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
 #endif
        if (va < UPT_MAX_ADDRESS && pmap == &kernel_pmap) {
                kprintf("Warning: pmap_enter called on UVA with kernel_pmap\n");
-#ifdef DDB
-               db_print_backtrace();
-#endif
+               print_backtrace();
        }
        if (va >= UPT_MAX_ADDRESS && pmap != &kernel_pmap) {
                kprintf("Warning: pmap_enter called on KVA without kernel_pmap\n");
-#ifdef DDB
-               db_print_backtrace();
-#endif
+               print_backtrace();
        }
 
        /*
@@ -2127,15 +2121,11 @@ pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m)
 
        if (va < UPT_MAX_ADDRESS && pmap == &kernel_pmap) {
                kprintf("Warning: pmap_enter_quick called on UVA with kernel_pmap\n");
-#ifdef DDB
-               db_print_backtrace();
-#endif
+               print_backtrace();
        }
        if (va >= UPT_MAX_ADDRESS && pmap != &kernel_pmap) {
                kprintf("Warning: pmap_enter_quick called on KVA without kernel_pmap\n");
-#ifdef DDB
-               db_print_backtrace();
-#endif
+               print_backtrace();
        }
 
        KKASSERT(va < UPT_MIN_ADDRESS); /* assert used on user pmaps only */
index d1077f2..2c38d71 100644 (file)
@@ -440,7 +440,7 @@ db_stack_trace_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count,
 }
 
 void
-db_print_backtrace(void)
+print_backtrace(void)
 {
        register_t  rbp;
 
index 3e5637f..f5691bd 100644 (file)
 #include <machine/pmap.h>
 #include <machine/pmap_inval.h>
 
-#include <ddb/ddb.h>
-
 #define PMAP_KEEP_PDIRS
 #ifndef PMAP_SHPGPERPROC
 #define PMAP_SHPGPERPROC 200
@@ -2081,15 +2079,11 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
 #endif
        if (va < UPT_MAX_ADDRESS && pmap == &kernel_pmap) {
                kprintf("Warning: pmap_enter called on UVA with kernel_pmap\n");
-#ifdef DDB
-               db_print_backtrace();
-#endif
+               print_backtrace();
        }
        if (va >= UPT_MAX_ADDRESS && pmap != &kernel_pmap) {
                kprintf("Warning: pmap_enter called on KVA without kernel_pmap\n");
-#ifdef DDB
-               db_print_backtrace();
-#endif
+               print_backtrace();
        }
 
        /*
@@ -2244,15 +2238,11 @@ pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m)
 
        if (va < UPT_MAX_ADDRESS && pmap == &kernel_pmap) {
                kprintf("Warning: pmap_enter_quick called on UVA with kernel_pmap\n");
-#ifdef DDB
-               db_print_backtrace();
-#endif
+               print_backtrace();
        }
        if (va >= UPT_MAX_ADDRESS && pmap != &kernel_pmap) {
                kprintf("Warning: pmap_enter_quick called on KVA without kernel_pmap\n");
-#ifdef DDB
-               db_print_backtrace();
-#endif
+               print_backtrace();
        }
 
        KKASSERT(va < UPT_MIN_ADDRESS); /* assert used on user pmaps only */
index 6954fb0..706a43e 100644 (file)
@@ -386,7 +386,7 @@ db_stack_trace_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count,
 }
 
 void
-db_print_backtrace(void)
+print_backtrace(void)
 {
        register_t  ebp;
 
index 1c27ef2..508b0b2 100644 (file)
@@ -139,7 +139,7 @@ struct savetls;
 struct krate;
 
 void   Debugger (const char *msg);
-void   backtrace(void);
+void   print_backtrace(void);
 void   mi_gdinit (struct globaldata *gd, int cpu);
 void   mi_proc0init(struct globaldata *gd, struct user *proc0paddr);
 int    dumpstatus (vm_offset_t addr, off_t count);
index 2414ff9..e4988de 100644 (file)
@@ -33,7 +33,6 @@
  * 
  * $DragonFly: src/sys/vm/vm_vmspace.c,v 1.14 2007/08/15 03:15:07 dillon Exp $
  */
-#include "opt_ddb.h"
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -49,7 +48,6 @@
 
 #include <vm/vm_extern.h>
 #include <vm/pmap.h>
-#include <ddb/ddb.h>
 
 #include <machine/vmparam.h>
 
@@ -481,9 +479,7 @@ vkernel_lwp_exit(struct lwp *lp)
                if ((ve = vklp->ve) != NULL) {
                        kprintf("Warning, pid %d killed with "
                                "active VC!\n", lp->lwp_proc->p_pid);
-#ifdef DDB
-                       db_print_backtrace();
-#endif
+                       print_backtrace();
                        pmap_setlwpvm(lp, lp->lwp_proc->p_vmspace);
                        vklp->ve = NULL;
                        KKASSERT(ve->refs > 0);