當前位置: 首頁>>代碼示例>>C++>>正文


C++ ContinueDebugEvent函數代碼示例

本文整理匯總了C++中ContinueDebugEvent函數的典型用法代碼示例。如果您正苦於以下問題:C++ ContinueDebugEvent函數的具體用法?C++ ContinueDebugEvent怎麽用?C++ ContinueDebugEvent使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ContinueDebugEvent函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: wait_for_exception

bool wait_for_exception(EXCEPTION_RECORD &ex) 
{
    bool ex_thrown = false;
    DEBUG_EVENT de;
    while(!ex_thrown) {
        if(WaitForDebugEvent(&de, (DWORD)100)) {
            switch(de.dwDebugEventCode) {
                case EXCEPTION_DEBUG_EVENT:
                    if(is_fatal_exception(de.u.Exception.ExceptionRecord.ExceptionCode))
                        ex_thrown = true;
                    break;
                case EXIT_PROCESS_DEBUG_EVENT:
                    return false;
                default:
                    ContinueDebugEvent (de.dwProcessId, de.dwThreadId, DBG_CONTINUE);
                    break;
            }
        }
        else
            ContinueDebugEvent (de.dwProcessId, de.dwThreadId, DBG_CONTINUE);
    }
    /* Exception caught! */
    ex = de.u.Exception.ExceptionRecord;
    return ex_thrown;
}
開發者ID:ognz,項目名稱:sloth-fuzzer,代碼行數:25,代碼來源:executer.cpp

示例2: ContinueDebugEvent

BOOL CDbgHook::DbgLoop(IHookWorker& Work)
{
	DWORD dwDbgStatus;

	ContinueDebugEvent(m_de.dwProcessId, m_de.dwThreadId, DBG_CONTINUE);

	while (WaitForDebugEvent(&m_de, INFINITE))
	{
		dwDbgStatus = DBG_CONTINUE;
		switch (m_de.dwDebugEventCode)
		{
		case EXCEPTION_DEBUG_EVENT:
			if (OnExceptionDbgEvent(m_de, Work))
				continue;
			else
				dwDbgStatus = DBG_EXCEPTION_NOT_HANDLED;

			break;
		case EXIT_PROCESS_DEBUG_EVENT:
			return TRUE;
		}
		ContinueDebugEvent(m_de.dwProcessId, m_de.dwThreadId, dwDbgStatus);
	}

	return TRUE;
}
開發者ID:gkscndrl,項目名稱:GoldRushData,代碼行數:26,代碼來源:DbgHook.cpp

示例3: hl_debug_wait

HL_API int hl_debug_wait( int pid, int *thread, int timeout ) {
#	if defined(HL_WIN)
	DEBUG_EVENT e;
	if( !WaitForDebugEvent(&e,timeout) )
		return -1;
	*thread = e.dwThreadId;
	switch( e.dwDebugEventCode ) {
	case EXCEPTION_DEBUG_EVENT:
		switch( e.u.Exception.ExceptionRecord.ExceptionCode ) {
		case EXCEPTION_BREAKPOINT:
		case 0x4000001F: // STATUS_WX86_BREAKPOINT
			return 1;
		case EXCEPTION_SINGLE_STEP:
		case 0x4000001E: // STATUS_WX86_SINGLE_STEP
			return 2;
		case 0x406D1388: // MS_VC_EXCEPTION (see SetThreadName)
			ContinueDebugEvent(e.dwProcessId, e.dwThreadId, DBG_CONTINUE);
			break;
		case 0xE06D7363: // C++ EH EXCEPTION
			ContinueDebugEvent(e.dwProcessId, e.dwThreadId, DBG_EXCEPTION_NOT_HANDLED);
			break;
		default:
			return 3;
		}
	case EXIT_PROCESS_DEBUG_EVENT:
		return 0;
	default:
		ContinueDebugEvent(e.dwProcessId, e.dwThreadId, DBG_CONTINUE);
		break;
	}
	return 4;
#	elif defined(USE_PTRACE)
	int status;
	int ret = waitpid(pid,&status,0);
	//printf("WAITPID=%X %X\n",ret,status);
	*thread = ret;
	if( WIFEXITED(status) )
		return 0;
	if( WIFSTOPPED(status) ) {
		int sig = WSTOPSIG(status);
		//printf(" STOPSIG=%d\n",sig);
		if( sig == SIGSTOP || sig == SIGTRAP )
			return 1;
		return 3;
	}	
	return 4;
#	else
	return 0;
#	endif
}
開發者ID:Disar,項目名稱:Kha,代碼行數:50,代碼來源:debug.c

