diff options
author | Greg Clayton <gclayton@apple.com> | 2013-05-09 01:55:29 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-05-09 01:55:29 +0000 |
commit | 6e0ff1a3cb5a1719c12ce156c4297d724c20b955 (patch) | |
tree | 2ea43845a7393dc9bb2df095f72b25a3393ca914 /lldb/source/Plugins/Process/gdb-remote | |
parent | 083fcdb41448362b803c47fe85dfeb830d25220c (diff) | |
download | bcm5719-llvm-6e0ff1a3cb5a1719c12ce156c4297d724c20b955.tar.gz bcm5719-llvm-6e0ff1a3cb5a1719c12ce156c4297d724c20b955.zip |
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
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
3 files changed, 11 insertions, 49 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 0302f9312b7..0008dbfa288 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1770,7 +1770,7 @@ ProcessGDBRemote::DoDestroy () for (size_t i = 0; i < num_threads; i++) { ThreadSP thread_sp = threads.GetThreadAtIndex(i); - StopInfoSP stop_info_sp = thread_sp->GetPrivateStopReason(); + StopInfoSP stop_info_sp = thread_sp->GetPrivateStopInfo(); StopReason reason = eStopReasonInvalid; if (stop_info_sp) reason = stop_info_sp->GetStopReason(); @@ -1805,7 +1805,7 @@ ProcessGDBRemote::DoDestroy () for (size_t i = 0; i < num_threads; i++) { ThreadSP thread_sp = threads.GetThreadAtIndex(i); - StopInfoSP stop_info_sp = thread_sp->GetPrivateStopReason(); + StopInfoSP stop_info_sp = thread_sp->GetPrivateStopInfo(); StopReason reason = eStopReasonInvalid; if (stop_info_sp) reason = stop_info_sp->GetStopReason(); diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp index 40b367c3993..38fb84d66ef 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp @@ -197,56 +197,18 @@ ThreadGDBRemote::PrivateSetRegisterValue (uint32_t reg, StringExtractor &respons return gdb_reg_ctx->PrivateSetRegisterValue (reg, response); } -lldb::StopInfoSP -ThreadGDBRemote::GetPrivateStopReason () +bool +ThreadGDBRemote::CalculateStopInfo () { ProcessSP process_sp (GetProcess()); if (process_sp) { - const uint32_t process_stop_id = process_sp->GetStopID(); - if (m_thread_stop_reason_stop_id == process_stop_id) - { - // Our stop info is up to date even if it is empty... - return m_actual_stop_info_sp; - } - - if (m_actual_stop_info_sp && m_actual_stop_info_sp->IsValid()) - { - // The stop info is up to date, reset it so everything updates - SetStopInfo (m_actual_stop_info_sp); - } - else - { - if (IsStillAtLastBreakpointHit()) - { - SetStopInfo(m_actual_stop_info_sp); - } - else - { - // If GetGDBProcess().SetThreadStopInfo() doesn't find a stop reason - // for this thread, then m_actual_stop_info_sp will not ever contain - // a valid stop reason and the "m_actual_stop_info_sp->IsValid() == false" - // check will never be able to tell us if we have the correct stop info - // for this thread and we will continually send qThreadStopInfo packets - // down to the remote GDB server, so we need to keep our own notion - // of the stop ID that m_actual_stop_info_sp is valid for (even if it - // contains nothing). We use m_thread_stop_reason_stop_id for this below. - m_actual_stop_info_sp.reset(); - - StringExtractorGDBRemote stop_packet; - ProcessGDBRemote *gdb_process = static_cast<ProcessGDBRemote *>(process_sp.get()); - if (gdb_process->GetGDBRemote().GetThreadStopInfo(GetProtocolID(), stop_packet)) - { - gdb_process->SetThreadStopInfo (stop_packet); - } - else - { - SetStopInfo (StopInfoSP()); - } - } - } + StringExtractorGDBRemote stop_packet; + ProcessGDBRemote *gdb_process = static_cast<ProcessGDBRemote *>(process_sp.get()); + if (gdb_process->GetGDBRemote().GetThreadStopInfo(GetProtocolID(), stop_packet)) + return gdb_process->SetThreadStopInfo (stop_packet) == eStateStopped; } - return m_actual_stop_info_sp; + return false; } diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h index 8dfc4bb78cb..50a3f19c650 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h @@ -98,8 +98,8 @@ protected: void SetStopInfoFromPacket (StringExtractor &stop_packet, uint32_t stop_id); - virtual lldb::StopInfoSP - GetPrivateStopReason (); + virtual bool + CalculateStopInfo (); }; |