How to enable by default the kernel debugger?

Hello,

Alike netbsd and openbsd, I would like to have access to the debugger.

How is it possible in FreeBSD?

Please find herewith a screenshot.

db.png
 
Thank you for the documentation about GDB, DB,...

Concerning the direct db, if I recall well, this feature can be enabled, but only with recompiling the kernel FreeBSD from source.
Hopefully, it can today be made available a bit easier. This is very useful thing, as shown in the above screenshot.

Using a VM, qemu,... is possible but quite cumbersome method.

It would be very doubtful, that FreeBSD hasn't any longer, because it is a common thing in BSD.
Even Linux, with much less features, compared to FreeBSD can have it and be enabled - after kernel build.
 
Depending on the specific problem you are facing: Instead of probably using a sledgehammer to crack a nut, FreeBSD has superb dtrace(1) support which allows for instrumentation of almost every part of the system without the major performance impacts fully enabled debugging would have.
 
Note that the default GENERIC kernel has some debug options enabled by default. But there's certainly a configuration difference between -RELEASE, -STABLE and -CURRENT. -CURRENT has almost everything debug-wise turned up to 11 by default.

Code:
makeoptions	DEBUG=-g		# Build kernel with gdb(1) debug symbols
makeoptions	WITH_CTF=1		# Run ctfconvert(1) for DTrace support

...

# Debugging support.  Always need this:
options 	KDB			# Enable kernel debugger support.
options 	KDB_TRACE		# Print a stack trace for a panic.

# Kernel Sanitizers
#options 	COVERAGE		# Generic kernel coverage. Used by KCOV
#options 	KCOV			# Kernel Coverage Sanitizer
# Warning: KUBSAN can result in a kernel too large for loader to load
#options 	KUBSAN			# Kernel Undefined Behavior Sanitizer
#options 	KCSAN			# Kernel Concurrency Sanitizer

# Kernel dump features.
options 	EKCD			# Support for encrypted kernel dumps
options 	GZIO			# gzip-compressed kernel and user dumps
options 	ZSTDIO			# zstd-compressed kernel and user dumps
options 	DEBUGNET		# debugnet networking
options 	NETDUMP			# netdump(4) client support
options 	NETGDB			# netgdb(4) client support
 
Back
Top