本文整理汇总了C++中SBEvent类的典型用法代码示例。如果您正苦于以下问题:C++ SBEvent类的具体用法?C++ SBEvent怎么用?C++ SBEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SBEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool
SBListener::WaitForEventForBroadcasterWithType
(
uint32_t num_seconds,
const SBBroadcaster &broadcaster,
uint32_t event_type_mask,
SBEvent &event
)
{
if (m_opaque_sp && broadcaster.IsValid())
{
TimeValue time_value;
if (num_seconds != UINT32_MAX)
{
time_value = TimeValue::Now();
time_value.OffsetWithSeconds (num_seconds);
}
EventSP event_sp;
if (m_opaque_sp->WaitForEventForBroadcasterWithType (time_value.IsValid() ? &time_value : NULL,
broadcaster.get(),
event_type_mask,
event_sp))
{
event.reset (event_sp);
return true;
}
}
event.reset (NULL);
return false;
}
示例2: listener_func
void listener_func() {
while (!g_done) {
SBEvent event;
bool got_event = g_listener.WaitForEvent(1, event);
if (got_event) {
if (!event.IsValid())
throw Exception("event is not valid in listener thread");
// send process description
SBProcess process = SBProcess::GetProcessFromEvent(event);
SBStream description;
for (int i = 0; i < process.GetNumThreads(); ++i) {
// send each thread description
description.Clear();
SBThread thread = process.GetThreadAtIndex(i);
thread.GetDescription(description);
g_thread_descriptions.push(description.GetData());
// send each frame function name
uint32_t num_frames = thread.GetNumFrames();
for(int j = 0; j < num_frames; ++j) {
const char* function_name = thread.GetFrameAtIndex(j).GetSymbol().GetName();
if (function_name)
g_frame_functions.push(function_name);
}
}
}
}
}
示例3: while
void
Driver::MainLoop ()
{
SBEvent event;
while (!GetIsDone())
{
m_listener->WaitForEvent (UINT32_MAX, event);
if (event.IsValid())
{
ProcessEvent(event);
}
}
DestroyPseudoTerminal();
CloseIOChannelFile ();
if (!iochannel_thread_exited)
{
event.Clear();
m_listener->GetNextEventForBroadcasterWithType (*m_io_channel_ap,
IOChannel::eBroadcastBitThreadDidExit,
event);
if (!event.IsValid())
{
// Send end EOF to the driver file descriptor
m_io_channel_ap->Stop();
}
}
SBDebugger::Destroy (m_debugger);
}
示例4:
WatchpointEventType
SBWatchpoint::GetWatchpointEventTypeFromEvent(const SBEvent &event) {
if (event.IsValid())
return Watchpoint::WatchpointEventData::GetWatchpointEventTypeFromEvent(
event.GetSP());
return eWatchpointEventTypeInvalidType;
}
示例5: listener_func
void listener_func() {
while (!g_done) {
SBEvent event;
bool got_event = g_listener.WaitForEvent(1, event);
if (got_event) {
if (!event.IsValid())
throw Exception("event is not valid in listener thread");
// send process description
SBProcess process = SBProcess::GetProcessFromEvent(event);
if (!process.IsValid())
throw Exception("process is not valid");
if (SBProcess::GetStateFromEvent(event) != lldb::eStateStopped || SBProcess::GetRestartedFromEvent(event))
continue; // Only interested in "stopped" events.
SBStream description;
for (int i = 0; i < process.GetNumThreads(); ++i) {
// send each thread description
SBThread thread = process.GetThreadAtIndex(i);
// send each frame function name
uint32_t num_frames = thread.GetNumFrames();
for(int j = 0; j < num_frames; ++j) {
const char* function_name = thread.GetFrameAtIndex(j).GetSymbol().GetName();
if (function_name)
g_frame_functions.push(string(function_name));
}
}
}
}
}
示例6:
BreakpointEventType
SBBreakpoint::GetBreakpointEventTypeFromEvent (const SBEvent& event)
{
if (event.IsValid())
return Breakpoint::BreakpointEventData::GetBreakpointEventTypeFromEvent (event.GetSP());
return eBreakpointEventTypeInvalidType;
}
示例7:
bool
SBProcess::GetRestartedFromEvent (const SBEvent &event)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool ret_val = Process::ProcessEventData::GetRestartedFromEvent (event.get());
if (log)
log->Printf ("SBProcess::%s (event.sp=%p) => %d", __FUNCTION__, event.get(), ret_val);
return ret_val;
}
示例8: log
StateType
SBProcess::GetStateFromEvent (const SBEvent &event)
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
StateType ret_val = Process::ProcessEventData::GetStateFromEvent (event.get());
if (log)
log->Printf ("SBProcess::GetStateFromEvent (event.sp=%p) => %s", event.get(),
lldb_private::StateAsCString (ret_val));
return ret_val;
}
示例9: SetIsDone
void
Driver::ProcessEvent(SBEvent& event)
{
if (!event.GetBroadcaster().IsValid())
return;
uint32_t event_type = event.GetType();
if (event.BroadcasterMatchesRef (*m_io_channel_ap))
{
if ((event_type & IOChannel::eBroadcastBitThreadShouldExit) ||
(event_type & IOChannel::eBroadcastBitThreadDidExit))
{
SetIsDone();
if (event_type & IOChannel::eBroadcastBitThreadDidExit)
iochannel_thread_exited = true;
}
else
{
if (HandleIOEvent (event))
SetIsDone();
}
}
else if (SBProcess::EventIsProcessEvent (event))
{
HandleProcessEvent (event);
}
else if (SBBreakpoint::EventIsBreakpointEvent (event))
{
HandleBreakpointEvent (event);
}
else if (event.BroadcasterMatchesRef (m_interpreter->GetBroadcaster()))
{
// TODO: deprecate the eBroadcastBitQuitCommandReceived event
// now that we have SBCommandInterpreter::SetCommandOverrideCallback()
// that can take over a command
if (event_type & SBCommandInterpreter::eBroadcastBitQuitCommandReceived)
{
SetIsDone();
}
else if (event_type & SBCommandInterpreter::eBroadcastBitAsynchronousErrorData)
{
const char *data = SBEvent::GetCStringFromEvent (event);
m_io_channel_ap->ErrWrite (data, strlen(data), ASYNC);
}
else if (event_type & SBCommandInterpreter::eBroadcastBitAsynchronousOutputData)
{
const char *data = SBEvent::GetCStringFromEvent (event);
m_io_channel_ap->OutWrite (data, strlen(data), ASYNC);
}
}
}
示例10: listener_func
void listener_func() {
while (!g_done) {
SBEvent event;
bool got_event = g_listener.WaitForEvent(1, event);
if (got_event) {
if (!event.IsValid())
throw Exception("event is not valid in listener thread");
SBStream description;
event.GetDescription(description);
string str(description.GetData());
g_event_descriptions.push(str);
}
}
}
示例11: if
bool
Driver::HandleIOEvent (const SBEvent &event)
{
bool quit = false;
const uint32_t event_type = event.GetType();
if (event_type & IOChannel::eBroadcastBitHasUserInput)
{
// We got some input (i.e. a command string) from the user; pass it off to the command interpreter for
// handling.
const char *command_string = SBEvent::GetCStringFromEvent(event);
if (command_string == NULL)
command_string = "";
SBCommandReturnObject result;
// We don't want the result to bypass the OutWrite function in IOChannel, as this can result in odd
// output orderings and problems with the prompt.
m_debugger.GetCommandInterpreter().HandleCommand (command_string, result, true);
if (result.GetOutputSize() > 0)
m_io_channel_ap->OutWrite (result.GetOutput(), result.GetOutputSize(), NO_ASYNC);
if (result.GetErrorSize() > 0)
m_io_channel_ap->OutWrite (result.GetError(), result.GetErrorSize(), NO_ASYNC);
// We are done getting and running our command, we can now clear the
// m_waiting_for_command so we can get another one.
m_waiting_for_command = false;
// If our editline input reader is active, it means another input reader
// got pushed onto the input reader and caused us to become deactivated.
// When the input reader above us gets popped, we will get re-activated
// and our prompt will refresh in our callback
if (m_editline_reader.IsActive())
{
ReadyForCommand ();
}
}
else if (event_type & IOChannel::eBroadcastBitUserInterrupt)
{
// This is here to handle control-c interrupts from the user. It has not yet really been implemented.
// TO BE DONE: PROPERLY HANDLE CONTROL-C FROM USER
//m_io_channel_ap->CancelInput();
// Anything else? Send Interrupt to process?
}
else if ((event_type & IOChannel::eBroadcastBitThreadShouldExit) ||
(event_type & IOChannel::eBroadcastBitThreadDidExit))
{
// If the IOChannel thread is trying to go away, then it is definitely
// time to end the debugging session.
quit = true;
}
return quit;
}
示例12: listener_func
void listener_func() {
while (!g_done) {
SBEvent event;
bool got_event = g_listener.WaitForEvent(1, event);
if (got_event) {
if (!event.IsValid())
throw Exception("event is not valid in listener thread");
SBProcess process = SBProcess::GetProcessFromEvent(event);
if (process.GetState() == eStateStopped) {
SBError error = process.Continue();
if (!error.Success())
throw Exception(string("Cannot continue process from listener thread: ")
+ error.GetCString());
g_process_started.push(true);
}
}
}
}
示例13:
void
SBBroadcaster::BroadcastEvent (const SBEvent &event, bool unique)
{
if (m_opaque == NULL)
return;
EventSP event_sp = event.GetSP ();
if (unique)
m_opaque->BroadcastEventIfUnique (event_sp);
else
m_opaque->BroadcastEvent (event_sp);
}
示例14: assert
bool
SBListener::WaitForEvent (uint32_t num_seconds, SBEvent &event)
{
if (m_opaque_ptr)
{
TimeValue time_value;
if (num_seconds != UINT32_MAX)
{
assert (num_seconds != 0); // Take this out after all calls with timeout set to zero have been removed....
time_value = TimeValue::Now();
time_value.OffsetWithSeconds (num_seconds);
}
EventSP event_sp;
if (m_opaque_ptr->WaitForEvent (time_value.IsValid() ? &time_value : NULL, event_sp))
{
event.reset (event_sp);
return true;
}
}
event.reset (NULL);
return false;
}
示例15:
bool
SBListener::GetNextEventForBroadcasterWithType
(
const SBBroadcaster &broadcaster,
uint32_t event_type_mask,
SBEvent &event
)
{
if (m_opaque_ptr && broadcaster.IsValid())
{
EventSP event_sp;
if (m_opaque_ptr->GetNextEventForBroadcasterWithType (broadcaster.get(),
event_type_mask,
event_sp))
{
event.reset (event_sp);
return true;
}
}
event.reset (NULL);
return false;
}