Use the new command file feature of ddb(8) to support setting ddb(4)

scripts at boot.  This is currently disabled by default. /etc/ddb.conf
contains some potentially reasonable default scripts.

PR:		conf/119995
Submitted by:	Scot Hetzel <swhetzel at gmail dot com> (Earlier version)
X-MFC after:	textdumps
This commit is contained in:
Brooks Davis 2008-03-05 18:32:58 +00:00
parent 544b955a47
commit ae2edb2af1
6 changed files with 64 additions and 2 deletions

View File

@ -9,7 +9,7 @@ SUBDIR= sendmail
BIN1= amd.map apmd.conf auth.conf \
crontab csh.cshrc csh.login csh.logout devd.conf devfs.conf \
dhclient.conf disktab fbtab freebsd-update.conf \
ddb.conf dhclient.conf disktab fbtab freebsd-update.conf \
ftpusers gettytab group \
hosts hosts.allow hosts.equiv hosts.lpd \
inetd.conf libalias.conf login.access login.conf mac.conf motd \

15
etc/ddb.conf Normal file
View File

@ -0,0 +1,15 @@
# $FreeBSD$
#
# This file is read when going to multi-user and its contents piped thru
# ``ddb'' to define debugging scripts.
#
# see ``man 4 ddb'' and ``man 8 ddb'' for details.
#
script lockinfo=show locks; show alllocks; show lockedvnods
# kdb.enter.panic panic(9) was called.
script kdb.enter.panic=textdump set; capture on; run lockinfo; show pcpu; bt; ps; alltrace; capture off; call doadump; reset
# kdb.enter.witness witness(4) detected a locking error.
script kdb.enter.witness=run lockinfo

View File

@ -33,6 +33,8 @@ swapfile="NO" # Set to name of swapfile if aux swapfile desired.
apm_enable="NO" # Set to YES to enable APM BIOS functions (or NO).
apmd_enable="NO" # Run apmd to handle APM event from userland.
apmd_flags="" # Flags to apmd (if enabled).
ddb_enable="NO" # Set to YES to load ddb scripts at boot.
ddb_config="/etc/ddb.conf" # ddb(8) config file.
devd_enable="YES" # Run devd, to trigger programs on device tree changes.
devd_flags="" # Additional flags for devd(8).
kldxref_enable="NO" # Build linker.hints files with kldxref(8).

View File

@ -7,7 +7,7 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKING SERVERS \
apm apmd archdep atm1 atm2 atm3 auditd auto_linklocal \
bgfsck bluetooth bootparams bridge bsnmpd bthidd \
ccd cleanvar cleartmp cron \
devd devfs dhclient \
ddb devd devfs dhclient \
dmesg dumpon \
early.sh encswap \
fsck ftp-proxy ftpd \

32
etc/rc.d/ddb Normal file
View File

@ -0,0 +1,32 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: ddb
# REQUIRE: dumpon
# BEFORE: disks savecore initrandom
# KEYWORD: nojail
. /etc/rc.subr
name="ddb"
rcvar=`set_rcvar`
command="/sbin/${name}"
start_precmd="ddb_prestart"
stop_cmd=":"
ddb_prestart()
{
# Silently exit if ddb is not enabled
if [ -z "`sysctl -Nq debug.ddb.scripting.scripts`" ]; then
return 1
fi
}
load_rc_config $name
required_files="${ddb_config}"
command_args="${ddb_config}"
run_rc_command "$1"

View File

@ -164,6 +164,19 @@ daemon.
Run
.Xr devd 8
to handle device added, removed or unknown events from the kernel.
.It Va ddb_enable
.Pq Vt bool
Run
.Xr ddb 8
to install
.Xr ddb 4
scripts at boot time.
.It Va ddb_config
.Pq Vt str
Configuration file for
.Xr ddb 8 .
Default
.Pa /etc/ddb.conf .
.It Va kldxref_enable
.Pq Vt bool
Set to