To learn the FreeBSD kernel source code, it is difficult to start without a source code-level debugging environment, so record the configuration steps:
######################################## #
# First configure VMWare for the debugging machine, and then copy one:
Choose VM> Clone.
Select the default From current state and click Next.
Select Create a full clone and click Next
Virtual Machine name: enter target and run the cloned Machine command as the target Machine.
######################################## #
Add a serial port for each of the two virtual machines in the "Output to named pipe" mode, where:
Select "this end is the client", "the other end is a virtual machine"
Select "this end is the server" as the target machine, "the other end is a virtual machine"
Note: The two pipe names must be the same, and the following Connect at power on and Yield CPU on poll are selected.
######################################## #
# Compile the kernel. Refer to <compile the FreeBSD debug kernel> to copy the kernel. debug file to the target machine.
# Put It In The/boot/kernel/directory and name the old file kernel as kernel. old.
# Name kernel. debug as kernel and use the following command to remove the debugging symbol:
Strip-x kernel
######################################## #
# Edit the/boot/device. hints file of the target machine and find the line corresponding to serial port 0.
# Add the 0x80 flag to it (the old version is SiO2, and now it is uart). The modified line is as follows (0x80 | 0x10 = 0x90 ):
Hint. uart.0.flags = "0x90"
######################################## #
# Run cd on the debugging machine to the directory of kernel. debug. Enter:
Kgdb-r/dev/cuau0 kernel. debug
######################################## #
# Restart the target machine and select "Escape to loader prompt" from the Startup menu. The following content is displayed:
Type '? 'For a list of commands, 'help' for more detailed help.
OK
# Input:
Boot-d
The following content is displayed:
GDB: debug ports: uart
GDB: current port: uart
KDB: debugger backends: ddb gdb
KDB: current backend: ddb
KDB: enter: Boot flags requested debugger
[Thread pid 0 tid 0]
Stopped at kdb_enter + 0x3b: movq $0, 0xaf0133 (% rip)
Db>
# Input:
Gdb
Configuration complete!
A simple tutorial on Rsync synchronization on FreeBSD 8
FreeBSD8.2 system installation Salt
Create FreeBSD system custom installation ISO
FreeBSD builds NAT and configures multiple VLANs on a single Nic
This article permanently updates the link address: