你怎么走了混合模式(管理+原生)堆栈DBGHELP!StackWalk64? [英] How do you walk a mixed-mode (managed+native) stack with dbghelp!StackWalk64?

查看:531
本文介绍了你怎么走了混合模式(管理+原生)堆栈DBGHELP!StackWalk64?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想走路包含使用StackWalk64一个64位的过程托管和本机框架调用堆栈。一切工作正常,直到第一或第二管理框架,之后StackWalk64想不通帧的返回地址和失败。

I'm trying to walk a callstack that contains both managed and native frames on a x64 process using StackWalk64. Everything works fine until the first or second managed frame, after which StackWalk64 can't figure out the return address of the frame and fails.

我使用SymFunctionTableAccess64的功能表访问回调和符号处理器进行了初始化SymInitialize()。有一些神奇的,我需要做的DBGHELP得到它走过去管理的正确帧?

I'm using SymFunctionTableAccess64 for the function table access callback and the symbol handler has been initialized with SymInitialize(). Is there some magic I need to do in dbghelp to get it to walk over managed frames correctly?

实例调用堆栈失败:

UnmanagedFrame1
UnmanagedFrame2
UnmanagedFrame3
ManagedFrame1< -----(StackWalk64这个框架后,无法继续)
ManagedFrame2
UnmanagedFrame4
UnmanagedFrame5
NTDLL!RtlUserThreadStart

UnmanagedFrame1
UnmanagedFrame2
UnmanagedFrame3
ManagedFrame1 <----- (StackWalk64 fails after this frame)
ManagedFrame2
UnmanagedFrame4
UnmanagedFrame5
ntdll!RtlUserThreadStart

请注意:这个问题的不是关于如何解决管理帧符号/方法名称的/ etc,我只想走全栈完全不考虑符号解析/等。

Note: this question IS NOT about how to resolve the managed frames to symbols/method names/etc, I simply want to walk the full stack with no regard to symbol resolution/etc.

此外,IDebugControl4 :: GetContextStackTrace正常工作,但DbgEng使用自定义函数表的回调,而不是简单地委托给SymFunctionTableAccess64。我怀疑的问题是,CLR使用RtlInstallFunctionTableCallback安装一个回调函数表(指向mscordacwks)和SymFunctionTableAccess64是不够聪明遵循。

Also, IDebugControl4::GetContextStackTrace works correctly, but DbgEng uses a custom function table callback, and doesn't simply delegate to SymFunctionTableAccess64. I suspect the issue is that the CLR uses RtlInstallFunctionTableCallback to install a callback function table (which points to mscordacwks), and SymFunctionTableAccess64 isn't smart enough to follow that.

我花了一些时间,试图编写自定义函数表的访问回调遍历函数表链和调用mscordacwks回调,但它得到了pretty的简略,并没有真正的工作反正。

I spent some time trying to write a custom function table access callback to traverse the function table chain and call the callback in mscordacwks, but it got pretty sketchy and didn't really work anyways.

推荐答案

请问 SOS调试器扩展帮助呢?它提供的能力,从的WinDbg 的Visual Studio 走栈正是你想要的方式。

Does the SOS debugger extension help at all? It provides the ability, from windbg and Visual Studio to walk the stack exactly the way you wish.

另外探查栈走在.NET Framework 2.0中:基础和超越可能是一些使用。

这篇关于你怎么走了混合模式(管理+原生)堆栈DBGHELP!StackWalk64?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