本文整理汇总了C++中EventPtr::getEventSignal方法的典型用法代码示例。如果您正苦于以下问题:C++ EventPtr::getEventSignal方法的具体用法?C++ EventPtr::getEventSignal怎么用?C++ EventPtr::getEventSignal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventPtr
的用法示例。
在下文中一共展示了EventPtr::getEventSignal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle_internal
bool PCEventHandler::handle_internal(EventPtr ev) {
proccontrol_printf("%s[%d]: attempting to handle event %s on thread %d/%d\n",
FILE__, __LINE__, ev->getEventType().name().c_str(),
(ev->getProcess() ? ev->getProcess()->getPid() : -1), (ev->getThread() ? ev->getThread()->getLWP() : (Dyninst::LWP)-1));
if(!ev->getProcess())
{
proccontrol_printf("%s[%d]: Event received w/o associated ProcControl process object, treating as handled successfully\n", FILE__, __LINE__);
return true;
}
PCProcess *evProc = static_cast<PCProcess *>(ev->getProcess()->getData());
if( evProc == NULL ) {
proccontrol_printf("%s[%d]: ERROR: handle to Dyninst process is invalid\n",
FILE__, __LINE__);
return true;
}
if( !( ev->getEventType().code() == EventType::ForceTerminate
|| ev->getEventType().code() == EventType::Crash
|| ev->getEventType().code() == EventType::Exit
) )
{
// This means we already saw the entry to exit event and we can no longer
// operate on the process, so ignore the event
if( evProc->isTerminated() ) {
proccontrol_printf("%s[%d]: process already marked terminated, ignoring event\n",
FILE__, __LINE__);
// Still need to make sure ProcControl runs the process until it exits
if( !ev->getProcess()->isTerminated() ) {
Process::ptr tmpProc(pc_const_cast<Process>(ev->getProcess()));
if( !tmpProc->continueProc() ) {
proccontrol_printf("%s[%d]: failed to continue exiting process\n",
FILE__, __LINE__);
}
}
return true;
}
// The process needs to be stopped so we can operate on it
if( !evProc->isStopped() ) {
proccontrol_printf("%s[%d]: stopping process for event handling\n", FILE__,
__LINE__);
if( !evProc->stopProcess() ) {
proccontrol_printf("%s[%d]: failed to stop process for event handling\n", FILE__,
__LINE__);
return false;
}
}
}
// Need to save state because we could be called recursively
bool prevEventHandlingState = evProc->isInEventHandling();
evProc->setInEventHandling(true);
bool ret = true;
switch(ev->getEventType().code()) {
// Errors first
case EventType::Error:
case EventType::Unset:
ret = false;
break;
case EventType::SingleStep: // for now, this should be unused
if( !evProc->isInDebugSuicide() ) ret = false;
break;
// for now these events are skipped
case EventType::Bootstrap:
case EventType::Stop:
break;
// Interesting events
case EventType::Exit:
ret = handleExit(ev->getEventExit(), evProc);
break;
case EventType::Crash:
ret = handleCrash(ev->getEventCrash(), evProc);
break;
case EventType::ForceTerminate:
ret = handleForceTerminate(ev->getEventForceTerminate(), evProc);
break;
case EventType::Fork:
ret = handleFork(ev->getEventFork(), evProc);
break;
case EventType::Exec:
// On Post-Exec, a new PCProcess is created
ret = handleExec(ev->getEventExec(), evProc);
break;
case EventType::UserThreadCreate:
case EventType::LWPCreate:
case EventType::ThreadCreate:
ret = handleThreadCreate(ev->getEventNewThread(), evProc);
break;
case EventType::UserThreadDestroy:
case EventType::LWPDestroy:
case EventType::ThreadDestroy:
ret = handleThreadDestroy(ev->getEventThreadDestroy(), evProc);
break;
case EventType::Signal:
ret = handleSignal(ev->getEventSignal(), evProc);
break;
//.........这里部分代码省略.........