[comp.sys.ti.explorer] Backtrace

snicoud@atc.boeing.com (Stephen Nicoud) (06/06/89)

How can a process get a backtrace of its own stack?

snicoud@ATC.BOEING.COM (Stephen Nicoud) (06/07/89)

   Date: Wed, 7 Jun 89 10:35 EST
   From: Michael Greenberg <GREENBERG@cs.umass.EDU>
   Subject: RE:  Backtrace
   
   I've written some functions to figure out the call
   stack for a function.  If is possible to find out all
   functions and args on the stack.  I only get the functions.
   
   
   (defun call-stack ()
     "Return a list of the functions on the call stack"
     (do* ((fns nil)
   	(sg (process-stack-group w:current-process))
   	(frame (eh:sg-innermost-frame sg)
   	       (eh:sg-next-frame sg frame))
   	function)
          
          ((null frame)
   	(nreverse fns))
       
       (setf function (eh:function-name (eh:rp-function-word (eh:sg-regular-pdl sg) frame)))
       (push function fns)))
   
   
   For more details, you can look at the debugger code.
   
   
   Mike Greenberg
   greenberg@cs.umass.edu

Thanks, this is exactly what I needed.

Steve

gjc@BUCSF.BU.EDU (George J. Carrette) (06/08/89)

You should really switch to a different stack group before
examining the virtual memory of a stack group. i.e. using
functions like EH:SG-NEXT-FRAME.

That is, unless TI has changed how the interaction between
the stack cache and virtual memory works.