Re: Stack Overflow Detection



Tomás Ó hÉilidhe wrote:
On May 30, 4:37 pm, Vladimir Vassilevsky <antispam_bo...@xxxxxxxxxxx>
wrote:


The main problem with it is that you
never know for sure what is the maximum stack usage.



Are you sure about that? Would it not just be a case of determining
how much stack space each of the function's use, and then looking at
the logic of the program to see what could possibly be the deepest
level?

There are static-analysis tools that can do that. Some compilers/linkers do it and there are stand-alone tools like GnatStack, StackAnalyzer from AbsInt, and Bound-T from my company. Of course, these tools are not available for all processors, and may have difficulty with recursion and stack frames of dynamic (run-time-computed) size.

--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .
.



Relevant Pages

  • Re: Stackusage at runtime
    ... Stuart wrote: ... the stack is used for, so your results may not be universally applicable (but I suspect that is not a significant concern). ... Niklas Holsti ...
    (comp.lang.ada)
  • Re: How implement pthread_measure_stack_usage on Linux
    ... that may be adequate to the API caller. ... If I recall how the eCos stack measuring code works, ... untouched pattern. ... Other OSes may be able to tell you what your maximum stack usage roughly ...
    (comp.programming.threads)
  • Re: How implement pthread_measure_stack_usage on Linux
    ... If I recall how the eCos stack measuring code works, ... untouched pattern. ... Other OSes may be able to tell you what your maximum stack usage roughly ...
    (comp.programming.threads)
  • Re: Stack usage
    ... if it is possible to meassure the maximum stack usage of ... > a C program throughout it's entire execution? ... If your platform uses a stack, and as previous posters have mentioned ... Find out which way the stack grows on your architecture. ...
    (comp.lang.c)
  • Re: Stack Overflow Detection
    ... never know for sure what is the maximum stack usage. ... Vendor-supplied library functions could be an issue, ...
    (comp.arch.embedded)