示例4: LLOG

bool Pdb::Continue()
{
	LLOG("** Continue");
	running = true;
	ContinueDebugEvent(event.dwProcessId, event.dwThreadId, DBG_CONTINUE);
	return RunToException();
}
開發者ID:Sly14,項目名稱:upp-mirror,代碼行數:7,代碼來源:Debug.cpp

示例5: DebugLoop

void DebugLoop()
{
    DEBUG_EVENT de;
    DWORD dwContinueStatus;

    // Debuggee 로부터 event 가 발생할 때까지 기다림
    while( WaitForDebugEvent(&de, INFINITE) )
    {
        dwContinueStatus = DBG_CONTINUE;

        // Debuggee 프로세스 생성 혹은 attach 이벤트
        if( CREATE_PROCESS_DEBUG_EVENT == de.dwDebugEventCode )
        {
            OnCreateProcessDebugEvent(&de);
        }
        // 예외 이벤트
        else if( EXCEPTION_DEBUG_EVENT == de.dwDebugEventCode )
        {
            if( OnExceptionDebugEvent(&de) )
                continue;
        }
        // Debuggee 프로세스 종료 이벤트
        else if( EXIT_PROCESS_DEBUG_EVENT == de.dwDebugEventCode )
        {
            // debuggee 종료 -> debugger 종료
            break;
        }

        // Debuggee 의 실행을 재개시킴
        ContinueDebugEvent(de.dwProcessId, de.dwThreadId, dwContinueStatus);
    }
}
開發者ID:junehappylove,項目名稱:GitHub,代碼行數:32,代碼來源:hookdbg.cpp

示例6: DS2ASSERT

ErrorCode Thread::resume(int signal, Address const &address) {
  // TODO(sas): Not sure how to translate the signal concept to Windows yet.
  // We'll probably have to get rid of these at some point.
  DS2ASSERT(signal == 0);
  // TODO(sas): Continuing a thread from a given address is not implemented yet.
  DS2ASSERT(!address.valid());

  ErrorCode error = kSuccess;

  if (_state == kStopped || _state == kStepped) {
    ProcessInfo info;

    error = process()->getInfo(info);
    if (error != kSuccess)
      return error;

    BOOL result = ContinueDebugEvent(_process->pid(), _tid, DBG_CONTINUE);
    if (!result)
      return Host::Platform::TranslateError();

    _state = kRunning;
  } else if (_state == kTerminated) {
    error = kErrorProcessNotFound;
  }

  return error;
}
開發者ID:tritao,項目名稱:ds2,代碼行數:27,代碼來源:Thread.cpp

示例7: r_debug_native_continue

/* TODO: must return true/false */
static int r_debug_native_continue (RDebug *dbg, int pid, int tid, int sig) {
#if __WINDOWS__ && !__CYGWIN__
	if (ContinueDebugEvent (pid, tid, DBG_CONTINUE) == 0) {
		print_lasterr ((char *)__FUNCTION__, "ContinueDebugEvent");
		eprintf ("debug_contp: error\n");
		return false;
	}
	return tid;
#elif __APPLE__
	bool ret;
	ret = xnu_continue (dbg, pid, tid, sig);
	if (!ret)
		return -1;
	return tid;
#elif __BSD__
	void *data = (void*)(size_t)((sig != -1) ? sig : dbg->reason.signum);
	ut64 pc = r_debug_reg_get (dbg, "pc");
	return ptrace (PTRACE_CONT, pid, (void*)(size_t)pc, (int)(size_t)data) == 0;
#elif __CYGWIN__
	#warning "r_debug_native_continue not supported on this platform"
	return -1;
#else
	void *data = (void*)(size_t)((sig != -1) ? sig : dbg->reason.signum);
//eprintf ("SIG %d\n", dbg->reason.signum);
	return ptrace (PTRACE_CONT, pid, NULL, data) == 0;
#endif
}
開發者ID:Ekleog,項目名稱:radare2,代碼行數:28,代碼來源:debug_native.c

