堆栈跟踪
Base.StackTraces.StackFrame — TypeStackFrameStack information representing execution context, with the following fields:
func::SymbolThe name of the function containing the execution context.
linfo::Union{Core.MethodInstance, Method, Module, Core.CodeInfo, Nothing}The MethodInstance or CodeInfo containing the execution context (if it could be found), or Module (for macro expansions)"
file::SymbolThe path to the file containing the execution context.
line::IntThe line number in the file containing the execution context.
from_c::BoolTrue if the code is from C.
inlined::BoolTrue if the code is from an inlined frame.
pointer::UInt64Representation of the pointer to the execution context as returned by
backtrace.
Base.StackTraces.StackTrace — TypeStackTraceAn alias for Vector{StackFrame} provided for convenience; returned by calls to stacktrace.
Base.StackTraces.stacktrace — Functionstacktrace([trace::Vector{Ptr{Cvoid}},] [c_funcs::Bool=false]) -> StackTraceReturn a stack trace in the form of a vector of StackFrames. (By default stacktrace doesn't return C functions, but this can be enabled.) When called without specifying a trace, stacktrace first calls backtrace.
Base.StackTraces 中以下方法和类型不会被导出,需要显式调用,例如 StackTraces.lookup(ptr)。
Base.StackTraces.lookup — Functionlookup(pointer::Ptr{Cvoid}) -> Vector{StackFrame}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.
Base.StackTraces.remove_frames! — Functionremove_frames!(stack::StackTrace, name::Symbol)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.
remove_frames!(stack::StackTrace, m::Module)Return the StackTrace with all StackFrames from the provided Module removed.