multithreading - 使用windbg时如何设置当前线程
问题描述
使用 windbag 分析崩溃转储。需要将代码设置为转到当前线程。我尝试做 ~thread 5a0.b44 但这没有用。它给了我一个错误“'~thread 5a0.b44'中没有可运行的调试错误n。我需要设置转储来调试特定线程。我该怎么做?
解决方案
您可以仅列出所有线程~
。它将显示逻辑线程 ID 和操作系统线程 ID。
您可以使用 (s for select) 按逻辑编号选择线程,~<number>s
使用 . 按操作系统线程 ID 选择线程~~[<number>]s
。
0:000> ~
. 0 Id: 1ee0.2270 Suspend: 1 Teb: 0000008c`1373b000 Unfrozen
1 Id: 1ee0.2b18 Suspend: 1 Teb: 0000008c`1373d000 Unfrozen
2 Id: 1ee0.1d44 Suspend: 1 Teb: 0000008c`1373f000 Unfrozen
3 Id: 1ee0.1a1c Suspend: 1 Teb: 0000008c`13741000 Unfrozen
0:000> ~1s
ntdll!NtWaitForWorkViaWorkerFactory+0x14:
00007fff`32522fe4 c3 ret
0:001> ~~[1d44]s
ntdll!NtWaitForWorkViaWorkerFactory+0x14:
00007fff`32522fe4 c3 ret
0:002> *** on thread 2 now
您不能将进程 ID 与线程 ID 一起使用:
0:002> ~~[1ee0.1a1c]s
Syntax error at '1ee0.1a1c]s'
0:002> ~~[1ee01a1c]s
^ Illegal thread error in '~~[1ee01a1c]s
如果您需要切换进程,请使用|<number>s
or |~[<number>]s
:
0:003> |
. 0 id: 1ee0 examine name: C:\Windows\System32\ApproveChildRequest.exe
# 1 id: 1e9c attach name: C:\Program Files\paint.net\PaintDotNet.exe
0:003> |~[1e9c]s
ntdll!DbgBreakPoint:
00007fff`32523060 cc int 3
1:026> *** on process 1 now
推荐阅读
- numpy - 批量张量切片,切片 B x N x M 和 B x 1
- android - Kotlin中recyclerview项目点击事件是否需要接口?
- javascript - 防止 redux 存储值在组件中再次被使用
- javascript - 如何在多页 vue 应用程序中的页面之间传输状态?
- gradle - 为什么 Gradle 开始报告“不匹配的版本”
- html - 如何将div放在中间?
- c# - 查看模型未更新
- pandas - PandasUDF 可以接受一系列类型的字符串并返回一系列类型的数组吗?
- regex - 如何使用一个捕获组获取单独的组
- python - 如何使用 Python 中未记录的 API 或未记录的 MQTT 消息协议发送 Instagram Direct 消息?