As we know, if we want to know a special function and who will call it.
One of way is to use “cscope” to static analysis.
The following step is how we do it:
Enabling Stack Dumping in Linux Kernel
Enabling in Kernel Config
To enable the dump_stack() function in the kernel config the following options must be set. You can use make menuconfig or make xconfig to do this.
Kernel hacking -> Kernel debugging
Kernel hacking -> Verbose kernel error messages
Enabling these two options will change the dump_stack() function from a do nothing function to dumping the stack.
You need to rebuild your Linux kernel image after enabling these options.
Using dump_stack()
Using the dump_stack() function is as easy as calling dump_stack() wherever you wish to print out the stack. This will cause a stack trace to be printed at that point.