eBroadcastBitStackChanged = (1 << 0),
eBroadcastBitThreadSuspended = (1 << 1),
eBroadcastBitThreadResumed = (1 << 2),
- eBroadcastBitSelectedFrameChanged = (1 << 3)
+ eBroadcastBitSelectedFrameChanged = (1 << 3),
+ eBroadcastBitThreadSelected = (1 << 4)
};
static const char *
public Broadcaster
{
friend class ThreadEventData;
+friend class ThreadList;
public:
//------------------------------------------------------------------
eBroadcastBitStackChanged = (1 << 0),
eBroadcastBitThreadSuspended = (1 << 1),
eBroadcastBitThreadResumed = (1 << 2),
- eBroadcastBitSelectedFrameChanged = (1 << 3)
+ eBroadcastBitSelectedFrameChanged = (1 << 3),
+ eBroadcastBitThreadSelected = (1 << 4)
};
static ConstString &GetStaticBroadcasterClass ();
GetSelectedThread ();
bool
- SetSelectedThreadByID (lldb::tid_t tid);
+ SetSelectedThreadByID (lldb::tid_t tid, bool notify = false);
bool
- SetSelectedThreadByIndexID (uint32_t index_id);
+ SetSelectedThreadByIndexID (uint32_t index_id, bool notify = false);
void
Clear();
protected:
+ void
+ NotifySelectedThreadChanged (lldb::tid_t tid);
+
typedef std::vector<lldb::ThreadSP> collection;
//------------------------------------------------------------------
// Classes that inherit from Process can see and modify these
return false;
}
- process->GetThreadList().SetSelectedThreadByID(new_thread->GetID());
+ process->GetThreadList().SetSelectedThreadByID(new_thread->GetID(), true);
result.SetStatus (eReturnStatusSuccessFinishNoResult);
- const uint32_t start_frame = 0;
- const uint32_t num_frames = 1;
- const uint32_t num_frames_with_source = 1;
- new_thread->GetStatus (result.GetOutputStream(),
- start_frame,
- num_frames,
- num_frames_with_source);
-
return result.Succeeded();
}
}
bool
-ThreadList::SetSelectedThreadByID (lldb::tid_t tid)
+ThreadList::SetSelectedThreadByID (lldb::tid_t tid, bool notify)
{
Mutex::Locker locker(m_threads_mutex);
ThreadSP selected_thread_sp(FindThreadByID(tid));
else
m_selected_tid = LLDB_INVALID_THREAD_ID;
+ if (notify)
+ NotifySelectedThreadChanged(m_selected_tid);
+
return m_selected_tid != LLDB_INVALID_THREAD_ID;
}
bool
-ThreadList::SetSelectedThreadByIndexID (uint32_t index_id)
+ThreadList::SetSelectedThreadByIndexID (uint32_t index_id, bool notify)
{
Mutex::Locker locker(m_threads_mutex);
ThreadSP selected_thread_sp (FindThreadByIndexID(index_id));
else
m_selected_tid = LLDB_INVALID_THREAD_ID;
+ if (notify)
+ NotifySelectedThreadChanged(m_selected_tid);
+
return m_selected_tid != LLDB_INVALID_THREAD_ID;
}
void
+ThreadList::NotifySelectedThreadChanged (lldb::tid_t tid)
+{
+ ThreadSP selected_thread_sp (FindThreadByID(tid));
+ if (selected_thread_sp->EventTypeHasListeners(Thread::eBroadcastBitThreadSelected))
+ selected_thread_sp->BroadcastEvent(Thread::eBroadcastBitThreadSelected,
+ new Thread::ThreadEventData(selected_thread_sp));
+}
+
+void
ThreadList::Update (ThreadList &rhs)
{
if (this != &rhs)
// reprint the thread status for that thread.
using namespace lldb;
const uint32_t event_type = event.GetType();
- if (event_type == SBThread::eBroadcastBitStackChanged)
+ if (event_type == SBThread::eBroadcastBitStackChanged
+ || event_type == SBThread::eBroadcastBitThreadSelected)
{
SBThread thread = SBThread::GetThreadFromEvent (event);
if (thread.IsValid())
SBTarget::eBroadcastBitBreakpointChanged);
listener.StartListeningForEventClass(m_debugger,
SBThread::GetBroadcasterClassName(),
- SBThread::eBroadcastBitStackChanged);
+ SBThread::eBroadcastBitStackChanged |
+ SBThread::eBroadcastBitThreadSelected);
listener.StartListeningForEvents (*m_io_channel_ap,
IOChannel::eBroadcastBitHasUserInput |
IOChannel::eBroadcastBitUserInterrupt |