Pyrogenesis  trunk
wdbg_sym.h
Go to the documentation of this file.
1 /* Copyright (c) 2010 Wildfire Games
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining
4  * a copy of this software and associated documentation files (the
5  * "Software"), to deal in the Software without restriction, including
6  * without limitation the rights to use, copy, modify, merge, publish,
7  * distribute, sublicense, and/or sell copies of the Software, and to
8  * permit persons to whom the Software is furnished to do so, subject to
9  * the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 /*
24  * Win32 stack trace and symbol engine.
25  */
26 
27 #ifndef INCLUDED_WDBG_SYM
28 #define INCLUDED_WDBG_SYM
29 
30 #include "lib/sysdep/os/win/win.h" // CONTEXT, EXCEPTION_POINTERS
31 
32 struct _tagSTACKFRAME64;
33 
34 /**
35  * called for each stack frame found by wdbg_sym_WalkStack.
36  *
37  * @param frame the dbghelp stack frame (we can't just pass the
38  * instruction-pointer because dump_frame_cb needs the frame pointer to
39  * locate frame-relative variables)
40  * @param cbData the user-specified value that was passed to wdbg_sym_WalkStack
41  * @return Status (see RETURN_STATUS_FROM_CALLBACK).
42  **/
43 typedef Status (*StackFrameCallback)(const _tagSTACKFRAME64* frame, uintptr_t cbData);
44 
45 /**
46  * Iterate over a call stack, invoking a callback for each frame encountered.
47  *
48  * @param cb
49  * @param cbData
50  * @param context Processor context from which to start (taken from
51  * an exception record or debug_CaptureContext).
52  * @param lastFuncToSkip
53  *
54  * @note It is safe to use ENSURE/debug_warn/WARN_RETURN_STATUS_IF_ERR even during a
55  * stack trace (which is triggered by ENSURE et al. in app code) because
56  * nested stack traces are ignored and only the error is displayed.
57  **/
58 LIB_API Status wdbg_sym_WalkStack(StackFrameCallback cb, uintptr_t cbData, CONTEXT& context, const wchar_t* lastFuncToSkip = 0);
59 
60 LIB_API void wdbg_sym_WriteMinidump(EXCEPTION_POINTERS* ep);
61 
62 #endif // #ifndef INCLUDED_WDBG_SYM
LIB_API void wdbg_sym_WriteMinidump(EXCEPTION_POINTERS *ep)
Definition: wdbg_sym.cpp:1755
i64 Status
Error handling system.
Definition: status.h:171
LIB_API Status wdbg_sym_WalkStack(StackFrameCallback cb, uintptr_t cbData, CONTEXT &context, const wchar_t *lastFuncToSkip=0)
Iterate over a call stack, invoking a callback for each frame encountered.
Definition: wdbg_sym.cpp:311
Status(* StackFrameCallback)(const _tagSTACKFRAME64 *frame, uintptr_t cbData)
called for each stack frame found by wdbg_sym_WalkStack.
Definition: wdbg_sym.h:43