db_print_backtrace_removal.patch

aoiko, 02/05/2009 06:40 PM

Download (10.9 KB)

View differences:

sys/ddb/ddb.h
145 145
#endif
146 146

  
147 147
/*
148
 * Print backtrace. (Machine-Dependant)
149
 */
150
void		db_print_backtrace(void);
151

  
152
/*
153 148
 * Command table.
154 149
 */
155 150
struct command {
sys/dev/acpica5/Osd/OsdSynch.c
355 355
    kfree(Spin, M_ACPISEM);
356 356
}
357 357

  
358
#ifdef ACPI_DEBUG_LOCKS
359
void db_print_backtrace(void);
360
#endif
361 358
/*
362 359
 * OS-dependent locking primitives.  These routines should be able to be
363 360
 * called from an interrupt-handler or cpu_idle thread.
......
379 376
	kprintf("%p(%s:%d): acpi_spinlock %p already held by %p(%s:%d)\n",
380 377
		curthread, func, line, Spin, Spin->owner, Spin->func,
381 378
		Spin->line);
382
	db_print_backtrace();
379
	backtrace();
383 380
    } else {
384 381
	Spin->owner = curthread;
385 382
	Spin->func = func;
......
397 394
	if (Spin->owner != NULL) {
398 395
	    kprintf("%p: acpi_spinlock %p is unexectedly held by %p(%s:%d)\n",
399 396
		    curthread, Spin, Spin->owner, Spin->func, Spin->line);
400
	    db_print_backtrace();
397
	    backtrace();
401 398
	} else
402 399
	    return;
403 400
    }
sys/kern/kern_debug.c
80 80
/*
81 81
 * Simple DDB stack trace funtionality.
82 82
 */
83
#ifndef DDB
83 84
void
84 85
backtrace(void)
85 86
{
86

  
87
#ifdef DDB
88
		kprintf("Stack backtrace:\n");
89
		db_print_backtrace();
90
#else
91 87
		kprintf("Cannot print stack trace.\n");
92 88
		kprintf("DDB kernel option is needed.\n");
93
#endif
94 89
}
90
#endif
sys/kern/kern_shutdown.c
96 96
#include <machine/stdarg.h>
97 97

  
98 98
#ifdef DDB
99
#include <ddb/ddb.h>
99 100
#ifdef DDB_UNATTENDED
100 101
int debugger_on_panic = 0;
101 102
#else
......
104 105
SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, CTLFLAG_RW,
105 106
	&debugger_on_panic, 0, "Run debugger on kernel panic");
106 107

  
107
extern void db_print_backtrace(void);
108

  
109 108
#ifdef DDB_TRACE
110 109
int trace_on_panic = 1;
111 110
#else
......
794 793

  
795 794
#if defined(DDB)
796 795
	if (newpanic && trace_on_panic)
797
		db_print_backtrace();
796
		backtrace();
798 797
	if (debugger_on_panic)
799 798
		Debugger("panic");
800 799
#endif
sys/kern/kern_spinlock.c
32 32
 * $DragonFly: src/sys/kern/kern_spinlock.c,v 1.16 2008/09/11 01:11:42 y0netan1 Exp $
33 33
 */
34 34

  
35
#include "opt_ddb.h"
36

  
37 35
#include <sys/param.h>
38 36
#include <sys/systm.h>
39 37
#include <sys/types.h>
......
43 41
#include <sys/proc.h>
44 42
#endif
45 43
#include <sys/priv.h>
46
#include <ddb/ddb.h>
47 44
#include <machine/atomic.h>
48 45
#include <machine/cpufunc.h>
49 46
#include <machine/specialreg.h>
......
307 304
		kprintf("spin_lock: %p, indefinite wait!\n", bo->mtx);
308 305
		if (panicstr)
309 306
			return (TRUE);
310
#if defined(INVARIANTS) && defined(DDB)
307
#if defined(INVARIANTS)
311 308
		if (spin_lock_test_mode) {
312
			db_print_backtrace();
309
			backtrace();
313 310
			return (TRUE);
314 311
		}
315 312
#endif
316 313
		++bo->nsec;
317
#if defined(INVARIANTS) && defined(DDB)
314
#if defined(INVARIANTS)
318 315
		if (bo->nsec == 11)
319
			db_print_backtrace();
316
			backtrace();
320 317
#endif
321 318
		if (bo->nsec == 60)
322 319
			panic("spin_lock: %p, indefinite wait!\n", bo->mtx);
sys/kern/kern_timeout.c
99 99
 * The per-cpu augmentation was done by Matthew Dillon.
