Re: Stack Overflow Detection



In article <dba53bb3-4682-425b-8bc1-
7c034d2187aa@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, Tomás Ó hÉilidhe says...
On May 30, 3:51 pm, "Richard Phillips" <raphill...@xxxxxxxxxxxx>
wrote:
Hello all,

I'm thinking about implementing the above in a system I'm working on, does
anyone have a good strategy for doing this?
One possibility is having an area of RAM (beyond the stack "area") filled
with known data, if any of that data gets trashed then assume the stack has
overflowed.  What are the pros and cons of this?
Another idea is to actually watch the SP, but one drawback is if I check
this at a predefined point in the code, then it's possible the worst case
scenario will occur between checks?
Any better ideas?


Obviously if the stack overflows then that's a sign of flaw in the
programming,

Or in some systems, HW failures, EMI or radiation events.

so really you're trying to implement a system that
accommodates buggy programming and just peforms a "salvage operation"
by killing the program before it can do any damage... do I understand
correctly?

That's one option. Sometimes runtime stacks are set much larger than
expected need and instrumented like this to verify/determine (to some
statistical significance) the actual stack usage.

Assuming that I'm right in saying that you'll just kill the program if
the stack overflows, what will be the benefit of this? Will it stop
the Green Laser of Death from being turned on, or will it stop
permanent storage from being corrupted or something like that?

Quite possibly all of the above. Or maybe it just irritates the user.
Sometimes resetting is not really an option.

Robert
** Posted from http://www.teranews.com **
.



Relevant Pages

  • Re: C: The Complete Meta-Nonsense
    ... such as telling Schildt not to say that C negatives ... In other words, you don't care about truth, you care only about status. ... But note that even CREATING those bug reports is often programming beyond ... was frightened by a stack when he was in her womb and who hates ...
    (comp.lang.c)
  • Re: Forth Frustrations
    ... I was working on an interface to my new window system in Ficl. ... I found it extremely frustrating to juggle around data on the stack, such as 2 RGBA color components when building a gradient. ... I've been accused of programming C in Forth, as if that's somehow terrible, but I digress... ... I was thinking that indexed keyed arrays might be an approach, or a completely different language. ...
    (comp.lang.forth)
  • Re: Statement on Schildt submitted to wikipedia today
    ... programming, after thirty years, I teach English and creative writing ... but the stack has priority because you can write slow OSen without ... The student does not need to learn to think at either, ... People who didn't read Schildt know that there are different computer ...
    (comp.lang.c.moderated)
  • Re: Is Delphi for Win32 still mainstream?
    ... A MODULAR PROGRAMMING LESSON FOR ALL DELPHI PROGRAMMERS ... There is a little niche community out there that makes use of the stack, not just heap - so that we don't have to create and free every darned thing in the universe. ... I am bringing back stack objects and records into my programming. ... No over engineering. ...
    (borland.public.delphi.non-technical)
  • Re: Thread Stacks
    ... But I cannot lower the stack size for just those threads, ... in several places Joe is calling a library routine. ... so long as parallel programming requires the top level ...
    (comp.arch)