Configure VMWare to remotely debug FreeBSD9.2 kernel source code

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.