100 100
 */
101 101

  
102
#include "opt_ddb.h"
103

  
104 102
#include <sys/param.h>
105 103
#include <sys/systm.h>
106 104
#include <sys/callout.h>
......
108 106
#include <sys/interrupt.h>
109 107
#include <sys/thread.h>
110 108
#include <sys/thread2.h>
111
#include <ddb/ddb.h>
112 109

  
113 110
#ifndef MAX_SOFTCLOCK_STEPS
114 111
#define MAX_SOFTCLOCK_STEPS 100 /* Maximum allowed value of steps. */
......
360 357
		kprintf(
361 358
		    "callout_reset(%p) from %p: callout was not initialized\n",
362 359
		    c, ((int **)&c)[-1]);
363
#ifdef DDB
364
		db_print_backtrace();
365
#endif
360
		backtrace();
366 361
	}
367 362
#endif
368 363
	gd = mycpu;
......
415 410
		kprintf(
416 411
		    "callout_stop(%p) from %p: callout was not initialized\n",
417 412
		    c, ((int **)&c)[-1]);
418
#ifdef DDB
419
		db_print_backtrace();
420
#endif
413
		backtrace();
421 414
	}
422 415
#endif
423 416
	crit_enter_gd(gd);
sys/kern/lwkt_thread.c
40 40
 * to use a critical section to avoid problems.  Foreign thread 
41 41
 * scheduling is queued via (async) IPIs.
42 42
 */
43
#include "opt_ddb.h"
44 43

  
45 44
#include <sys/param.h>
46 45
#include <sys/systm.h>
......
71 70
#include <machine/stdarg.h>
72 71
#include <machine/smp.h>
73 72

  
74
#ifdef DDB
75
#include <ddb/ddb.h>
76
#endif
77 73

  
78 74
static MALLOC_DEFINE(M_THREAD, "thread", "lwkt threads");
79 75

  
......
501 497
		td->td_flags |= TDF_PANICWARN;
502 498
		kprintf("Warning: thread switch from interrupt or IPI, "
503 499
			"thread %p (%s)\n", td, td->td_comm);
504
#ifdef DDB
505
		db_print_backtrace();
506
#endif
500
		backtrace();
507 501
	    }
508 502
	    lwkt_switch();
509 503
	    gd->gd_intr_nesting_level = savegdnest;
sys/kern/uipc_mbuf.c
69 69
 */
70 70

  
71 71
#include "opt_param.h"
72
#include "opt_ddb.h"
73 72
#include "opt_mbuf_stress_test.h"
74 73
#include <sys/param.h>
75 74
#include <sys/systm.h>
......
890 889
		objcache_put(mclmeta_cache, mcl);
891 890
}
892 891

  
893
extern void db_print_backtrace(void);
894

  
895 892
/*
896 893
 * Free a single mbuf and any associated external storage.  The successor,
897 894
 * if any, is returned.
......
921 918
	KKASSERT(m->m_nextpkt == NULL);
922 919
#else
923 920
	if (m->m_nextpkt != NULL) {
924
#ifdef DDB
925 921
		static int afewtimes = 10;
926 922

  
927 923
		if (afewtimes-- > 0) {
928 924
			kprintf("mfree: m->m_nextpkt != NULL\n");
929
			db_print_backtrace();
925
			backtrace();
930 926
		}
931
#endif
932 927
		m->m_nextpkt = NULL;
933 928
	}
934 929
#endif
sys/platform/pc32/i386/db_trace.c
435 435
}
436 436

  
437 437
void
438
db_print_backtrace(void)
438
backtrace(void)
439 439
{
440 440
	register_t  ebp;
441 441

  
sys/platform/pc32/i386/pmap.c
107 107
#include <machine/pmap.h>
108 108
#include <machine/pmap_inval.h>
109 109

  
110
#include <ddb/ddb.h>
111

  
112 110
#define PMAP_KEEP_PDIRS
113 111
#ifndef PMAP_SHPGPERPROC
114 112
#define PMAP_SHPGPERPROC 200
......
1964 1962
#endif
1965 1963
	if (va < UPT_MAX_ADDRESS && pmap == &kernel_pmap) {
1966 1964
		kprintf("Warning: pmap_enter called on UVA with kernel_pmap\n");
1967
#ifdef DDB
1968
		db_print_backtrace();
1969
#endif
1965
		backtrace();
1970 1966
	}
1971 1967
	if (va >= UPT_MAX_ADDRESS && pmap != &kernel_pmap) {
1972 1968
		kprintf("Warning: pmap_enter called on KVA without kernel_pmap\n");
1973
#ifdef DDB
1974
		db_print_backtrace();
1975
#endif
1969
		backtrace();
1976 1970
	}
1977 1971

  
1978 1972
	/*
......
2127 2121

  
2128 2122
	if (va < UPT_MAX_ADDRESS && pmap == &kernel_pmap) {
2129 2123
		kprintf("Warning: pmap_enter_quick called on UVA with kernel_pmap\n");
2130
#ifdef DDB
2131
		db_print_backtrace();
2132
#endif
2124
		backtrace();
2133 2125
	}
2134 2126
	if (va >= UPT_MAX_ADDRESS && pmap != &kernel_pmap) {
2135 2127
		kprintf("Warning: pmap_enter_quick called on KVA without kernel_pmap\n");
2136
#ifdef DDB
2137
		db_print_backtrace();
2138
#endif
2128
		backtrace();
2139 2129
	}
2140 2130

  
2141 2131
	KKASSERT(va < UPT_MIN_ADDRESS);	/* assert used on user pmaps only */
