c# - Windbg Linq 用于托管对象
问题描述
为了迭代原生对象,我可以将其存储在 windbg 变量中,然后linq
对 windbg 中的字段进行查询以过滤有趣的对象。
> dx @$usedSessions = (*((FabricRuntime!std::unordered_map<unsigned __int64,std::shared_ptr<Store::EseLocalStore::EsePoolItem>,std::hash<unsigned __int64>,std::equal_to<unsigned __int64>,std::allocator<std::pair<unsigned __int64 const ,std::shared_ptr<Store::EseLocalStore::EsePoolItem> > > > *)0x1dfff35f1a8))
> dx @$usedSessions.Take(2).Select(s => s.second->session_->sessionId_)
但是dx
windbg 命令对于sos
命令失败:
0:045> dx @$Txs = !dumpheap -live -type System.Fabric.Transaction
Error: Unexpected token at 'System.Fabric.Transaction'
我可以在 windbg 中使用 Linq 迭代托管对象吗?
解决方案
如果您不喜欢与 结合使用的 WinDbg.foreach
循环,!dumpheap -short
我能想到的最接近的是NetExt WinDbg Extension。
它可以像
!wfrom -type *.HttpContext
where ( ($contains(_request._url.m_String, "http:")) && (_response._statuscode != 0n200) )
select $addr(), _request._url.m_String, _response._statusCode
来源:NetExt 文档示例
推荐阅读
- python - sklearn MinMaxScaler - ValueError: Expected 2D array, got 1D array instead - data as series objects
- aws-lambda - 无服务器 lambda 的 cors 问题
- java - 错误: com.nguyenhoanglam.imagepicker.activity 包不存在
- python - Django model.Model.'instance' 引发 AttributeError
- performance - Open MPI的性能:独立节点是否有时间积累?
- php - 如何在某些字符后从字符串的开头和结尾删除?
- reactjs - 使用reactjs上传时如何取消图片
- android - 为android返回缓存位置的本地地理定位做出反应
- android - Flutter 应用中带有 Lottie 动画的原生 android 闪屏
- javascript - 相机实时流 - 识别拍摄的白色背景上的矩形或线条