lpb@cs.bham.ac.uk (Luc Beaudoin) writes:
> Date: Sun, 22 Nov 1992 14:41:57 GMT
>
> Does anyone out there have tools for detecting the source of user stack
> overflow (I take "stack overflow" to mean having unintended items on the
> stack)? (I'm not looking for a piece of hardware that video records the
> programmer, the real culprit :).)Particularly useful would be a utility
> which, for every item currently on the stack, keeps track of which
> procedure left the item there. Given such a utility, one could ask it
> who is responsible for the Nth item on the stack.
The only thing I can think of is to sysunprotect("sysPUSH") (and
"sysPUSHQ") then redefine them so that if pop_stack_debugging is non
false then the new version, after calling the old version, plants a
call of a procedure that you could define (e.g. sys_pusher_of (??))
that stores information about the item on top of the stack and the
current caller, obtained either at run time using caller(0), or at
compile time by using the name of the procedure being compiled. The
latter would probably be best.
There may already be a global variable holding the name of the
procedure currently being defined. If not redefine sysPROCEDURE so
that it saves its first argument in an accessible global.
None of this will give you access to stack pushes produced by system
procedures.
Aaron
--
Aaron Sloman, School of Computer Science,
The University of Birmingham, B15 2TT, England
EMAIL A.Sloman@cs.bham.ac.uk OR A.Sloman@bham.ac.uk
Phone: +44-(0)21-414-3711 Fax: +44-(0)21-414-4281
|