示例8: HookedWaitForDebugEvent

BOOL WINAPI HookedWaitForDebugEvent(LPDEBUG_EVENT lpDebugEvent, DWORD dwMilliseconds)
{
	BOOL retV = dWaitForDebugEvent(lpDebugEvent, dwMilliseconds);

	if (retV)
	{
		while(1)
		{
			if (AnalyzeDebugStructure(lpDebugEvent))
			{
				ContinueDebugEvent(lpDebugEvent->dwProcessId, lpDebugEvent->dwThreadId, DBG_EXCEPTION_NOT_HANDLED);

				retV = dWaitForDebugEvent(lpDebugEvent, dwMilliseconds);
				if (!retV)
				{
					break;
				}
			}
			else
			{
				break;
			}
		}
	}

	return retV;
}
開發者ID:TechLord-Forever,項目名稱:ScyllaHide,代碼行數:27,代碼來源:CustomExceptionHandler.cpp

示例9: ContinueDebugEvent

void WinDebugger::cont() {
    DWORD status = DBG_EXCEPTION_NOT_HANDLED;
    BOOL ret = ContinueDebugEvent(event_.dwProcessId, event_.dwThreadId, status);
    if (!ret) {
        std::cerr << "error: cont: " << GetLastError() << std::endl;
        abort();
    }
}
開發者ID:mfichman,項目名稱:jogo,代碼行數:8,代碼來源:WinDebugger.cpp

示例10: DoContinueDebugEvent

/*
 * DoContinueDebugEvent
 */
static BOOL DoContinueDebugEvent( DWORD continue_how )
{
    SetLastError( 0 );
    if( !DidWaitForDebugEvent ) {
        return( FALSE );
    }
    return( ContinueDebugEvent( DebugeePid, LastDebugEventTid, continue_how ) );
}
開發者ID:pavanvunnava,項目名稱:open-watcom-v2,代碼行數:11,代碼來源:dbgthrd.c

示例11: get_debug_event

	void get_debug_event()
	{
		PCONTEXT ctx;

		debug_event = DEBUG_EVENT();
		ctn_status = DBG_CONTINUE;

		if (WaitForDebugEvent(&debug_event, INFINITE))
		{
			h_thread = open_thread(debug_event.dwThreadId);
			ctx = get_thread_context(h_thread, NULL);

			std::cout << "[E] Event Code : " << debug_event.dwDebugEventCode
					 << " Thread ID : " << debug_event.dwThreadId << std::endl;

			if (debug_event.dwDebugEventCode == EXCEPTION_DEBUG_EVENT)
			{
				exception = debug_event.u.Exception.ExceptionRecord.ExceptionCode;
				exception_address = debug_event.u.Exception.ExceptionRecord.ExceptionAddress;

				switch (exception)
				{
				case EXCEPTION_ACCESS_VIOLATION:
					std::cout << "[EXCEPTION] ACCESS VIOLATION." << std::endl;
					break;
				case EXCEPTION_BREAKPOINT:
					ctn_status = exception_handler_breakpoint();
					break;
				case EXCEPTION_GUARD_PAGE:
					std::cout << "[EXCEPTION] Guard Page Access Detected." << std::endl;
					break;
				case EXCEPTION_SINGLE_STEP:
					std::cout << "[EXCEPTION] Single Stepping." << std::endl;
					break;
				default:
					break;
				}

				ContinueDebugEvent(debug_event.dwProcessId,
					debug_event.dwThreadId, ctn_status);
			}
		}

		ContinueDebugEvent(debug_event.dwProcessId, debug_event.dwThreadId, ctn_status);
	}
