/****************** * 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
It is very common to highlight images on a page. ...
Ubuntu 18.04 installs mysql 5.7 for your referenc...
Refer to the official document http://dev.mysql.c...
Detailed explanation of tinyMCE usage initializat...
1.17.9 More delicious, really Nginx download addr...
Standalone hbase, let’s talk about it first. Inst...
JDK download address: http://www.oracle.com/techn...
The following functions are implemented: 1. Usern...
Querying the database SELECT * FROM `student` Que...
This article example shares the specific code of ...
Table of contents definition grammar Examples 1. ...
Table of contents 1. Install vue-video-player 2. ...
Since this is my first post, if there are any mis...
This article shares the specific code of jQuery t...
The reason is that this type of web page originate...