MCPcopy Create free account
hub / github.com/ddopson/node-segfault-handler / StackWalkerInternal

Class StackWalkerInternal

src/StackWalker.cpp:184–735  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182
183
184class StackWalkerInternal
185{
186public:
187 StackWalkerInternal(StackWalker *parent, HANDLE hProcess)
188 {
189 m_parent = parent;
190 m_hDbhHelp = NULL;
191 pSC = NULL;
192 m_hProcess = hProcess;
193 m_szSymPath = NULL;
194 pSFTA = NULL;
195 pSGLFA = NULL;
196 pSGMB = NULL;
197 pSGMI = NULL;
198 pSGO = NULL;
199 pSGSFA = NULL;
200 pSI = NULL;
201 pSLM = NULL;
202 pSSO = NULL;
203 pSW = NULL;
204 pUDSN = NULL;
205 pSGSP = NULL;
206 }
207 ~StackWalkerInternal()
208 {
209 if (pSC != NULL)
210 pSC(m_hProcess); // SymCleanup
211 if (m_hDbhHelp != NULL)
212 FreeLibrary(m_hDbhHelp);
213 m_hDbhHelp = NULL;
214 m_parent = NULL;
215 if(m_szSymPath != NULL)
216 free(m_szSymPath);
217 m_szSymPath = NULL;
218 }
219 BOOL Init(LPCSTR szSymPath)
220 {
221 if (m_parent == NULL)
222 return FALSE;
223 // Dynamically load the Entry-Points for dbghelp.dll:
224 // First try to load the newsest one from
225 TCHAR szTemp[4096];
226 // But before wqe do this, we first check if the ".local" file exists
227 if (GetModuleFileName(NULL, szTemp, 4096) > 0)
228 {
229 _tcscat_s(szTemp, _T(".local"));
230 if (GetFileAttributes(szTemp) == INVALID_FILE_ATTRIBUTES)
231 {
232 // ".local" file does not exist, so we can try to load the dbghelp.dll from the "Debugging Tools for Windows"
233 if (GetEnvironmentVariable(_T("ProgramFiles"), szTemp, 4096) > 0)
234 {
235 _tcscat_s(szTemp, _T("\\Debugging Tools for Windows\\dbghelp.dll"));
236 // now check if the file exists:
237 if (GetFileAttributes(szTemp) != INVALID_FILE_ATTRIBUTES)
238 {
239 m_hDbhHelp = LoadLibrary(szTemp);
240 }
241 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected