- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a condition where in after running the project for say 30hrs or so the project execution goes wierd. I suspect a stack overflow because , when i do attach to ruuning terget and do step by step execution the program execution is not fine. It is not doing sequential execution of code.
How to find out whether any stack overflow has occured or not and the reasons why stack overflow occurs?
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Easiest thing to do is setting a breakpoint on access near stack top. This will work only if you can connect a miniprog3 to your board.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Being a GNU novice this may be useless, but sounds like it may help
troubleshoot -
http://www.delorie.com/gnu/docs/gcc/gnat_ug_46.html
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gnat_ugn_unw/Run_002dTime-Checks.html
http://en.wikipedia.org/wiki/Buffer_overflow_protection
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Go to debugger (using MiniProg3) and look at the Call stack window to make sure that if the program flow is proper or not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can see in both Call stack and trying to do step by step execution , the way the program jumps from one point to other . What are the reasons for such a behaviour. What can cause my stack overflows - any function returns (because while building the project i saw "all functions do not return a value"), interrupts?????
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nobody suggested to step through your program AFTER a stack-overflow has occured but to look at the stack BEFORE that happens. So the advise to set an access breakpoint near TOS
There are other chances to wreck a program:
Are there ANY warnings after a re-build? Get rid of each of them!
Are you using malloc() and free()? Set the pointer to NIL after a free.
Check each pointer befor usage for vadility.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
While stack overflow could be the problem, It can also be a software bug. and is easiy missed as the program works MOST of the time.
Here is an article that may help
http://www.embedded.com/electronics-blogs/other/4023329/Assert-Yourself
Also, if you can post your project, people here may be able to help as well.