Windbg 使用 WaitForSingleObject() 的行为非常奇怪
下面是我的程序,当进程在使用 Windbg 的 WaitForSingleObject() 调用中被阻止时,我尝试获取调用堆栈。奇怪的是,当进程阻塞时,windbg 只打印出非常奇怪的堆栈。
wow64cpu!TurboDispatchJumpAddressEnd+0x690 wow64cpu!TurboDispatchJumpAddressEnd+0x484 wow64!Wow64SystemServiceEx+0x1ce wow64!Wow64LdrpInitialize+0x429 ntdll!RtlResetRtlTranslations+0x1b08 ntdll!RtlResetRtlTranslations+0xc63 ntdll!LdrInitializeThunk+0xe
// process2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "windows.h"
HANDLE g_hWriteEvent;
int _tmain(int argc, _TCHAR* argv[])
{
g_hWriteEvent = OpenEvent(
EVENT_ALL_ACCESS,
FALSE,
TEXT("WriteEvent")
);
if (g_hWriteEvent == NULL) {
printf("OpenEvent error (%d)\n", GetLastError());
return 0;
}
// while (1);
WaitForSingleObject(g_hWriteEvent, INFINITE);
return 0;
}
请注意,如果我取消注释 while(1)
行,则 Windbg 可以识别出进程在 _tmain
函数中阻塞。
谢谢。 垃圾桶
Below is my program and I am trying to get the call stack when the process is blocked in WaitForSingleObject() call using windbg. The strange thing is when the process is blocking, windbg only prints out very strange stack.
wow64cpu!TurboDispatchJumpAddressEnd+0x690 wow64cpu!TurboDispatchJumpAddressEnd+0x484 wow64!Wow64SystemServiceEx+0x1ce wow64!Wow64LdrpInitialize+0x429 ntdll!RtlResetRtlTranslations+0x1b08 ntdll!RtlResetRtlTranslations+0xc63 ntdll!LdrInitializeThunk+0xe
// process2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "windows.h"
HANDLE g_hWriteEvent;
int _tmain(int argc, _TCHAR* argv[])
{
g_hWriteEvent = OpenEvent(
EVENT_ALL_ACCESS,
FALSE,
TEXT("WriteEvent")
);
if (g_hWriteEvent == NULL) {
printf("OpenEvent error (%d)\n", GetLastError());
return 0;
}
// while (1);
WaitForSingleObject(g_hWriteEvent, INFINITE);
return 0;
}
Note that if I uncomment the while(1)
line then the windbg can recognize the process is blocking in the _tmain
function.
Thanks.
Bin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来这是一个在 64 位操作系统上运行的 Wow64 32 位进程。确保将 64 位 Windbg 连接到进程,而不是 32 位 Windbg。
Looks like that is a Wow64 32 bit process running on 64 bit OS. Make sure you attach the 64 bit Windbg to the process, not the 32 bit Windbg.