Site Tools


software:freebsd:kernel_debug

FreeBSD kernel debug

Опции и параметры необходимые для получения coredump ядра.
Актуально для FreeBSD 11, 12, 13

Конфиг ядра

Должен содержать:

options		GZIO			#m zlib I/O stream support. Enables support for compressed core dumps.

# Debugging support. Always need this:
makeoptions	DEBUG=-g		# Build kernel with gdb(1) debug symbols
options		HWPMC_HOOKS		#oD Necessary kernel hooks for hwpmc(4)
options		KDB			#oD Enable kernel debugger support, rquied for DDB, GDB. Little or no performance overhead.
options		KDB_TRACE		#oD Set debug.trace_on_panic=1 - Print a stack trace for a panic.
options		KDB_UNATTENDED		#oD Set debug.debugger_on_panic=0 - reboot.
options		KTRACE			#oD ktrace(1) support
options		STACK			#oD stack(9) support
options		PANIC_REBOOT_WAIT_TIME=16 #o Set the amount of time (in seconds) the system will wait before rebooting automatically when a kernel panic occurs. (-1) = inf

Настройки системы

/etc/rc.conf

# Debug
dumpdev="AUTO"			# Device to crashdump to (device name, AUTO, or NO).
dumpon_flags="-z"		# Options to pass to dumpon(8), followed by dumpdev.
savecore_enable="YES"		# Extract core from dump devices if any
savecore_flags="-z -v -m 16"	# Used if dumpdev is enabled above, and present.
crashinfo_enable="YES"		# Automatically generate crash dump summary.

/etc/sysctl.conf

# Debug kernel
debug.minidump=1			# Enable mini crash dumps
kern.sync_on_panic=0			# Do a sync before rebooting from a panic / 0 - required for coredump write
kern.panic_reboot_wait_time=16		# Seconds to wait before rebooting after a panic
kern.kerneldump_gzlevel=3		# Kernel crash dump compression level

/etc/src.conf

WITH_KERNEL_SYMBOLS=
# Set to not install kernel symbol files.

Либо файл /etc/src.conf должен отсутствовать, либо в нём не должно быть WITHOUT_KERNEL_SYMBOLS=

/etc/fstab

Вариант с шифрованным swap:

/dev/gptid/0714a812-b98e-11e8-a831-7085c2375722.eli none	swap	sw,late,ealgo=AES-XTS,keylen=256,sectorsize=4096	0	0

Обычный swap:

/dev/ada1p1		none					swap	sw						0	0
software/freebsd/kernel_debug.txt · Last modified: 2022/02/06 12:42 by root