Changed the formerly pure virtual function:

namespace lldb_private {
    class Thread
    {
        virtual lldb::StopInfoSP
        GetPrivateStopReason() = 0;
    };
}

To not be virtual. The lldb_private::Thread now handles the correct caching and will call a new pure virtual function:

namespace lldb_private {
    class Thread
    {
        virtual bool
        CalculateStopInfo() = 0;
    }
}

This function must be overridden by thead lldb_private::Thread subclass and the only thing it needs to do is to set the Thread::StopInfo() with the current stop reason and return true, or return false if there is no stop reason. The  lldb_private::Thread class will take care of calling this function only when it is required. This allows lldb_private::Thread subclasses to be a bit simpler and not all need to duplicate the cache and invalidation settings.

Also renamed:

lldb::StopInfoSP
lldb_private::Thread::GetPrivateStopReason();

To:

lldb::StopInfoSP
lldb_private::Thread::GetPrivateStopInfo();

Also cleaned up a case where the ThreadPlanStepOverBreakpoint might not re-set its breakpoint if the thread disappears (which was happening due to a bug when using the OperatingSystem plug-ins with memory threads and real threads).

llvm-svn: 181501
This commit is contained in:
Greg Clayton
2013-05-09 01:55:29 +00:00
parent 083fcdb414
commit 6e0ff1a3cb
19 changed files with 240 additions and 400 deletions

View File

@@ -198,36 +198,39 @@ OperatingSystemPython::UpdateThreadList (ThreadList &old_thread_list,
{
uint32_t i;
const uint32_t num_threads = threads_list.GetSize();
for (i=0; i<num_threads; ++i)
if (num_threads > 0)
{
PythonDictionary thread_dict(threads_list.GetItemAtIndex(i));
if (thread_dict)
for (i=0; i<num_threads; ++i)
{
if (thread_dict.GetItemForKey("core"))
PythonDictionary thread_dict(threads_list.GetItemAtIndex(i));
if (thread_dict)
{
// We have some threads that are saying they are on a "core", which means
// they map the threads that are gotten from the lldb_private::Process subclass
// so clear the new threads list so the core threads don't show up
new_thread_list.Clear();
break;
if (thread_dict.GetItemForKey("core"))
{
// We have some threads that are saying they are on a "core", which means
// they map the threads that are gotten from the lldb_private::Process subclass
// so clear the new threads list so the core threads don't show up
new_thread_list.Clear();
break;
}
}
}
for (i=0; i<num_threads; ++i)
{
PythonDictionary thread_dict(threads_list.GetItemAtIndex(i));
if (thread_dict)
{
ThreadSP thread_sp (CreateThreadFromThreadInfo (thread_dict, core_thread_list, old_thread_list, NULL));
if (thread_sp)
new_thread_list.AddThread(thread_sp);
}
}
}
for (i=0; i<num_threads; ++i)
{
PythonDictionary thread_dict(threads_list.GetItemAtIndex(i));
if (thread_dict)
{
ThreadSP thread_sp (CreateThreadFromThreadInfo (thread_dict, core_thread_list, old_thread_list, NULL));
if (thread_sp)
new_thread_list.AddThread(thread_sp);
}
}
}
else
{
if (new_thread_list.GetSize(false) == 0)
new_thread_list = old_thread_list;
}
return new_thread_list.GetSize(false) > 0;
}