<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

 

llvm-svn: 157042
This commit is contained in:
Greg Clayton 2012-05-18 02:38:05 +00:00
parent f34358e90b
commit fa559e5c6e
8 changed files with 55 additions and 4 deletions

View File

@ -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.

View File

@ -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

View File

@ -59,6 +59,9 @@ public:
void
Clear();
void
Flush();
void
Destroy();

View File

@ -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;
}

View File

@ -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();
}

View File

@ -4707,6 +4707,12 @@ Process::ClearPreResumeActions ()
m_pre_resume_actions.clear();
}
void
Process::Flush ()
{
m_thread_list.Flush();
}
//--------------------------------------------------------------
// class Process::SettingsController
//--------------------------------------------------------------

View File

@ -1410,6 +1410,14 @@ Thread::GetUnwinder ()
}
void
Thread::Flush ()
{
ClearStackFrames ();
m_reg_context_sp.reset();
}
#pragma mark "Thread::SettingsController"
//--------------------------------------------------------------
// class Thread::SettingsController

View File

@ -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 ();
}