积极答复者
在vc++中如何打印trace信息

问题
答案
-
http://blogs.msdn.com/b/vcblog/archive/2010/01/05/dia-based-stack-walking.aspx
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP- 已标记为答案 lucy-liuModerator 2011年1月4日 6:08
-
Hi sailuer,
要获取call stack(所谓的调用堆栈),就需要查看(unwind)stack的内容。要获取栈的内容,我们可以自己使用内联汇编获取,但是考虑到兼容性,内联汇编并不是一个好的解决方案。我们可以使用微软的StackWalk64函数来获取栈的内容。StackWalk64函数包含在dbghelp.dll中。您可以在Debugging Tools for Windows.中下载最新的dbghelp.dll。
BOOL WINAPI StackWalk64(
__in DWORD MachineType,
__in HANDLE hProcess,
__in HANDLE hThread,
__inout LPSTACKFRAME64 StackFrame,
__inout PVOID ContextRecord,
__in_opt PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine,
__in_opt PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine,
__in_opt PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine,
__in_opt PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress
);
以下链接详细的讲解了如何获取callstack信息:
http://www.codeproject.com/kb/threads/StackWalker.aspx
如果您的问题解决了,请把有用的回答标记为答案。
谢谢,
Lucy
Lucy Liu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已标记为答案 lucy-liuModerator 2011年1月4日 6:08
全部回复
-
http://blogs.msdn.com/b/vcblog/archive/2010/01/05/dia-based-stack-walking.aspx
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP- 已标记为答案 lucy-liuModerator 2011年1月4日 6:08
-
Hi sailuer,
要获取call stack(所谓的调用堆栈),就需要查看(unwind)stack的内容。要获取栈的内容,我们可以自己使用内联汇编获取,但是考虑到兼容性,内联汇编并不是一个好的解决方案。我们可以使用微软的StackWalk64函数来获取栈的内容。StackWalk64函数包含在dbghelp.dll中。您可以在Debugging Tools for Windows.中下载最新的dbghelp.dll。
BOOL WINAPI StackWalk64(
__in DWORD MachineType,
__in HANDLE hProcess,
__in HANDLE hThread,
__inout LPSTACKFRAME64 StackFrame,
__inout PVOID ContextRecord,
__in_opt PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine,
__in_opt PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine,
__in_opt PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine,
__in_opt PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress
);
以下链接详细的讲解了如何获取callstack信息:
http://www.codeproject.com/kb/threads/StackWalker.aspx
如果您的问题解决了,请把有用的回答标记为答案。
谢谢,
Lucy
Lucy Liu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已标记为答案 lucy-liuModerator 2011年1月4日 6:08