StackWalker Class Reference

#include <StackWalker.h>

Classes

struct  CallstackEntry
 

Public Types

enum  { STACKWALK_MAX_NAMELEN = 1024 }
 
typedef BOOL(__stdcall * PReadProcessMemoryRoutine) (HANDLE hProcess, DWORD64 qwBaseAddress, PVOID lpBuffer, DWORD nSize, LPDWORD lpNumberOfBytesRead, LPVOID pUserData)
 
enum  StackWalkOptions {
  RetrieveNone = 0 , RetrieveSymbol = 1 , RetrieveLine = 2 , RetrieveModuleInfo = 4 ,
  RetrieveFileVersion = 8 , RetrieveVerbose = 0xF , SymBuildPath = 0x10 , SymUseSymSrv = 0x20 ,
  SymAll = 0x30 , OptionsAll = 0x3F
}
 
typedef enum StackWalker::StackWalkOptions StackWalkOptions
 

Public Member Functions

BOOL LoadModules ()
 
BOOL ShowCallstack (HANDLE hThread=GetCurrentThread(), const CONTEXT *context=NULL, PReadProcessMemoryRoutine readMemoryFunction=NULL, LPVOID pUserData=NULL)
 
 StackWalker (DWORD dwProcessId, HANDLE hProcess)
 
 StackWalker (int options=OptionsAll, LPCSTR szSymPath=NULL, DWORD dwProcessId=GetCurrentProcessId(), HANDLE hProcess=GetCurrentProcess())
 
virtual ~StackWalker ()
 

Protected Types

typedef struct StackWalker::CallstackEntry CallstackEntry
 
enum  CallstackEntryType { firstEntry , nextEntry , lastEntry }
 

Protected Member Functions

virtual void OnCallstackEntry (CallstackEntryType eType, CallstackEntry &entry)
 
virtual void OnDbgHelpErr (LPCSTR szFuncName, DWORD gle, DWORD64 addr)
 
virtual void OnLoadModule (LPCSTR img, LPCSTR mod, DWORD64 baseAddr, DWORD size, DWORD result, LPCSTR symType, LPCSTR pdbName, ULONGLONG fileVersion)
 
virtual void OnOutput (LPCSTR szText)
 
virtual void OnSymInit (LPCSTR szSearchPath, DWORD symOptions, LPCSTR szUserName)
 

Static Protected Member Functions

static BOOL __stdcall myReadProcMem (HANDLE hProcess, DWORD64 qwBaseAddress, PVOID lpBuffer, DWORD nSize, LPDWORD lpNumberOfBytesRead)
 

Protected Attributes

DWORD m_dwProcessId
 
HANDLE m_hProcess
 
int m_MaxRecursionCount
 
BOOL m_modulesLoaded
 
int m_options
 
StackWalkerInternalm_sw
 
LPSTR m_szSymPath
 
friend StackWalkerInternal
 

Member Typedef Documentation

◆ CallstackEntry

◆ PReadProcessMemoryRoutine

typedef BOOL(__stdcall * StackWalker::PReadProcessMemoryRoutine) (HANDLE hProcess, DWORD64 qwBaseAddress, PVOID lpBuffer, DWORD nSize, LPDWORD lpNumberOfBytesRead, LPVOID pUserData)

◆ StackWalkOptions

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
STACKWALK_MAX_NAMELEN 

◆ CallstackEntryType

Enumerator
firstEntry 
nextEntry 
lastEntry 

◆ StackWalkOptions

Enumerator
RetrieveNone 
RetrieveSymbol 
RetrieveLine 
RetrieveModuleInfo 
RetrieveFileVersion 
RetrieveVerbose 
SymBuildPath 
SymUseSymSrv 
SymAll 
OptionsAll 

Constructor & Destructor Documentation

◆ StackWalker() [1/2]

StackWalker::StackWalker ( int  options = OptionsAll,
LPCSTR  szSymPath = NULL,
DWORD  dwProcessId = GetCurrentProcessId(),
HANDLE  hProcess = GetCurrentProcess() 
)

◆ StackWalker() [2/2]

StackWalker::StackWalker ( DWORD  dwProcessId,
HANDLE  hProcess 
)

◆ ~StackWalker()

StackWalker::~StackWalker ( )
virtual

References m_sw, and m_szSymPath.

Member Function Documentation

◆ LoadModules()

◆ myReadProcMem()

BOOL __stdcall StackWalker::myReadProcMem ( HANDLE  hProcess,
DWORD64  qwBaseAddress,
PVOID  lpBuffer,
DWORD  nSize,
LPDWORD  lpNumberOfBytesRead 
)
staticprotected

Referenced by ShowCallstack().

◆ OnCallstackEntry()

◆ OnDbgHelpErr()

void StackWalker::OnDbgHelpErr ( LPCSTR  szFuncName,
DWORD  gle,
DWORD64  addr 
)
protectedvirtual

◆ OnLoadModule()

void StackWalker::OnLoadModule ( LPCSTR  img,
LPCSTR  mod,
DWORD64  baseAddr,
DWORD  size,
DWORD  result,
LPCSTR  symType,
LPCSTR  pdbName,
ULONGLONG  fileVersion 
)
protectedvirtual

◆ OnOutput()

void StackWalker::OnOutput ( LPCSTR  szText)
protectedvirtual

◆ OnSymInit()

void StackWalker::OnSymInit ( LPCSTR  szSearchPath,
DWORD  symOptions,
LPCSTR  szUserName 
)
protectedvirtual

◆ ShowCallstack()

Member Data Documentation

◆ m_dwProcessId

DWORD StackWalker::m_dwProcessId
protected

Referenced by LoadModules(), and StackWalker().

◆ m_hProcess

HANDLE StackWalker::m_hProcess
protected

◆ m_MaxRecursionCount

int StackWalker::m_MaxRecursionCount
protected

Referenced by ShowCallstack(), and StackWalker().

◆ m_modulesLoaded

BOOL StackWalker::m_modulesLoaded
protected

◆ m_options

int StackWalker::m_options
protected

Referenced by LoadModules(), and StackWalker().

◆ m_sw

StackWalkerInternal* StackWalker::m_sw
protected

◆ m_szSymPath

LPSTR StackWalker::m_szSymPath
protected

Referenced by ~StackWalker().

◆ StackWalkerInternal

friend StackWalker::StackWalkerInternal
protected

Referenced by StackWalker().


The documentation for this class was generated from the following files: