Windbg 使用 WaitForSingleObject() 的行为非常奇怪

发布于 2024-08-09 07:40:11 字数 1009 浏览 1 评论 0原文

下面是我的程序,当进程在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云淡月浅 2024-08-16 07:40:11

看起来这是一个在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文