From 5a6fa540dcc0a86b6e4412ad27bbb0a732bc859b Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 3 Jun 2011 20:40:54 +0000 Subject: [PATCH] Move SaveFrameZeroState and RestoreSaveFrameZero implementations to Thread base class llvm-svn: 132586 --- lldb/include/lldb/Target/Thread.h | 4 +-- .../Plugins/Process/Linux/LinuxThread.cpp | 12 -------- .../Plugins/Process/Linux/LinuxThread.h | 7 ----- .../MacOSX-User/source/ThreadMacOSX.cpp | 29 ------------------- .../Process/MacOSX-User/source/ThreadMacOSX.h | 6 ---- .../Process/gdb-remote/ThreadGDBRemote.cpp | 26 ----------------- .../Process/gdb-remote/ThreadGDBRemote.h | 6 ---- lldb/source/Target/Thread.cpp | 27 +++++++++++++++++ 8 files changed, 29 insertions(+), 88 deletions(-) diff --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h index 03fb414534da..395bff3e72d3 100644 --- a/lldb/include/lldb/Target/Thread.h +++ b/lldb/include/lldb/Target/Thread.h @@ -751,10 +751,10 @@ protected: SetStopInfo (const lldb::StopInfoSP &stop_info_sp); virtual bool - SaveFrameZeroState (RegisterCheckpoint &checkpoint) = 0; + SaveFrameZeroState (RegisterCheckpoint &checkpoint); virtual bool - RestoreSaveFrameZero (const RegisterCheckpoint &checkpoint) = 0; + RestoreSaveFrameZero (const RegisterCheckpoint &checkpoint); virtual lldb_private::Unwind * GetUnwinder () = 0; diff --git a/lldb/source/Plugins/Process/Linux/LinuxThread.cpp b/lldb/source/Plugins/Process/Linux/LinuxThread.cpp index bac9d48c3cee..c6e0e553e44c 100644 --- a/lldb/source/Plugins/Process/Linux/LinuxThread.cpp +++ b/lldb/source/Plugins/Process/Linux/LinuxThread.cpp @@ -85,18 +85,6 @@ LinuxThread::GetRegisterContext() return m_reg_context_sp; } -bool -LinuxThread::SaveFrameZeroState(RegisterCheckpoint &checkpoint) -{ - return false; -} - -bool -LinuxThread::RestoreSaveFrameZero(const RegisterCheckpoint &checkpoint) -{ - return false; -} - lldb::RegisterContextSP LinuxThread::CreateRegisterContextForFrame(lldb_private::StackFrame *frame) { diff --git a/lldb/source/Plugins/Process/Linux/LinuxThread.h b/lldb/source/Plugins/Process/Linux/LinuxThread.h index cafc83a7c875..e7d23b840f96 100644 --- a/lldb/source/Plugins/Process/Linux/LinuxThread.h +++ b/lldb/source/Plugins/Process/Linux/LinuxThread.h @@ -54,13 +54,6 @@ public: void Notify(const ProcessMessage &message); -protected: - virtual bool - SaveFrameZeroState(RegisterCheckpoint &checkpoint); - - virtual bool - RestoreSaveFrameZero(const RegisterCheckpoint &checkpoint); - private: RegisterContextLinux * GetRegisterContextLinux () diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp index 66bd5366f608..08df10c1913c 100644 --- a/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp +++ b/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp @@ -632,35 +632,6 @@ ThreadMacOSX::SetHardwareWatchpoint (const WatchpointLocation *wp) } -bool -ThreadMacOSX::SaveFrameZeroState (RegisterCheckpoint &checkpoint) -{ - lldb::StackFrameSP frame_sp(GetStackFrameAtIndex (0)); - if (frame_sp) - { - checkpoint.SetStackID(frame_sp->GetStackID()); - return frame_sp->GetRegisterContext()->ReadAllRegisterValues (checkpoint.GetData()); - } - return false; -} - -bool -ThreadMacOSX::RestoreSaveFrameZero (const RegisterCheckpoint &checkpoint) -{ - lldb::StackFrameSP frame_sp(GetStackFrameAtIndex (0)); - if (frame_sp) - { - bool ret = frame_sp->GetRegisterContext()->WriteAllRegisterValues (checkpoint.GetData()); - - // Clear out all stack frames as our world just changed. - ClearStackFrames(); - frame_sp->GetRegisterContext()->InvalidateIfNeeded(true); - - return ret; - } - return false; -} - bool ThreadMacOSX::ClearHardwareBreakpoint (const BreakpointSite *bp) { diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.h b/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.h index 3f122c234abf..25ca7c88b49e 100644 --- a/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.h +++ b/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.h @@ -118,12 +118,6 @@ public: GetPrivateStopReason (); protected: - virtual bool - SaveFrameZeroState (RegisterCheckpoint &checkpoint); - - virtual bool - RestoreSaveFrameZero (const RegisterCheckpoint &checkpoint); - bool GetIdentifierInfo (); diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp index 8ed7edaedb41..0be5edf096f2 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp @@ -221,32 +221,6 @@ ThreadGDBRemote::PrivateSetRegisterValue (uint32_t reg, StringExtractor &respons return gdb_reg_ctx->PrivateSetRegisterValue (reg, response); } -bool -ThreadGDBRemote::SaveFrameZeroState (RegisterCheckpoint &checkpoint) -{ - lldb::StackFrameSP frame_sp(GetStackFrameAtIndex (0)); - if (frame_sp) - { - checkpoint.SetStackID(frame_sp->GetStackID()); - return frame_sp->GetRegisterContext()->ReadAllRegisterValues (checkpoint.GetData()); - } - return false; -} - -bool -ThreadGDBRemote::RestoreSaveFrameZero (const RegisterCheckpoint &checkpoint) -{ - lldb::StackFrameSP frame_sp(GetStackFrameAtIndex (0)); - if (frame_sp) - { - bool ret = frame_sp->GetRegisterContext()->WriteAllRegisterValues (checkpoint.GetData()); - frame_sp->GetRegisterContext()->InvalidateIfNeeded(true); - ClearStackFrames(); - return ret; - } - return false; -} - lldb::StopInfoSP ThreadGDBRemote::GetPrivateStopReason () { diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h index c085b6c1485a..2fdb4d7cb102 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h @@ -99,12 +99,6 @@ protected: friend class ProcessGDBRemote; - virtual bool - SaveFrameZeroState (RegisterCheckpoint &checkpoint); - - virtual bool - RestoreSaveFrameZero (const RegisterCheckpoint &checkpoint); - bool PrivateSetRegisterValue (uint32_t reg, StringExtractor &response); diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 288694bfffda..b1a3c15b6b3b 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -1156,7 +1156,34 @@ Thread::GetStackFrameStatus (Stream& strm, source_lines_after); } +bool +Thread::SaveFrameZeroState (RegisterCheckpoint &checkpoint) +{ + lldb::StackFrameSP frame_sp(GetStackFrameAtIndex (0)); + if (frame_sp) + { + checkpoint.SetStackID(frame_sp->GetStackID()); + return frame_sp->GetRegisterContext()->ReadAllRegisterValues (checkpoint.GetData()); + } + return false; +} +bool +Thread::RestoreSaveFrameZero (const RegisterCheckpoint &checkpoint) +{ + lldb::StackFrameSP frame_sp(GetStackFrameAtIndex (0)); + if (frame_sp) + { + bool ret = frame_sp->GetRegisterContext()->WriteAllRegisterValues (checkpoint.GetData()); + + // Clear out all stack frames as our world just changed. + ClearStackFrames(); + frame_sp->GetRegisterContext()->InvalidateIfNeeded(true); + + return ret; + } + return false; +} #pragma mark "Thread::SettingsController" //--------------------------------------------------------------