Fix typos in SBBreakpoint::GetThreadIndex()/GetThreadName(), and test sequences

for the two API calls.

llvm-svn: 121898
This commit is contained in:
Johnny Chen 2010-12-15 21:39:37 +00:00
parent e2956eeb87
commit 763d1a17a1
2 changed files with 16 additions and 3 deletions

View File

@ -314,14 +314,14 @@ SBBreakpoint::GetThreadIndex() const
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 @@ SBBreakpoint::GetThreadName () const
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));

View File

@ -113,6 +113,19 @@ class BreakpointConditionsTestCase(TestBase):
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)