本文整理汇总了C++中ProcessMessage类的典型用法代码示例。如果您正苦于以下问题:C++ ProcessMessage类的具体用法?C++ ProcessMessage怎么用?C++ ProcessMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProcessMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
bool
ProcessMonitor::MonitorCallback(void *callback_baton,
lldb::pid_t pid,
bool exited,
int signal,
int status)
{
ProcessMessage message;
ProcessMonitor *monitor = static_cast<ProcessMonitor*>(callback_baton);
ProcessFreeBSD *process = monitor->m_process;
bool stop_monitoring;
siginfo_t info;
if (!monitor->GetSignalInfo(pid, &info))
stop_monitoring = true; // pid is gone. Bail.
else {
switch (info.si_signo)
{
case SIGTRAP:
message = MonitorSIGTRAP(monitor, &info, pid);
break;
default:
message = MonitorSignal(monitor, &info, pid);
break;
}
process->SendMessage(message);
stop_monitoring = message.GetKind() == ProcessMessage::eExitMessage;
}
return stop_monitoring;
}
示例2: exit
void exit(int status)
{
ProcessMessage msg;
/* Request immediate termination. */
msg.action = ExitProcess;
msg.number = status;
msg.ipc(PROCSRV_PID, SendReceive, sizeof(msg));
}
示例3: GetID
void
POSIXThread::Notify(const ProcessMessage &message)
{
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD));
if (log)
log->Printf ("POSIXThread::%s () message kind = '%s' for tid %" PRIu64,
__FUNCTION__, message.PrintKind(), GetID());
switch (message.GetKind())
{
default:
assert(false && "Unexpected message kind!");
break;
case ProcessMessage::eExitMessage:
// Nothing to be done.
break;
case ProcessMessage::eLimboMessage:
LimboNotify(message);
break;
case ProcessMessage::eSignalMessage:
SignalNotify(message);
break;
case ProcessMessage::eSignalDeliveredMessage:
SignalDeliveredNotify(message);
break;
case ProcessMessage::eTraceMessage:
TraceNotify(message);
break;
case ProcessMessage::eBreakpointMessage:
BreakNotify(message);
break;
case ProcessMessage::eWatchpointMessage:
WatchNotify(message);
break;
case ProcessMessage::eCrashMessage:
CrashNotify(message);
break;
case ProcessMessage::eNewThreadMessage:
ThreadNotify(message);
break;
case ProcessMessage::eExecMessage:
ExecNotify(message);
break;
}
}
示例4: SignalNotify
void FreeBSDThread::SignalNotify(const ProcessMessage &message) {
int signo = message.GetSignal();
if (message.GetKind() == ProcessMessage::eCrashMessage) {
std::string stop_description = GetCrashReasonString(
message.GetCrashReason(), message.GetFaultAddress());
SetStopInfo(StopInfo::CreateStopReasonWithSignal(
*this, signo, stop_description.c_str()));
} else {
SetStopInfo(StopInfo::CreateStopReasonWithSignal(*this, signo));
}
}
示例5: assert
void
POSIXThread::CrashNotify(const ProcessMessage &message)
{
int signo = message.GetSignal();
assert(message.GetKind() == ProcessMessage::eCrashMessage);
LogSP log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD));
if (log)
log->Printf ("POSIXThread::%s () signo = %i, reason = '%s'", __FUNCTION__, signo, message.PrintCrashReason());
m_stop_info = lldb::StopInfoSP(new POSIXCrashStopInfo(
*this, signo, message.GetCrashReason()));
SetResumeSignal(signo);
}
示例6: WatchNotify
void FreeBSDThread::WatchNotify(const ProcessMessage &message) {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD));
lldb::addr_t halt_addr = message.GetHWAddress();
if (log)
log->Printf(
"FreeBSDThread::%s () Hardware Watchpoint Address = 0x%8.8" PRIx64,
__FUNCTION__, halt_addr);
POSIXBreakpointProtocol *reg_ctx = GetPOSIXBreakpointProtocol();
if (reg_ctx) {
uint32_t num_hw_wps = reg_ctx->NumSupportedHardwareWatchpoints();
uint32_t wp_idx;
for (wp_idx = 0; wp_idx < num_hw_wps; wp_idx++) {
if (reg_ctx->IsWatchpointHit(wp_idx)) {
// Clear the watchpoint hit here
reg_ctx->ClearWatchpointHits();
break;
}
}
if (wp_idx == num_hw_wps)
return;
Target &target = GetProcess()->GetTarget();
lldb::addr_t wp_monitor_addr = reg_ctx->GetWatchpointAddress(wp_idx);
const WatchpointList &wp_list = target.GetWatchpointList();
lldb::WatchpointSP wp_sp = wp_list.FindByAddress(wp_monitor_addr);
assert(wp_sp.get() && "No watchpoint found");
SetStopInfo(
StopInfo::CreateStopReasonWithWatchpointID(*this, wp_sp->GetID()));
}
}
示例7: SetResumeSignal
void
POSIXThread::SignalNotify(const ProcessMessage &message)
{
int signo = message.GetSignal();
m_stop_info = StopInfo::CreateStopReasonWithSignal(*this, signo);
SetResumeSignal(signo);
}
示例8: SetStopInfo
void
POSIXThread::SignalDeliveredNotify(const ProcessMessage &message)
{
int signo = message.GetSignal();
SetStopInfo (StopInfo::CreateStopReasonWithSignal(*this, signo));
SetResumeSignal(signo);
}
示例9: assert
bool
ProcessMonitor::MonitorCallback(void *callback_baton,
lldb::pid_t pid,
bool exited,
int signal,
int status)
{
ProcessMessage message;
ProcessMonitor *monitor = static_cast<ProcessMonitor*>(callback_baton);
ProcessFreeBSD *process = monitor->m_process;
assert(process);
bool stop_monitoring;
struct ptrace_lwpinfo plwp;
int ptrace_err;
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PROCESS));
if (exited)
{
if (log)
log->Printf ("ProcessMonitor::%s() got exit signal, tid = %" PRIu64, __FUNCTION__, pid);
message = ProcessMessage::Exit(pid, status);
process->SendMessage(message);
return pid == process->GetID();
}
if (!monitor->GetLwpInfo(pid, &plwp, ptrace_err))
stop_monitoring = true; // pid is gone. Bail.
else {
switch (plwp.pl_siginfo.si_signo)
{
case SIGTRAP:
message = MonitorSIGTRAP(monitor, &plwp.pl_siginfo, plwp.pl_lwpid);
break;
default:
message = MonitorSignal(monitor, &plwp.pl_siginfo, plwp.pl_lwpid);
break;
}
process->SendMessage(message);
stop_monitoring = message.GetKind() == ProcessMessage::eExitMessage;
}
return stop_monitoring;
}
示例10: lock
void
ProcessFreeBSD::SendMessage(const ProcessMessage &message)
{
Mutex::Locker lock(m_message_mutex);
switch (message.GetKind())
{
case ProcessMessage::eInvalidMessage:
return;
case ProcessMessage::eAttachMessage:
SetPrivateState(eStateStopped);
return;
case ProcessMessage::eLimboMessage:
case ProcessMessage::eExitMessage:
m_exit_status = message.GetExitStatus();
SetExitStatus(m_exit_status, NULL);
break;
case ProcessMessage::eSignalMessage:
case ProcessMessage::eSignalDeliveredMessage:
case ProcessMessage::eBreakpointMessage:
case ProcessMessage::eTraceMessage:
case ProcessMessage::eWatchpointMessage:
case ProcessMessage::eCrashMessage:
SetPrivateState(eStateStopped);
break;
case ProcessMessage::eNewThreadMessage:
assert(0 && "eNewThreadMessage unexpected on FreeBSD");
break;
case ProcessMessage::eExecMessage:
SetPrivateState(eStateStopped);
break;
}
m_message_queue.push(message);
}
示例11: log
void
POSIXThread::Notify(const ProcessMessage &message)
{
LogSP log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD));
if (log)
log->Printf ("POSIXThread::%s () message kind = '%s'", __FUNCTION__, message.PrintKind());
switch (message.GetKind())
{
default:
assert(false && "Unexpected message kind!");
break;
case ProcessMessage::eLimboMessage:
LimboNotify(message);
break;
case ProcessMessage::eSignalMessage:
SignalNotify(message);
break;
case ProcessMessage::eSignalDeliveredMessage:
SignalDeliveredNotify(message);
break;
case ProcessMessage::eTraceMessage:
TraceNotify(message);
break;
case ProcessMessage::eBreakpointMessage:
BreakNotify(message);
break;
case ProcessMessage::eCrashMessage:
CrashNotify(message);
break;
}
}
示例12: notifyMachineGuard
/**
* This method sends a message to the machined process.
*/
void WatcherNub::notifyMachineGuard()
{
u_int16_t port = 0;
socket_.getlocaladdress( &port, NULL );
ProcessMessage pm;
pm.param_ = pm.PARAM_IS_MSGTYPE |
(registered_ ? pm.REGISTER : pm.DEREGISTER);
pm.category_ = pm.WATCHER_NUB;
pm.uid_ = getUserId();
pm.pid_ = mf_getpid();
pm.port_ = port;
pm.id_ = id_;
pm.name_ = abrv_;
uint32 destip = htonl( 0x7F000001U );
int reason;
if ((reason = pm.sendAndRecv( 0, destip )) != Mercury::REASON_SUCCESS)
{
ERROR_MSG( "Couldn't register watcher nub with machined: %s\n",
Mercury::reasonToString( (Mercury::Reason)reason ) );
}
}
示例13: guard
void ProcessFreeBSD::SendMessage(const ProcessMessage &message) {
std::lock_guard<std::recursive_mutex> guard(m_message_mutex);
switch (message.GetKind()) {
case ProcessMessage::eInvalidMessage:
return;
case ProcessMessage::eAttachMessage:
SetPrivateState(eStateStopped);
return;
case ProcessMessage::eLimboMessage:
case ProcessMessage::eExitMessage:
SetExitStatus(message.GetExitStatus(), NULL);
break;
case ProcessMessage::eSignalMessage:
case ProcessMessage::eSignalDeliveredMessage:
case ProcessMessage::eBreakpointMessage:
case ProcessMessage::eTraceMessage:
case ProcessMessage::eWatchpointMessage:
case ProcessMessage::eCrashMessage:
SetPrivateState(eStateStopped);
break;
case ProcessMessage::eNewThreadMessage:
llvm_unreachable("eNewThreadMessage unexpected on FreeBSD");
break;
case ProcessMessage::eExecMessage:
SetPrivateState(eStateStopped);
break;
}
m_message_queue.push(message);
}
示例14: lock
void
ProcessPOSIX::SendMessage(const ProcessMessage &message)
{
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PROCESS));
Mutex::Locker lock(m_message_mutex);
Mutex::Locker thread_lock(m_thread_list.GetMutex());
POSIXThread *thread = static_cast<POSIXThread*>(
m_thread_list.FindThreadByID(message.GetTID(), false).get());
switch (message.GetKind())
{
case ProcessMessage::eInvalidMessage:
return;
case ProcessMessage::eAttachMessage:
SetPrivateState(eStateStopped);
return;
case ProcessMessage::eLimboMessage:
assert(thread);
thread->SetState(eStateStopped);
if (message.GetTID() == GetID())
{
m_exit_status = message.GetExitStatus();
if (m_exit_now)
{
SetPrivateState(eStateExited);
m_monitor->Detach(GetID());
}
else
{
StopAllThreads(message.GetTID());
SetPrivateState(eStateStopped);
}
}
else
{
StopAllThreads(message.GetTID());
SetPrivateState(eStateStopped);
}
break;
case ProcessMessage::eExitMessage:
if (thread != nullptr)
thread->SetState(eStateExited);
else
{
if (log)
log->Warning ("ProcessPOSIX::%s eExitMessage for TID %" PRIu64 " failed to find a thread to mark as eStateExited, ignoring", __FUNCTION__, message.GetTID ());
}
// FIXME: I'm not sure we need to do this.
if (message.GetTID() == GetID())
{
SetExitStatus(message.GetExitStatus(), NULL);
}
else if (!IsAThreadRunning())
SetPrivateState(eStateStopped);
break;
case ProcessMessage::eSignalMessage:
case ProcessMessage::eSignalDeliveredMessage:
if (message.GetSignal() == SIGSTOP &&
AddThreadForInitialStopIfNeeded(message.GetTID()))
return;
// Intentional fall-through
case ProcessMessage::eBreakpointMessage:
case ProcessMessage::eTraceMessage:
case ProcessMessage::eWatchpointMessage:
case ProcessMessage::eCrashMessage:
assert(thread);
thread->SetState(eStateStopped);
StopAllThreads(message.GetTID());
SetPrivateState(eStateStopped);
break;
case ProcessMessage::eNewThreadMessage:
{
lldb::tid_t new_tid = message.GetChildTID();
if (WaitingForInitialStop(new_tid))
{
m_monitor->WaitForInitialTIDStop(new_tid);
}
assert(thread);
thread->SetState(eStateStopped);
StopAllThreads(message.GetTID());
SetPrivateState(eStateStopped);
break;
}
case ProcessMessage::eExecMessage:
{
assert(thread);
thread->SetState(eStateStopped);
StopAllThreads(message.GetTID());
SetPrivateState(eStateStopped);
//.........这里部分代码省略.........
示例15: lock
void
ProcessPOSIX::SendMessage(const ProcessMessage &message)
{
Mutex::Locker lock(m_message_mutex);
Mutex::Locker thread_lock(m_thread_list.GetMutex());
POSIXThread *thread = static_cast<POSIXThread*>(
m_thread_list.FindThreadByID(message.GetTID(), false).get());
switch (message.GetKind())
{
case ProcessMessage::eInvalidMessage:
return;
case ProcessMessage::eLimboMessage:
assert(thread);
thread->SetState(eStateStopped);
if (message.GetTID() == GetID())
{
m_exit_status = message.GetExitStatus();
if (m_exit_now)
{
SetPrivateState(eStateExited);
m_monitor->Detach(GetID());
}
else
{
StopAllThreads(message.GetTID());
SetPrivateState(eStateStopped);
}
}
else
{
StopAllThreads(message.GetTID());
SetPrivateState(eStateStopped);
}
break;
case ProcessMessage::eExitMessage:
assert(thread);
thread->SetState(eStateExited);
// FIXME: I'm not sure we need to do this.
if (message.GetTID() == GetID())
{
m_exit_status = message.GetExitStatus();
SetExitStatus(m_exit_status, NULL);
}
else if (!IsAThreadRunning())
SetPrivateState(eStateStopped);
break;
assert(thread);
thread->SetState(eStateStopped);
StopAllThreads(message.GetTID());
SetPrivateState(eStateStopped);
break;
case ProcessMessage::eSignalMessage:
case ProcessMessage::eSignalDeliveredMessage:
if (message.GetSignal() == SIGSTOP &&
AddThreadForInitialStopIfNeeded(message.GetTID()))
return;
// Intentional fall-through
case ProcessMessage::eBreakpointMessage:
case ProcessMessage::eTraceMessage:
case ProcessMessage::eWatchpointMessage:
case ProcessMessage::eNewThreadMessage:
case ProcessMessage::eCrashMessage:
assert(thread);
thread->SetState(eStateStopped);
StopAllThreads(message.GetTID());
SetPrivateState(eStateStopped);
break;
}
m_message_queue.push(message);
}