.. module:: StackTraces

.. _stdlib-stacktraces:

*************
 StackTraces
*************

.. currentmodule:: Base

.. data:: StackFrame

   .. Docstring generated from Julia source

   Stack information representing execution context, with the following fields:

   * ``func::Symbol``

     The name of the function containing the execution context.
   * ``linfo::Nullable{LambdaInfo}``

     The LambdaInfo containing the execution context (if it could be found).
   * ``file::Symbol``

     The path to the file containing the execution context.
   * ``line::Int``

     The line number in the file containing the execution context.
   * ``from_c::Bool``

     True if the code is from C.
   * ``inlined::Bool``

     True if the code is from an inlined frame.
   * ``pointer::Int64``

     Representation of the pointer to the execution context as returned by ``backtrace``\ .

.. data:: StackTrace

   .. Docstring generated from Julia source

   An alias for ``Vector{StackFrame}`` provided for convenience; returned by calls to ``stacktrace`` and ``catch_stacktrace``\ .

.. function:: stacktrace([trace::Vector{Ptr{Void}},] [c_funcs::Bool=false]) -> StackTrace

   .. Docstring generated from Julia source

   Returns a stack trace in the form of a vector of ``StackFrame``\ s. (By default stacktrace doesn't return C functions, but this can be enabled.) When called without specifying a trace, ``stacktrace`` first calls ``backtrace``\ .

.. function:: catch_stacktrace([c_funcs::Bool=false]) -> StackTrace

   .. Docstring generated from Julia source

   Returns the stack trace for the most recent error thrown, rather than the current execution context.

.. currentmodule:: Base.StackTraces

The following methods and types in :mod:`Base.StackTraces` are not exported and need to be called e.g. as ``StackTraces.lookup(ptr)``.

.. function:: lookup(pointer::Union{Ptr{Void}, UInt}) -> Vector{StackFrame}

   .. Docstring generated from Julia source

   Given a pointer to an execution context (usually generated by a call to ``backtrace``\ ), looks up stack frame context information. Returns an array of frame information for all functions inlined at that point, innermost function first.

.. function:: remove_frames!(stack::StackTrace, name::Symbol)

   .. Docstring generated from Julia source

   Takes a ``StackTrace`` (a vector of ``StackFrames``\ ) and a function name (a ``Symbol``\ ) and removes the ``StackFrame`` specified by the function name from the ``StackTrace`` (also removing all frames above the specified function). Primarily used to remove ``StackTraces`` functions from the ``StackTrace`` prior to returning it.

