summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
Diffstat (limited to 'lldb')
-rw-r--r--lldb/include/lldb/Target/Process.h12
-rw-r--r--lldb/include/lldb/Target/Thread.h3
-rw-r--r--lldb/include/lldb/Target/ThreadList.h3
-rw-r--r--lldb/source/Commands/CommandObjectRegister.cpp3
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp16
-rw-r--r--lldb/source/Target/Process.cpp6
-rw-r--r--lldb/source/Target/Thread.cpp8
-rw-r--r--lldb/source/Target/ThreadList.cpp8
8 files changed, 55 insertions, 4 deletions
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index e673c4434b5..2ec1f85c0a0 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -2269,6 +2269,18 @@ public:
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.
diff --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h
index 94463f1cd2e..cdd66c0199e 100644
--- a/lldb/include/lldb/Target/Thread.h
+++ b/lldb/include/lldb/Target/Thread.h
@@ -274,6 +274,9 @@ public:
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
diff --git a/lldb/include/lldb/Target/ThreadList.h b/lldb/include/lldb/Target/ThreadList.h
index be6a1a2d402..5acc87360eb 100644
--- a/lldb/include/lldb/Target/ThreadList.h
+++ b/lldb/include/lldb/Target/ThreadList.h
@@ -60,6 +60,9 @@ public:
Clear();
void
+ Flush();
+
+ void
Destroy();
// Note that "idx" is not the same as the "thread_index". It is a zero
diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp
index c34e6eee2e4..37ebb786af9 100644
--- a/lldb/source/Commands/CommandObjectRegister.cpp
+++ b/lldb/source/Commands/CommandObjectRegister.cpp
@@ -425,6 +425,9 @@ public:
{
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;
}
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index c7b644f9087..a38f143eb22 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -3585,21 +3585,21 @@ public:
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 @@ public:
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 @@ public:
}
}
}
+
+ if (flush)
+ {
+ Process *process = exe_ctx.GetProcessPtr();
+ if (process)
+ process->Flush();
+ }
}
return result.Succeeded();
}
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 3a9b3605511..4225b807c76 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -4707,6 +4707,12 @@ Process::ClearPreResumeActions ()
m_pre_resume_actions.clear();
}
+void
+Process::Flush ()
+{
+ m_thread_list.Flush();
+}
+
//--------------------------------------------------------------
// class Process::SettingsController
//--------------------------------------------------------------
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 5c3c1970146..4513577c9b5 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -1410,6 +1410,14 @@ Thread::GetUnwinder ()
}
+void
+Thread::Flush ()
+{
+ ClearStackFrames ();
+ m_reg_context_sp.reset();
+}
+
+
#pragma mark "Thread::SettingsController"
//--------------------------------------------------------------
// class Thread::SettingsController
diff --git a/lldb/source/Target/ThreadList.cpp b/lldb/source/Target/ThreadList.cpp
index e1c38664aa5..3152c1560cd 100644
--- a/lldb/source/Target/ThreadList.cpp
+++ b/lldb/source/Target/ThreadList.cpp
@@ -605,4 +605,12 @@ ThreadList::Update (ThreadList &rhs)
}
}
+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 ();
+}
OpenPOWER on IntegriCloud