source: trunk/third/firefox/xpcom/base/nsStackFrameWin.h @ 21695

Revision 21695, 4.4 KB checked in by rbasch, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r21694, which included commits to RCS files with non-trunk default branches.
Line 
1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * The contents of this file are subject to the Mozilla Public
4 * License Version 1.1 (the "License"); you may not use this file
5 * except in compliance with the License. You may obtain a copy of
6 * the License at http://www.mozilla.org/MPL/
7 *
8 * Software distributed under the License is distributed on an "AS
9 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10 * implied. See the License for the specific language governing
11 * rights and limitations under the License.
12 *
13 * The Original Code is nsStackFrameWin.h code, released
14 * December 20, 2000.
15 *
16 * The Initial Developer of the Original Code is Netscape
17 * Communications Corporation.  Portions created by Netscape are
18 * Copyright (C) 2000 Netscape Communications Corporation. All
19 * Rights Reserved.
20 *
21 * Contributor(s):
22 *    Michael Judge, 20-December-2000
23 *
24 * Alternatively, the contents of this file may be used under the
25 * terms of the GNU Public License (the "GPL"), in which case the
26 * provisions of the GPL are applicable instead of those above.
27 * If you wish to allow use of your version of this file only
28 * under the terms of the GPL and not to allow others to use your
29 * version of this file under the MPL, indicate your decision by
30 * deleting the provisions above and replace them with the notice
31 * and other provisions required by the GPL.  If you do not delete
32 * the provisions above, a recipient may use your version of this
33 * file under either the MPL or the GPL.
34 */
35#ifndef nsStackFrameWin_h___
36#define nsStackFrameWin_h___
37
38
39#if defined(_WIN32) && defined(_M_IX86) // WIN32 x86 stack walking code
40#include "nspr.h"
41#include <windows.h>
42#include <imagehlp.h>
43
44// Define these as static pointers so that we can load the DLL on the
45// fly (and not introduce a link-time dependency on it). Tip o' the
46// hat to Matt Pietrick for this idea. See:
47//
48//   http://msdn.microsoft.com/library/periodic/period97/F1/D3/S245C6.htm
49//
50PR_BEGIN_EXTERN_C
51
52typedef DWORD (__stdcall *SYMSETOPTIONSPROC)(DWORD);
53extern SYMSETOPTIONSPROC _SymSetOptions;
54
55typedef BOOL (__stdcall *SYMINITIALIZEPROC)(HANDLE, LPSTR, BOOL);
56extern SYMINITIALIZEPROC _SymInitialize;
57
58typedef BOOL (__stdcall *SYMCLEANUPPROC)(HANDLE);
59extern SYMCLEANUPPROC _SymCleanup;
60
61typedef BOOL (__stdcall *STACKWALKPROC)(DWORD,
62                                        HANDLE,
63                                        HANDLE,
64                                        LPSTACKFRAME,
65                                        LPVOID,
66                                        PREAD_PROCESS_MEMORY_ROUTINE,
67                                        PFUNCTION_TABLE_ACCESS_ROUTINE,
68                                        PGET_MODULE_BASE_ROUTINE,
69                                        PTRANSLATE_ADDRESS_ROUTINE);
70extern  STACKWALKPROC _StackWalk;
71
72typedef LPVOID (__stdcall *SYMFUNCTIONTABLEACCESSPROC)(HANDLE, DWORD);
73extern  SYMFUNCTIONTABLEACCESSPROC _SymFunctionTableAccess;
74
75typedef DWORD (__stdcall *SYMGETMODULEBASEPROC)(HANDLE, DWORD);
76extern  SYMGETMODULEBASEPROC _SymGetModuleBase;
77
78typedef BOOL (__stdcall *SYMGETSYMFROMADDRPROC)(HANDLE, DWORD, PDWORD, PIMAGEHLP_SYMBOL);
79extern  SYMGETSYMFROMADDRPROC _SymGetSymFromAddr;
80
81typedef DWORD ( __stdcall *SYMLOADMODULE)(HANDLE, HANDLE, PSTR, PSTR, DWORD, DWORD);
82extern  SYMLOADMODULE _SymLoadModule;
83
84typedef DWORD ( __stdcall *SYMUNDNAME)(PIMAGEHLP_SYMBOL, PSTR, DWORD);
85extern  SYMUNDNAME _SymUnDName;
86
87typedef DWORD ( __stdcall *SYMGETMODULEINFO)( HANDLE, DWORD, PIMAGEHLP_MODULE);
88extern  SYMGETMODULEINFO _SymGetModuleInfo;
89
90typedef BOOL ( __stdcall *ENUMLOADEDMODULES)( HANDLE, PENUMLOADED_MODULES_CALLBACK, PVOID);
91extern  ENUMLOADEDMODULES _EnumerateLoadedModules;
92
93typedef BOOL (__stdcall *SYMGETLINEFROMADDRPROC)(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINE);
94extern  SYMGETLINEFROMADDRPROC _SymGetLineFromAddr;
95
96PRBool EnsureSymInitialized();
97
98PRBool EnsureImageHlpInitialized();
99
100/*
101 * SymGetModuleInfoEspecial
102 *
103 * Attempt to determine the module information.
104 * Bug 112196 says this DLL may not have been loaded at the time
105 *  SymInitialize was called, and thus the module information
106 *  and symbol information is not available.
107 * This code rectifies that problem.
108 * Line information is optional.
109 */
110BOOL SymGetModuleInfoEspecial(HANDLE aProcess, DWORD aAddr, PIMAGEHLP_MODULE aModuleInfo, PIMAGEHLP_LINE aLineInfo);
111
112
113void DumpStackToFile(FILE* out);
114
115PR_END_EXTERN_C
116
117#endif //WIN32
118
119#endif //nsStackFrameWin_h___
120
121
Note: See TracBrowser for help on using the repository browser.