From Embedded Systems Firmware Demystified

Stack Trace

The stack trace exception handler is probably the most useful tool in the firmware developer s bag of tricks. The stack trace allows the developer to view the function nesting whenever the program is stopped at a breakpoint. Because the stack trace gives an instant view of the calling history, a stack trace can save gobs of debug and analysis time.

Stack trace capability is usually considered something that is only offered by a high-level debug environment. This doesn t have to be the case. Having implemented stack trace for a few different CPUs, I can tell you that implementing stack trace is a pain in the neck; once it works, however, you just can t live without it.

The monitor-based stack trace I discuss in this chapter extracts symbol information from the symbol table file, as have other commands. The stack trace, though, requires that the symbols be sorted in ascending address order. I also limit the monitor-based stack trace to provide function nesting only.

I limit the stack trace to function nesting because deciphering variables in the stack is a bit more complicated. Think about it for a minute: return addresses must be easy to find because the hardware must use a return address every time it returns from a function call. On the other hand, finding a variable within the stack isn t a hardware function it s part of the virtual machine fabricated by the compiler. In fact, different compilers for the same CPU can use different conventions...

Copyright Lucent Technologies 2002 under license agreement with Books24x7

Products & Services
Trace Line Heaters
Trace line heaters are flexible, insulated cables that are heated with electricity or re-circulated fluids. They are used to prevent liquids in pipes from freezing, or to reduce heat loss in piping. 
Combustion Analyzers
Combustion analyzers and flue gas analyzers measure the gas content of emissions in order to monitor the combustion efficiency of fuel-burning equipment.
Stack Lights and Machine Lights
Stack lights and machine lights are used for alarm and machine status indication. They can be supplied with audible alarms and be used as flashers or steady light configurations.
Air Strippers
Air strippers are used to remove volatile organic compounds (VOCs), ammonia, hydrogen sulfide, and other contaminants from groundwater and wastewater.
Hot Mirrors and Cold Mirrors
Hot mirrors and cold mirrors are Dichroic filters that have a sharp transition between rejecting and transmitting at the near-infrared-visible area of the spectrum.

Topics of Interest

Testing for Stack Overflow Programs use two different kinds of variables: static (or global) and stack variables. Static variables are assigned a fixed address. Regardless of what functions execute,...

Breakpoints A breakpoint provides the ability to tell the application that at a particular address or event, control is to be turned over to some other authority (in this case, the...

Introduction The Cortex-M3 processor comes with a number of debugging components used to provide debugging features such as breakpoint, watchpoint, Flash patch, and trace. If you are an application...

Abbreviation Meaning ADK AMBA Design Kit AHB Advanced High-Performance Bus AHB-AP AHB Access Port AMBA Advanced Microcontroller Bus Architecture...

Debugging Features Overview The Cortex-M3 processor provides a comprehensive debugging environment. Based on the nature of operations, the debugging features can be classified into two groups:...