diff options
author | Jim Ingham <jingham@apple.com> | 2012-10-10 18:32:14 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2012-10-10 18:32:14 +0000 |
commit | 4f465cff8a1591a821d13c7fb34bfc56c1d1d96f (patch) | |
tree | efe067b447ee152883e2235bf3a95c23544d07c4 /lldb/source/API/SBThread.cpp | |
parent | 9a6717f647653eef94344f9d31239a1128998fa3 (diff) | |
download | bcm5719-llvm-4f465cff8a1591a821d13c7fb34bfc56c1d1d96f.tar.gz bcm5719-llvm-4f465cff8a1591a821d13c7fb34bfc56c1d1d96f.zip |
Change the Thread constructor over to take a Process& rather than a ProcessSP. We can't create Threads with a NULL ProcessSP, so it makes no sense to use the SP.
Then make the Thread a Broadcaster, and get it to broadcast when the selected frame is changed (but only from the Command Line) and when Thread::ReturnFromFrame
changes the stack.
Made the Driver use this notification to print the new thread status rather than doing it in the command.
Fixed a few places where people were setting their broadcaster class by hand rather than using the static broadcaster class call.
<rdar://problem/12383087>
llvm-svn: 165640
Diffstat (limited to 'lldb/source/API/SBThread.cpp')
-rw-r--r-- | lldb/source/API/SBThread.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp index 5a09dcc23a8..f895a3d40d1 100644 --- a/lldb/source/API/SBThread.cpp +++ b/lldb/source/API/SBThread.cpp @@ -32,6 +32,7 @@ #include "lldb/API/SBAddress.h" #include "lldb/API/SBDebugger.h" +#include "lldb/API/SBEvent.h" #include "lldb/API/SBFrame.h" #include "lldb/API/SBProcess.h" #include "lldb/API/SBValue.h" @@ -39,6 +40,12 @@ using namespace lldb; using namespace lldb_private; +const char * +SBThread::GetBroadcasterClassName () +{ + return Thread::GetStaticBroadcasterClass().AsCString(); +} + //---------------------------------------------------------------------- // Constructors //---------------------------------------------------------------------- @@ -1123,6 +1130,24 @@ SBThread::SetSelectedFrame (uint32_t idx) return sb_frame; } +bool +SBThread::EventIsThreadEvent (const SBEvent &event) +{ + return Thread::ThreadEventData::GetEventDataFromEvent(event.get()) != NULL; +} + +SBFrame +SBThread::GetStackFrameFromEvent (const SBEvent &event) +{ + return Thread::ThreadEventData::GetStackFrameFromEvent (event.get()); + +} + +SBThread +SBThread::GetThreadFromEvent (const SBEvent &event) +{ + return Thread::ThreadEventData::GetThreadFromEvent (event.get()); +} bool SBThread::operator == (const SBThread &rhs) const @@ -1137,6 +1162,22 @@ SBThread::operator != (const SBThread &rhs) const } bool +SBThread::GetStatus (SBStream &status) const +{ + Stream &strm = status.ref(); + + ExecutionContext exe_ctx (m_opaque_sp.get()); + if (exe_ctx.HasThreadScope()) + { + exe_ctx.GetThreadPtr()->GetStatus(strm, 0, 1, 1); + } + else + strm.PutCString ("No status"); + + return true; +} + +bool SBThread::GetDescription (SBStream &description) const { Stream &strm = description.ref(); |