[Lldb-commits] [lldb] r179577 - Adding new Python API function to check for stopped threads.

Andrew Kaylor andrew.kaylor at intel.com
Mon Apr 15 16:33:53 PDT 2013


Author: akaylor
Date: Mon Apr 15 18:33:53 2013
New Revision: 179577

URL: http://llvm.org/viewvc/llvm-project?rev=179577&view=rev
Log:
Adding new Python API function to check for stopped threads.

Modified:
    lldb/trunk/include/lldb/API/SBThread.h
    lldb/trunk/scripts/Python/interface/SBThread.i
    lldb/trunk/source/API/SBThread.cpp

Modified: lldb/trunk/include/lldb/API/SBThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThread.h?rev=179577&r1=179576&r2=179577&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBThread.h (original)
+++ lldb/trunk/include/lldb/API/SBThread.h Mon Apr 15 18:33:53 2013
@@ -151,6 +151,9 @@ public:
     bool
     IsSuspended();
 
+    bool
+    IsStopped();
+
     uint32_t
     GetNumFrames ();
 

Modified: lldb/trunk/scripts/Python/interface/SBThread.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBThread.i?rev=179577&r1=179576&r2=179577&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBThread.i (original)
+++ lldb/trunk/scripts/Python/interface/SBThread.i Mon Apr 15 18:33:53 2013
@@ -178,6 +178,9 @@ public:
     bool
     IsSuspended();
 
+    bool
+    IsStopped();
+
     uint32_t
     GetNumFrames ();
 
@@ -258,6 +261,9 @@ public:
 
         __swig_getmethods__["is_suspended"] = IsSuspended
         if _newclass: is_suspended = property(IsSuspended, None, doc='''A read only property that returns a boolean value that indicates if this thread is suspended.''')
+
+        __swig_getmethods__["is_stopped"] = IsStopped
+        if _newclass: is_stopped = property(IsStopped, None, doc='''A read only property that returns a boolean value that indicates if this thread is stopped but not exited.''')
     %}
 
 };

Modified: lldb/trunk/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=179577&r1=179576&r2=179577&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThread.cpp (original)
+++ lldb/trunk/source/API/SBThread.cpp Mon Apr 15 18:33:53 2013
@@ -16,6 +16,7 @@
 #include "lldb/API/SBStream.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Core/Debugger.h"
+#include "lldb/Core/State.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
@@ -991,6 +992,15 @@ SBThread::IsSuspended()
     return false;
 }
 
+bool
+SBThread::IsStopped()
+{
+    ExecutionContext exe_ctx (m_opaque_sp.get());
+    if (exe_ctx.HasThreadScope())
+        return StateIsStoppedState(exe_ctx.GetThreadPtr()->GetState(), true);
+    return false;
+}
+
 SBProcess
 SBThread::GetProcess ()
 {





More information about the lldb-commits mailing list