sys/platform/pc64/amd64/db_trace.c
440 440
}
441 441

  
442 442
void
443
db_print_backtrace(void)
443
backtrace(void)
444 444
{
445 445
	register_t  rbp;
446 446

  
sys/platform/pc64/amd64/pmap.c
109 109
#include <machine/pmap.h>
110 110
#include <machine/pmap_inval.h>
111 111

  
112
#include <ddb/ddb.h>
113

  
114 112
#define PMAP_KEEP_PDIRS
115 113
#ifndef PMAP_SHPGPERPROC
116 114
#define PMAP_SHPGPERPROC 200
......
2081 2079
#endif
2082 2080
	if (va < UPT_MAX_ADDRESS && pmap == &kernel_pmap) {
2083 2081
		kprintf("Warning: pmap_enter called on UVA with kernel_pmap\n");
2084
#ifdef DDB
2085
		db_print_backtrace();
2086
#endif
2082
		backtrace();
2087 2083
	}
2088 2084
	if (va >= UPT_MAX_ADDRESS && pmap != &kernel_pmap) {
2089 2085
		kprintf("Warning: pmap_enter called on KVA without kernel_pmap\n");
2090
#ifdef DDB
2091
		db_print_backtrace();
2092
#endif
2086
		backtrace();
2093 2087
	}
2094 2088

  
2095 2089
	/*
......
2244 2238

  
2245 2239
	if (va < UPT_MAX_ADDRESS && pmap == &kernel_pmap) {
2246 2240
		kprintf("Warning: pmap_enter_quick called on UVA with kernel_pmap\n");
2247
#ifdef DDB
2248
		db_print_backtrace();
2249
#endif
2241
		backtrace();
2250 2242
	}
2251 2243
	if (va >= UPT_MAX_ADDRESS && pmap != &kernel_pmap) {
2252 2244
		kprintf("Warning: pmap_enter_quick called on KVA without kernel_pmap\n");
2253
#ifdef DDB
2254
		db_print_backtrace();
2255
#endif
2245
		backtrace();
2256 2246
	}
2257 2247

  
2258 2248
	KKASSERT(va < UPT_MIN_ADDRESS);	/* assert used on user pmaps only */
sys/platform/vkernel/i386/db_trace.c
386 386
}
387 387

  
388 388
void
389
db_print_backtrace(void)
389
backtrace(void)
390 390
{
391 391
	register_t  ebp;
392 392

  
sys/vm/vm_vmspace.c
33 33
 * 
34 34
 * $DragonFly: src/sys/vm/vm_vmspace.c,v 1.14 2007/08/15 03:15:07 dillon Exp $
35 35
 */
36
#include "opt_ddb.h"
37 36

  
38 37
#include <sys/param.h>
39 38
#include <sys/kernel.h>
......
49 48

  
50 49
#include <vm/vm_extern.h>
51 50
#include <vm/pmap.h>
52
#include <ddb/ddb.h>
53 51

  
54 52
#include <machine/vmparam.h>
55 53

  
......
481 479
		if ((ve = vklp->ve) != NULL) {
482 480
			kprintf("Warning, pid %d killed with "
483 481
				"active VC!\n", lp->lwp_proc->p_pid);
484
#ifdef DDB
485
			db_print_backtrace();
486
#endif
482
			backtrace();
487 483
			pmap_setlwpvm(lp, lp->lwp_proc->p_vmspace);
488 484
			vklp->ve = NULL;
489 485
			KKASSERT(ve->refs > 0);