/****************** * Kernel debugging technology ********************/ (1) Some debugging-related configuration options in the kernel source code The kernel configuration options include some options related to kernel debugging, all concentrated in the "kernel hacking" menu. include: Makes additional debugging options available and should be checked; it does not by itself turn on all debugging features. For detailed description of debugging options, please refer to the driver manual or view it through the help description of menuconfig. (2) How to globally control printk debugging statements through macros By cooperating with Makefile, we can define our own debugging statements in the c file. (3) Use of strace strace can trace all system calls issued by user space programs. Useful parameters are:
Strace is very useful for discovering subtle errors in system calls, especially for multi-process programs. You can get a lot of useful information through the return value and process pid output by strace. like: (4) Use of ltrace ltrace can trace all dynamic library function calls issued by user space programs. Useful parameters are:
(5) Check oops message Oops is the kernel's most common way of notifying the user that something unfortunate has happened. Normally, after sending an oops, the kernel is left in an unstable state. In some cases, an oops can cause a kernel panic, which results in a system crash. These situations may include:
If the oops occurs while another process is running, the kernel will kill that process and try to continue running. Oops can occur for many reasons, including memory access out of bounds or illegal instructions. The most important information contained in oops is the register context and the call trace, which can cause oops artificially, such as: if(bad_thing) BUG(); //or BUG_ON(bad_thing); You can use panic() to cause more serious errors. Calling panic() will not only print an error message, but also suspend the entire system. Only use in extremely dire circumstances: if(terrible_thing) panic("foo is %ld!\n", foo); Sometimes, just printing the stack information can help with testing, such as dump_stack(): if(!debug_check){ printk(KERNEL_DEBUG "provide some info\n"); dump_stack(); } Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links You may also be interested in:
|
<<: Detailed explanation of the idea of implementing password display and hiding function in Vue
>>: More than 100 lines of code to implement react drag hooks
Preface Before we start explaining the principle ...
background I want to check the webpack version, b...
Table of contents Since Vuex uses a single state ...
In this article, we will need to learn how to vie...
Docker installation Install dependency packages s...
When I switched my primary operating system from ...
Last year, the open letter was a huge hit, even a...
Table of contents Basic concepts of components Th...
Table of contents Oracle Isolation Levels MySQL I...
question In LINUX, periodic tasks are usually han...
This article example shares the specific code of ...
Table of contents 1. Introduce cases 2. View the ...
Preface Under the influence of some CSS interacti...
Table of contents Workaround Why can't I moni...
Image tag : <img> To insert an image into a ...