NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

Enabling Stack Dumping in Linux Kernel

From Texas Instruments Wiki
Jump to: navigation, search

Purpose[edit]

It can often be useful when debugging the kernel to be able to print the stack (and call trace) in the Linux kernel. While you could force a kernel panic to make this happen that is often less than desirable. Instead you would want to use the dump_stack() function which will give you a call trace. This function is not enabled in the default kernel and must be enabled. This article will cover how to enable and use the dump_stack() function.

Enabling in Kernel Config[edit]

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.

  1. Kernel hacking -> Kernel debugging
  2. 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()[edit]

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.

Conclusion[edit]

This is a useful way to print out the stack while leaving the kernel unharmed.

Archived[edit]

Sitara Linux SDK 08.00.00.00

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Enabling Stack Dumping in Linux Kernel here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Enabling Stack Dumping in Linux Kernel here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article Enabling Stack Dumping in Linux Kernel here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article Enabling Stack Dumping in Linux Kernel here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Enabling Stack Dumping in Linux Kernel here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Enabling Stack Dumping in Linux Kernel here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Enabling Stack Dumping in Linux Kernel here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article Enabling Stack Dumping in Linux Kernel here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Enabling Stack Dumping in Linux Kernel here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity