使用 windbag 分析崩溃转储。需要将代码设置为转到当前线程。我尝试做 ~thread 5a0.b44 但这没有用。它给了我一个错误“'~thread 5a0.b44'中没有可运行的调试错误n。我需要设置转储来调试特定线程。我该怎么做?
最佳答案
您可以通过 ~
列出所有线程.它将显示逻辑线程 ID 和操作系统线程 ID。
您可以使用 ~<number>s
按逻辑编号选择线程(s for select) 并通过其操作系统线程 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
或 |~[<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
关于multithreading - 使用windbg时如何设置当前线程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55579238/