c - Debugging memory issues ARM7 -


i having issues trying debug appear strange behaviors. example, have:

static const char* log_format = "0x%02x,%.5f,"; 

and pointer changes no obvious reason. garbage, other constant strings (or part of) defined elsewhere in code. see code jump different section should not running (state variable appears change without being asked to). there 2 or 3 common failure modes, , appear happen @ random. relatively large code base , adding or removing sections changes failure behavior (or removes completely) though sections never referenced.

the best theory @ moment is memory related issue have been on of recent changes fine tooth comb, , simple act of inserting sections of code move things around appears change or remove behavior.

what best ways debugging issue or similar issues? have found debugger useful @ times, , not @ others (but user error).

further notes. arm7, using keil µvision 4 , armcc v4.1 compiler.

this means have pointer bugs/memory corruption somewhere in program... caused lot of different things.

the easiest way spot run program until start of main, add "write" breakpoints variable. should directly point out offending code.

one cause stack overflow, stack placed @ bad memory location, upon overflow starts overwrite .data or .bss. see this article.

you can debug stack overflows setting stack memory known value @ start-up (such 0xaa), let program run while, try expose many use-cases possible, break , check memory of stack, see how deep down know values still preserved. if close end of stack, have stack overflow.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -