[Lldb-commits] [lldb] r121898 - in /lldb/trunk: source/API/SBBreakpoint.cpp test/breakpoint_conditions/TestBreakpointConditions.py

Johnny Chen johnny.chen at apple.com
Wed Dec 15 13:39:37 PST 2010


Author: johnny
Date: Wed Dec 15 15:39:37 2010
New Revision: 121898

URL: http://llvm.org/viewvc/llvm-project?rev=121898&view=rev
Log:
Fix typos in SBBreakpoint::GetThreadIndex()/GetThreadName(), and test sequences
for the two API calls.

Modified:
    lldb/trunk/source/API/SBBreakpoint.cpp
    lldb/trunk/test/breakpoint_conditions/TestBreakpointConditions.py

Modified: lldb/trunk/source/API/SBBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=121898&r1=121897&r2=121898&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpoint.cpp (original)
+++ lldb/trunk/source/API/SBBreakpoint.cpp Wed Dec 15 15:39:37 2010
@@ -314,14 +314,14 @@
     if (m_opaque_sp)
     {
         const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec();
-        if (thread_spec == NULL)
+        if (thread_spec != NULL)
             thread_idx = thread_spec->GetIndex();
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBBreakpoint(%p)::GetThreadIndex () => %u", m_opaque_sp.get(), thread_idx);
 
-    return UINT32_MAX;
+    return thread_idx;
 }
     
 
@@ -343,7 +343,7 @@
     if (m_opaque_sp)
     {
         const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec();
-        if (thread_spec == NULL)
+        if (thread_spec != NULL)
             name = thread_spec->GetName();
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));

Modified: lldb/trunk/test/breakpoint_conditions/TestBreakpointConditions.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/breakpoint_conditions/TestBreakpointConditions.py?rev=121898&r1=121897&r2=121898&view=diff
==============================================================================
--- lldb/trunk/test/breakpoint_conditions/TestBreakpointConditions.py (original)
+++ lldb/trunk/test/breakpoint_conditions/TestBreakpointConditions.py Wed Dec 15 15:39:37 2010
@@ -113,6 +113,19 @@
                         breakpoint.GetNumLocations() == 1,
                         VALID_BREAKPOINT)
 
+        # We didn't associate a thread index with the breakpoint, so it should be invalid.
+        self.assertTrue(breakpoint.GetThreadIndex() == lldb.UINT32_MAX,
+                        "The thread index should be invalid")
+        # The thread name should be invalid, too.
+        self.assertTrue(breakpoint.GetThreadName() is None,
+                        "The thread name should be invalid")
+
+        # Let's set the thread index for this breakpoint and verify that it is,
+        # indeed, being set correctly.
+        breakpoint.SetThreadIndex(1) # There's only one thread for the process.
+        self.assertTrue(breakpoint.GetThreadIndex() == 1,
+                        "The thread index has been set correctly")
+
         # Get the breakpoint location from breakpoint after we verified that,
         # indeed, it has one location.
         location = breakpoint.GetLocationAtIndex(0)





More information about the lldb-commits mailing list