The StackWalk function provides a portable method for obtaining a stack trace.
BOOL StackWalk(
IN DWORD MachineType,
IN HANDLE hProcess,
IN HANDLE hThread,
IN OUT LPSTACKFRAME StackFrame,
IN OUT LPVOID ContextRecord,
IN PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine,
IN PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine,
IN PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine,
IN PTRANSLATE_ADDRESS_ROUTINE TranslateAddress
);
Value | Meaning |
---|---|
IMAGE_FILE_MACHINE_I386 | Intel |
IMAGE_FILE_MACHINE_R4000 | MIPS |
IMAGE_FILE_MACHINE_R10000 | MIPS |
IMAGE_FILE_MACHINE_ALPHA | DEC Alpha |
IMAGE_FILE_MACHINE_POWERPC | IBM PowerPC |
The symbol handler in ImageHlp provides functions that load and access the run-time table. If these functions are used, then SymFunctionTableAccess can be passed as a valid parameter.
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError.
The StackWalk function provides a portable method for obtaining a stack trace. This function is used by all Microsoft debuggers and tools that require stack trace facilities. Using the StackWalk function is recommended over writing your own function because of all the complexities associated with stack walking on Win32 platforms. In addition, there are compiler options that cause the stack to appear differently, depending on how the module is compiled. By using this function, your application has a portable stack trace that continues to work as the compiler and operating system change.
Windows NT: Requires version 4.0 or later.
Windows: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Windows CE: Unsupported.
Header: Declared in imagehlp.h.
Import Library: Use imagehlp.lib.
PE Image Helper (ImageHlp) Overview, ImageHlp Debugger Functions, CONTEXT, STACKFRAME