180814287SRaphael Isemann //===-- ScriptInterpreterNone.cpp -----------------------------------------===//
22c1f46dcSZachary Turner //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
62c1f46dcSZachary Turner //
72c1f46dcSZachary Turner //===----------------------------------------------------------------------===//
82c1f46dcSZachary Turner
92c1f46dcSZachary Turner #include "ScriptInterpreterNone.h"
102c1f46dcSZachary Turner #include "lldb/Core/Debugger.h"
112c1f46dcSZachary Turner #include "lldb/Core/PluginManager.h"
122c1f46dcSZachary Turner #include "lldb/Core/StreamFile.h"
13bf9a7730SZachary Turner #include "lldb/Utility/Stream.h"
14573ab909SZachary Turner #include "lldb/Utility/StringList.h"
152c1f46dcSZachary Turner
16c5f28e2aSKamil Rytarowski #include "llvm/Support/Threading.h"
17c5f28e2aSKamil Rytarowski
182c1f46dcSZachary Turner #include <mutex>
192c1f46dcSZachary Turner
202c1f46dcSZachary Turner using namespace lldb;
212c1f46dcSZachary Turner using namespace lldb_private;
222c1f46dcSZachary Turner
LLDB_PLUGIN_DEFINE(ScriptInterpreterNone)23bba9ba8dSJonas Devlieghere LLDB_PLUGIN_DEFINE(ScriptInterpreterNone)
24fbb4d1e4SJonas Devlieghere
258d1fb843SJonas Devlieghere ScriptInterpreterNone::ScriptInterpreterNone(Debugger &debugger)
268d1fb843SJonas Devlieghere : ScriptInterpreter(debugger, eScriptLanguageNone) {}
272c1f46dcSZachary Turner
28fd2433e1SJonas Devlieghere ScriptInterpreterNone::~ScriptInterpreterNone() = default;
292c1f46dcSZachary Turner
ExecuteOneLine(llvm::StringRef command,CommandReturnObject *,const ExecuteScriptOptions &)304d51a902SRaphael Isemann bool ScriptInterpreterNone::ExecuteOneLine(llvm::StringRef command,
31b9c1b51eSKate Stone CommandReturnObject *,
32b9c1b51eSKate Stone const ExecuteScriptOptions &) {
337ca15ba7SLawrence D'Anna m_debugger.GetErrorStream().PutCString(
342c1f46dcSZachary Turner "error: there is no embedded script interpreter in this mode.\n");
352c1f46dcSZachary Turner return false;
362c1f46dcSZachary Turner }
372c1f46dcSZachary Turner
ExecuteInterpreterLoop()38b9c1b51eSKate Stone void ScriptInterpreterNone::ExecuteInterpreterLoop() {
397ca15ba7SLawrence D'Anna m_debugger.GetErrorStream().PutCString(
402c1f46dcSZachary Turner "error: there is no embedded script interpreter in this mode.\n");
412c1f46dcSZachary Turner }
422c1f46dcSZachary Turner
Initialize()43b9c1b51eSKate Stone void ScriptInterpreterNone::Initialize() {
44c5f28e2aSKamil Rytarowski static llvm::once_flag g_once_flag;
452c1f46dcSZachary Turner
46c5f28e2aSKamil Rytarowski llvm::call_once(g_once_flag, []() {
47b9c1b51eSKate Stone PluginManager::RegisterPlugin(GetPluginNameStatic(),
48b9c1b51eSKate Stone GetPluginDescriptionStatic(),
492c1f46dcSZachary Turner lldb::eScriptLanguageNone, CreateInstance);
502c1f46dcSZachary Turner });
512c1f46dcSZachary Turner }
522c1f46dcSZachary Turner
Terminate()53b9c1b51eSKate Stone void ScriptInterpreterNone::Terminate() {}
542c1f46dcSZachary Turner
552c1f46dcSZachary Turner lldb::ScriptInterpreterSP
CreateInstance(Debugger & debugger)568d1fb843SJonas Devlieghere ScriptInterpreterNone::CreateInstance(Debugger &debugger) {
578d1fb843SJonas Devlieghere return std::make_shared<ScriptInterpreterNone>(debugger);
582c1f46dcSZachary Turner }
592c1f46dcSZachary Turner
GetPluginDescriptionStatic()60*5f4980f0SPavel Labath llvm::StringRef ScriptInterpreterNone::GetPluginDescriptionStatic() {
612c1f46dcSZachary Turner return "Null script interpreter";
622c1f46dcSZachary Turner }
63