📄 stackwalker.tex
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Name: stackwalker.tex%% Purpose: wxStackWalker documentation%% Author: Vadim Zeitlin%% Created: 2005-01-19%% RCS-ID: $Id: stackwalker.tex,v 1.7 2006/11/12 14:32:37 RR Exp $%% Copyright: (c) 2005 Vadim Zeitlin%% License: wxWindows license%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\section{\class{wxStackWalker}}\label{wxstackwalker}wxStackWalker allows an application to enumerate, or walk, the stack frames (the function callstack).It is mostly useful in only two situations:inside \helpref{wxApp::OnFatalException}{wxapponfatalexception} function toprogrammatically get the location of the crash and, in debug builds, in\helpref{wxApp::OnAssertFailure}{wxapponassertfailure} to report the caller of the failedassert.wxStackWalker works by repeatedly callingthe \helpref{OnStackFrame}{wxstackwalkeronstackframe} method for each frame in thestack, so to use it you must derive your own class from it and override thismethod.This class will not return anything except raw stack frame addresses if thedebug information is not available. Under Win32 this means that the PDB filematching the program being executed should be present. Note that if you useMicrosoft Visual C++ compiler, you can create PDB files even for the programsbuilt in release mode and it doesn't affect the program size (at least if youdon't forget to add \texttt{/opt:ref} option which is suppressed by using\texttt{/debug} linker option by default but should be always enabled forrelease builds). Under Unix, you need to compile your program with debugginginformation (usually using \texttt{-g} compiler and linker options) to get thefile and line numbers information, however function names should be availableeven without it. Of course, all this is only true if you build using a recentenough version of GNU libc which provides the \texttt{backtrace()} functionneeded to walk the stack.\helpref{debugging overview}{debuggingoverview} for how to make it available.\wxheading{Derived from}No base class\wxheading{Include files}<wx/stackwalk.h>Only available if \texttt{wxUSE\_STACKWALKER} is $1$, currently onlyimplemented for Win32 and Unix versions using recent version of GNU libc.\wxheading{See also}\helpref{wxStackFrame}{wxstackframe}\latexignore{\rtfignore{\wxheading{Members}}}\membersection{wxStackWalker::wxStackWalker}\label{wxstackwalkerwxstackwalker}\func{}{wxStackWalker}{\void}Constructor does nothing, use \helpref{Walk()}{wxstackwalkerwalk} to walk thestack.\membersection{wxStackWalker::\destruct{wxStackWalker}}\label{wxstackwalkerdtor}\func{}{\destruct{wxStackWalker}}{\void}Destructor does nothing neither but should be virtual as this class is used asa base one.\membersection{wxStackWalker::OnStackFrame}\label{wxstackwalkeronstackframe}\func{void}{OnStackFrame}{\param{const wxStackFrame\& }{frame}}This function must be overrided to process the given frame.\membersection{wxStackWalker::Walk}\label{wxstackwalkerwalk}\func{void}{Walk}{\param{size\_t }{skip = 1}, \param{size\_t }{maxDepth = 200}}Enumerate stack frames from the current location, skipping the initialnumber of them (this can be useful when Walk() is called from some knownlocation and you don't want to see the first few frames anyhow; alsonotice that Walk() frame itself is not included if skip $\ge 1$).Up to \arg{maxDepth} frames are walked from the innermost to the outermost one.\membersection{wxStackWalker::WalkFromException}\label{wxstackwalkerwalkfromexception}\func{void}{WalkFromException}{\void}Enumerate stack frames from the location of uncaught exception.This method can only be called from\helpref{wxApp::OnFatalException()}{wxapponfatalexception}.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -