Method backtrace()


Method backtrace

array(Pike.BacktraceFrame) backtrace(int|void flags)

Description

Get a description of the current call stack.

Parameter flags

A bit mask of flags affecting generation of the backtrace.

Currently a single flag is defined:

1

Return LiveBacktraceFrames. This flag causes the frame objects to track changes (as long as they are in use), and makes eg local variables for functions available for inspection or change.

Note that since these values are "live", they may change or dissapear at any time unless the corresponding thread has been halted or similar.

Returns

The description is returned as an array with one entry for each call frame on the stack.

The entries are represented by Pike.BacktraceFrame objects.

The current call frame will be last in the array.

Note

Please note that the frame order may be reversed in a later version of Pike to accommodate for deferred backtraces.

Note

Note that the arguments reported in the backtrace are the current values of the variables, and not the ones that were at call-time. This can be used to hide sensitive information from backtraces (eg passwords).

Note

In old versions of Pike the entries used to be represented by arrays of the following format:

Array
string file

A string with the filename if known, else zero.

int line

An integer containing the linenumber if known, else zero.

function(:void) fun

The function that was called at this level.

mixed|void ... args

The arguments that the function was called with.

The above format is still supported by eg describe_backtrace().

See also

catch(), throw()