Secrets of Linux kernel debugger-Linux general technology-Linux programming and kernel information. The following is a detailed description. KDB Getting Started Guide
It is useful to track kernel execution and view its memory and data structure when debugging kernel problems. The built-in inner-core debugger KDB in Linux provides this function. In this article, you will learn how to use the features provided by KDB and how to install and set KDB on Linux machines. You will also be familiar with the commands that can be used in KDB and the settings and display options.
The Linux kernel debugger (KDB) allows you to debug the Linux kernel. This tool, like its name, is essentially a patch of kernel code, which allows experts to access the kernel memory and data structure. One of the main advantages of KDB is that it does not need to be debugged on another machine: You can debug the running kernel.
It takes some work to set a machine for KDB, because the kernel needs to be patched and re-compiled. KDB users should be familiar with the compilation of the Linux kernel (to a certain extent, they must be familiar with the internal mechanism of the kernel). However, if you need to compile the kernel, see references at the end of this article.
In this article, we will start with information on downloading KDB patches, patching, (re-Compiling) the kernel, and starting KDB. Then we will understand the KDB commands and study some common commands. Finally, we will look at some details about settings and display options.
Getting started
The KDB project is maintained by Silicon Graphics (see references for links). You need to download patches related to the kernel version from its FTP site. (When writing this article) the latest available KDB version is 4.2. You will need to download and apply two patches.
One is a "public" patch that includes changes to the general kernel code, and the other is a system-specific patch. The patch can be obtained as an bz2 file. For example, on an x86 machine running the 2.4.20 kernel, you need kdb-v4.2-2.4.20-common-1.bz2 and kdb-v4.2-2.4.20-i386-1.bz2.
All examples provided here are for the i386 architecture and the 2.4.20 kernel. You will need to make appropriate changes based on your machine and kernel version. You also need the root permission to perform these operations.
Copy the file to the/usr/src/linux directory and extract the patch file from the file compressed with bzip2:
# Bzip2-d kdb-v4.2-2.4.20-common-1.bz2
# Bzip2-d kdb-v4.2-2.4.20-i386-1.bz2
You will get kdb-v4.2-2.4.20-common-1 and kdb-v4.2-2.4-i386-1 files.
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