| |||||
Technical Support Support Resources
Product Information | ARM: DETECT OVERWRITES ON LOCAL VARIABLESInformation in this article applies to:
QUESTIONI have a Problem in my application: a local variable gets overwritten. How can I analyze the reason for this error. The simplified code looks as shown below:
func1 () {
int var; // this variable is in R6
:
func2 (); // after call of func2 var is destroyed
:
}
I have analyzed func2 () and all registers are correctly saved by a PUSH instruction:
STMDB R13!,{R4-R7,R14}
Even the end of func2 () looks OK and uses the corresponding POP instruction:
LDMIA R13!,{R4-R7,PC}
The function func2 () is pretty complex and calls several other functions. It looks to me as the stack area gets overwritten during function execution. Is there a way to track this problem? ANSWERYes, the µVision Debugger supports access breakpoints with the simulator and the ULINK USB JTAG Adapter. You may use this feature to set a breakpoint at the memory address that saves the content or R6. This can be done by the following procedure:
Note: when you are working with ULINK you can only set a single access breakpoint. Due to ARM Embedded ICE restrictions it is not possible to set other breakpoints in Flash. MORE INFORMATION
Last Reviewed: Tuesday, December 12, 2006 | ||||
| |||||