開發者ID:err0rless,項目名稱:debugger_,代碼行數:45,代碼來源:Debugger.cpp

示例12: hl_debug_resume

HL_API bool hl_debug_resume( int pid, int thread ) {
#	if defined(HL_WIN)
	return (bool)ContinueDebugEvent(pid, thread, DBG_CONTINUE);
#	elif defined(USE_PTRACE)
	return ptrace(PTRACE_CONT,pid,0,0) >= 0;
#	else
	return false;
#	endif
}
開發者ID:Disar,項目名稱:Kha,代碼行數:9,代碼來源:debug.c

示例13: code

void Thread::Continue(void)
{
    DWORD dwContinueStatus = DBG_CONTINUE;
    if (ContinueDebugEvent(this->myProcess->GetId(), this->iThread, dwContinueStatus) == TRUE)
    {
        return;
    }
    CString str;
    str.Format("%d: %s, error code (%d)", this->iThread, "/!\\ Error ContinueDebugEvent /!\\", GetLastError());
    throw new DebuggerException(str);
}
開發者ID:nicolascormier,項目名稱:ncormier-academic-projects,代碼行數:11,代碼來源:Thread.cpp

示例14: r_debug_native_continue

/* TODO: must return true/false */
static int r_debug_native_continue(RDebug *dbg, int pid, int tid, int sig) {
#if __WINDOWS__ && !__CYGWIN__
	/* Honor the Windows-specific signal that instructs threads to process exceptions */
	DWORD continue_status = (sig == DBG_EXCEPTION_NOT_HANDLED)
		? DBG_EXCEPTION_NOT_HANDLED : DBG_CONTINUE;
	if (ContinueDebugEvent (pid, tid, continue_status) == 0) {
		r_sys_perror ("r_debug_native_continue/ContinueDebugEvent");
		eprintf ("debug_contp: error\n");
		return false;
	}
	return tid;
#elif __APPLE__
	bool ret;
	ret = xnu_continue (dbg, pid, tid, sig);
	if (!ret) {
		return -1;
	}
	return tid;
#elif __BSD__
	void *data = (void*)(size_t)((sig != -1) ? sig : dbg->reason.signum);
	ut64 pc = r_debug_reg_get (dbg, "PC");
	return ptrace (PTRACE_CONT, pid, (void*)(size_t)pc, (int)(size_t)data) == 0;
#elif __CYGWIN__
	#warning "r_debug_native_continue not supported on this platform"
	return -1;
#else
	int contsig = dbg->reason.signum;

	if (sig != -1) {
		contsig = sig;
	}
	/* SIGINT handler for attached processes: dbg.consbreak (disabled by default) */
	if (dbg->consbreak) {
		r_cons_break_push ((RConsBreak)r_debug_native_stop, dbg);
	}

	int ret = ptrace (PTRACE_CONT, pid, NULL, contsig);
	if (ret) {
		perror ("PTRACE_CONT");
	}
	if (dbg->continue_all_threads && dbg->n_threads) {
		RList *list = dbg->threads;
		RDebugPid *th;
		RListIter *it;

		if (list) {
			r_list_foreach (list, it, th) {
				if (th->pid && th->pid != pid) {
					ptrace (PTRACE_CONT, tid, NULL, contsig);
				}
			}
		}
	}
開發者ID:stefan2904,項目名稱:radare2,代碼行數:54,代碼來源:debug_native.c

示例15: while

void runner::debug() {
    DEBUG_EVENT debug_event;
    while (WaitForDebugEvent(&debug_event, INFINITE)) {
        ContinueDebugEvent(debug_event.dwProcessId,
            debug_event.dwThreadId,
            DBG_CONTINUE);
        if (debug_event.dwDebugEventCode == EXCEPTION_DEBUG_EVENT)
        {
            debug_event.dwProcessId = 0;
        }
        //std::cout << debug_event.u.DebugString.lpDebugStringData << std::endl;
    }
}
開發者ID:rotanov,項目名稱:Spawner,代碼行數:13,代碼來源:runner.cpp


注:本文中的ContinueDebugEvent函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。