ASTACKTRACE()

From Lianjapedia
Revision as of 06:43, 23 October 2013 by Yvonne.milne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Purpose

Function to fill a two-dimensional array with current execution stack information

Syntax

ASTACKTRACE("<arrayname>")

See Also

DEBUGOUT, DISPLAY CALLS, DOSERROR(), ERRNO(), ERROR(), LIST CALLS, MESSAGE(), ON ERROR, PROCLINE(), PROCNAME(), RETRY, SET DEBUGOUT, SET ONERROR, STRERROR()

Description

The ASTACKTRACE() function fills a two-dimensional array, <arrayname> with the current execution stack information. Each row in the array will have two elements: the first is the name of the procedure, the second the line number.

Example

proc errorproc
	astacktrace("a_trace")
	display memory
endproc
proc proc1
	proc2()
endproc
proc proc2
	proc3()
endproc
proc proc3
	proc4()
endproc
proc proc4
	messagebox("In proc4")
	crash
endproc
on error errorproc()
proc1()

Run the program:

do doc

Output:

Memory Variables:
------------------------
private(7):
A_TRACE    Fixed array (refcnt 1)
A_TRACE    [1,1] pri( 7)    Character[  9]    'errorproc'
A_TRACE    [1,2] pri( 7)    Numeric  [ 10]    2  (2.000000000)
A_TRACE    [2,1] pri( 7)    Character[  5]    'proc4'
A_TRACE    [2,2] pri( 7)    Numeric  [ 10]    16  (16.000000000)
A_TRACE    [3,1] pri( 7)    Character[  5]    'proc3'
A_TRACE    [3,2] pri( 7)    Numeric  [ 10]    12  (12.000000000)
A_TRACE    [4,1] pri( 7)    Character[  5]    'proc2'
A_TRACE    [4,2] pri( 7)    Numeric  [ 10]    9  (9.000000000)
A_TRACE    [5,1] pri( 7)    Character[  5]    'proc1'
A_TRACE    [5,2] pri( 7)    Numeric  [ 10]    6  (6.000000000)
A_TRACE    [6,1] pri( 7)    Character[  7]    'doc.dbo'
A_TRACE    [6,2] pri( 7)    Numeric  [ 10]    19  (19.000000000)
A_TRACE    [7,1] pri( 7)    Character[  8]    'keyboard'
A_TRACE    [7,2] pri( 7)    Numeric  [ 10]    0  (0.000000000)

** Total of ** 15 variables defined and 1680 bytes used.