multithreading - 使用windbg时如何设置当前线程

标签 multithreading windbg dump

使用 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/

相关文章:

c - 读取 ntdll.dll + 偏移量会导致访问冲突

c# - 什么是 WinDbg <未知> 内存?

python - 将字典(数组)导出到 json

c# - 允许 C# 编译器优化局部变量并从内存中重新获取值

multithreading - OpenMP:堆数组性能较差(堆栈数组工作正常)

Windbg native 调用堆栈跟踪没有意义

c++ - 将原始内存写入文件

java - ThreadFactory newThread() 方法对于 ThreadPoolExectutor 中的每个submit() 调用仅调用一次

java - 同步到要实例化的对象

assembly - 令人困惑的 .align 地址排列