summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index bb23d9884a8..305d6a9c763 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2477,15 +2477,14 @@ void CommandInterpreter::HandleCommandsFromFile(
}
ScriptInterpreter *CommandInterpreter::GetScriptInterpreter(bool can_create) {
- if (m_script_interpreter_sp)
- return m_script_interpreter_sp.get();
-
- if (!can_create)
- return nullptr;
-
- lldb::ScriptLanguage script_lang = GetDebugger().GetScriptLanguage();
- m_script_interpreter_sp =
- PluginManager::GetScriptInterpreterForLanguage(script_lang, *this);
+ std::lock_guard<std::mutex> locker(m_script_interpreter_mutex);
+ if (!m_script_interpreter_sp) {
+ if (!can_create)
+ return nullptr;
+ lldb::ScriptLanguage script_lang = GetDebugger().GetScriptLanguage();
+ m_script_interpreter_sp =
+ PluginManager::GetScriptInterpreterForLanguage(script_lang, *this);
+ }
return m_script_interpreter_sp.get();
}
OpenPOWER on IntegriCloud