本文整理汇总了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;
}
示例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;
}
示例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
}
示例4: LLOG
bool Pdb::Continue()
{
LLOG("** Continue");
running = true;
ContinueDebugEvent(event.dwProcessId, event.dwThreadId, DBG_CONTINUE);
return RunToException();
}
示例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);
}
}
示例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;
}
示例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
}
示例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;
}
示例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();
}
}
示例10: DoContinueDebugEvent
/*
* DoContinueDebugEvent
*/
static BOOL DoContinueDebugEvent( DWORD continue_how )
{
SetLastError( 0 );
if( !DidWaitForDebugEvent ) {
return( FALSE );
}
return( ContinueDebugEvent( DebugeePid, LastDebugEventTid, continue_how ) );
}
示例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);
}
示例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
}
示例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);
}
示例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);
}
}
}
}
示例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;
}
}