[lldb/Plugins] Refactor ScriptedThread register context creation

This patch changes the ScriptedThread class to create the register
context when Process::RefreshStateAfterStop is called rather than
doing it in the thread constructor.

This is required to update the thread state for execution control.

Differential Revision: https://reviews.llvm.org/D112167

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
Med Ismail Bennani
2021-11-10 19:53:14 +00:00
parent fddc4e4116
commit 676576b6f0
3 changed files with 50 additions and 43 deletions

View File

@@ -20,7 +20,6 @@
#include "lldb/Interpreter/ScriptInterpreter.h"
#include "lldb/Target/MemoryRegionInfo.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Utility/State.h"
#include <mutex>
@@ -291,6 +290,7 @@ bool ScriptedProcess::DoUpdateThreadList(ThreadList &old_thread_list,
// actually new threads will get added to new_thread_list.
CheckInterpreterAndScriptObject();
m_thread_plans.ClearThreadCache();
Status error;
ScriptLanguage language = m_interpreter->GetLanguage();
@@ -316,6 +316,12 @@ bool ScriptedProcess::DoUpdateThreadList(ThreadList &old_thread_list,
return new_thread_list.GetSize(false) > 0;
}
void ScriptedProcess::RefreshStateAfterStop() {
// Let all threads recover from stopping and do any clean up based on the
// previous thread state (if any).
m_thread_list.RefreshStateAfterStop();
}
bool ScriptedProcess::GetProcessInfo(ProcessInstanceInfo &info) {
info.Clear();
info.SetProcessID(GetID());