{"id":183,"date":"2016-01-21T06:58:58","date_gmt":"2016-01-21T06:58:58","guid":{"rendered":"http:\/\/emacslisp.com\/?p=183"},"modified":"2016-01-21T09:47:44","modified_gmt":"2016-01-21T09:47:44","slug":"linux-kernel-analysis-enable-linux-kernel-stack-dumping","status":"publish","type":"post","link":"http:\/\/emacslisp.com\/?p=183","title":{"rendered":"Linux Kernel Analysis: Enable Linux Kernel Stack Dumping"},"content":{"rendered":"<p>As we know, if we want to know a special function and who will call it.<br \/>\nOne of way is to use &#8220;cscope&#8221; to static analysis.<\/p>\n<p>The following step is how we do it:<\/p>\n<p><strong>Enabling Stack Dumping in Linux Kernel<\/strong><br \/>\nEnabling in Kernel Config<br \/>\nTo 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.<\/p>\n<p><strong>Kernel hacking -> Kernel debugging<br \/>\nKernel hacking -> Verbose kernel error messages<\/strong><br \/>\n<a href=\"http:\/\/emacslisp.com\/wp-content\/uploads\/2016\/01\/1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/emacslisp.com\/wp-content\/uploads\/2016\/01\/1.jpg\" alt=\"1\" width=\"773\" height=\"471\" class=\"alignnone size-full wp-image-185\" \/><\/a><\/p>\n<p>Enabling these two options will change the dump_stack() function from a do nothing function to dumping the stack.<\/p>\n<p>You need to rebuild your Linux kernel image after enabling these options.<\/p>\n<p><strong>Using dump_stack()<\/strong><br \/>\nUsing 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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As we know, if we want to know a special function and who will call it. One of way is to use &#8220;cscope&#8221; 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-183","post","type-post","status-publish","format-standard","hentry","category-linux-kernel-analysis"],"_links":{"self":[{"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/posts\/183","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/emacslisp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=183"}],"version-history":[{"count":2,"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/posts\/183\/revisions"}],"predecessor-version":[{"id":186,"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/posts\/183\/revisions\/186"}],"wp:attachment":[{"href":"http:\/\/emacslisp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=183"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/emacslisp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=183"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/emacslisp.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}