开发者

Using DebugActiveProcess and WaitForDebugEvent seems to hang

I have used DebugActiveProcess to attach a process. After that I used WaitForDebugEvent, but it seems that the application is stuck in some infinite loop and I am not able to debug the attached process.

Below is my code:

    DebugActiveProcess( processID );
    int temp = 0;

    DEBUG_EVENT DBEvent;

    while (1)
    {
        WaitForDebugEvent( &DBEvent, INFINITE );
        if ( DBEvent.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT )
            break;
        if ( D开发者_开发问答BEvent.dwDebugEventCode == CREATE_PROCESS_DEBUG_EVENT )
        {
            //MessageBox(0,"Debugging started!","Ble",0);
            temp = 1;
        }
        else if ( DBEvent.dwDebugEventCode == EXCEPTION_DEBUG_EVENT )
        {
            if ( DBEvent.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT )
            {
                ContinueDebugEvent( processID, qalsrvid, DBG_CONTINUE );
                continue;
            }
            ContinueDebugEvent( processID, qalsrvid, DBG_EXCEPTION_NOT_HANDLED );
        }
    }


You are not calling ContinuteDebugEvent on CREATE_PROCESS_DEBUG_EVENT event.

If you have not read it yet, you should:

Writing Windows Debugger and Part 2

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