[Lldb-commits] [lldb] r157042 - in /lldb/trunk: include/lldb/Target/Process.h include/lldb/Target/Thread.h include/lldb/Target/ThreadList.h source/Commands/CommandObjectRegister.cpp source/Commands/CommandObjectTarget.cpp source/Target/Process.cpp source/Target/Thread.cpp source/Target/ThreadList.cpp
Greg Clayton
gclayton at apple.com
Thu May 17 19:38:05 PDT 2012
Author: gclayton
Date: Thu May 17 21:38:05 2012
New Revision: 157042
URL: http://llvm.org/viewvc/llvm-project?rev=157042&view=rev
Log:
<rdar://problem/11386214>
<rdar://problem/11455913>
"target symbol add" should flush the cached frames
"register write" should flush the thread state in case registers modifications change stack
Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/include/lldb/Target/Thread.h
lldb/trunk/include/lldb/Target/ThreadList.h
lldb/trunk/source/Commands/CommandObjectRegister.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/Thread.cpp
lldb/trunk/source/Target/ThreadList.cpp
Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=157042&r1=157041&r2=157042&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Thu May 17 21:38:05 2012
@@ -2269,6 +2269,18 @@
return m_target;
}
+ //------------------------------------------------------------------
+ /// Flush all data in the process.
+ ///
+ /// Flush the memory caches, all threads, and any other cached data
+ /// in the process.
+ ///
+ /// This function can be called after a world changing event like
+ /// adding a new symbol file, or after the process makes a large
+ /// context switch (from boot ROM to booted into an OS).
+ //------------------------------------------------------------------
+ void
+ Flush ();
//------------------------------------------------------------------
/// Get accessor for the current process state.
Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=157042&r1=157041&r2=157042&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Thu May 17 21:38:05 2012
@@ -274,6 +274,9 @@
Vote
ShouldReportRun (Event *event_ptr);
+ void
+ Flush ();
+
// Return whether this thread matches the specification in ThreadSpec. This is a virtual
// method because at some point we may extend the thread spec with a platform specific
// dictionary of attributes, which then only the platform specific Thread implementation
Modified: lldb/trunk/include/lldb/Target/ThreadList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadList.h?rev=157042&r1=157041&r2=157042&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadList.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadList.h Thu May 17 21:38:05 2012
@@ -60,6 +60,9 @@
Clear();
void
+ Flush();
+
+ void
Destroy();
// Note that "idx" is not the same as the "thread_index". It is a zero
Modified: lldb/trunk/source/Commands/CommandObjectRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectRegister.cpp?rev=157042&r1=157041&r2=157042&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectRegister.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectRegister.cpp Thu May 17 21:38:05 2012
@@ -425,6 +425,9 @@
{
if (reg_ctx->WriteRegister (reg_info, reg_value))
{
+ // Toss all frames and anything else in the thread
+ // after a register has been written.
+ exe_ctx.GetThreadRef().Flush();
result.SetStatus (eReturnStatusSuccessFinishNoResult);
return true;
}
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=157042&r1=157041&r2=157042&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu May 17 21:38:05 2012
@@ -3585,21 +3585,21 @@
Execute (Args& args,
CommandReturnObject &result)
{
- Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+ ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
+ Target *target = exe_ctx.GetTargetPtr();
if (target == NULL)
{
result.AppendError ("invalid target, create a debug target using the 'target create' command");
result.SetStatus (eReturnStatusFailed);
- return false;
}
else
{
+ bool flush = false;
const size_t argc = args.GetArgumentCount();
if (argc == 0)
{
result.AppendError ("one or more symbol file paths must be specified");
result.SetStatus (eReturnStatusFailed);
- return false;
}
else
{
@@ -3633,13 +3633,14 @@
ModuleList module_list;
module_list.Append (old_module_sp);
target->ModulesDidLoad (module_list);
+ flush = true;
}
}
else
{
result.AppendError ("one or more executable image paths must be specified");
result.SetStatus (eReturnStatusFailed);
- return false;
+ break;
}
result.SetStatus (eReturnStatusSuccessFinishResult);
}
@@ -3661,6 +3662,13 @@
}
}
}
+
+ if (flush)
+ {
+ Process *process = exe_ctx.GetProcessPtr();
+ if (process)
+ process->Flush();
+ }
}
return result.Succeeded();
}
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=157042&r1=157041&r2=157042&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu May 17 21:38:05 2012
@@ -4707,6 +4707,12 @@
m_pre_resume_actions.clear();
}
+void
+Process::Flush ()
+{
+ m_thread_list.Flush();
+}
+
//--------------------------------------------------------------
// class Process::SettingsController
//--------------------------------------------------------------
Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=157042&r1=157041&r2=157042&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Thu May 17 21:38:05 2012
@@ -1410,6 +1410,14 @@
}
+void
+Thread::Flush ()
+{
+ ClearStackFrames ();
+ m_reg_context_sp.reset();
+}
+
+
#pragma mark "Thread::SettingsController"
//--------------------------------------------------------------
// class Thread::SettingsController
Modified: lldb/trunk/source/Target/ThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadList.cpp?rev=157042&r1=157041&r2=157042&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadList.cpp (original)
+++ lldb/trunk/source/Target/ThreadList.cpp Thu May 17 21:38:05 2012
@@ -605,4 +605,12 @@
}
}
+void
+ThreadList::Flush ()
+{
+ Mutex::Locker locker(m_threads_mutex);
+ collection::iterator pos, end = m_threads.end();
+ for (pos = m_threads.begin(); pos != end; ++pos)
+ (*pos)->Flush ();
+}
More information about the lldb-commits
mailing list