1cfca06d7SDimitry Andric //===-- ScriptInterpreterNone.cpp -----------------------------------------===//
2e81d9d49SDimitry Andric //
35f29bb8aSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
45f29bb8aSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
55f29bb8aSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6e81d9d49SDimitry Andric //
7e81d9d49SDimitry Andric //===----------------------------------------------------------------------===//
8e81d9d49SDimitry Andric
9e81d9d49SDimitry Andric #include "ScriptInterpreterNone.h"
10e81d9d49SDimitry Andric #include "lldb/Core/Debugger.h"
11e81d9d49SDimitry Andric #include "lldb/Core/PluginManager.h"
1274a628f7SDimitry Andric #include "lldb/Utility/Stream.h"
1374a628f7SDimitry Andric #include "lldb/Utility/StringList.h"
1474a628f7SDimitry Andric
1574a628f7SDimitry Andric #include "llvm/Support/Threading.h"
16e81d9d49SDimitry Andric
17e81d9d49SDimitry Andric #include <mutex>
18e81d9d49SDimitry Andric
19e81d9d49SDimitry Andric using namespace lldb;
20e81d9d49SDimitry Andric using namespace lldb_private;
21e81d9d49SDimitry Andric
LLDB_PLUGIN_DEFINE(ScriptInterpreterNone)22cfca06d7SDimitry Andric LLDB_PLUGIN_DEFINE(ScriptInterpreterNone)
23cfca06d7SDimitry Andric
245f29bb8aSDimitry Andric ScriptInterpreterNone::ScriptInterpreterNone(Debugger &debugger)
255f29bb8aSDimitry Andric : ScriptInterpreter(debugger, eScriptLanguageNone) {}
26e81d9d49SDimitry Andric
27344a3780SDimitry Andric ScriptInterpreterNone::~ScriptInterpreterNone() = default;
28e81d9d49SDimitry Andric
29b1c73532SDimitry Andric static const char *no_interpreter_err_msg =
30b1c73532SDimitry Andric "error: Embedded script interpreter unavailable. LLDB was built without "
31b1c73532SDimitry Andric "scripting language support.\n";
32b1c73532SDimitry Andric
ExecuteOneLine(llvm::StringRef command,CommandReturnObject *,const ExecuteScriptOptions &)33f73363f1SDimitry Andric bool ScriptInterpreterNone::ExecuteOneLine(llvm::StringRef command,
3414f1b3e8SDimitry Andric CommandReturnObject *,
3514f1b3e8SDimitry Andric const ExecuteScriptOptions &) {
36b1c73532SDimitry Andric m_debugger.GetErrorStream().PutCString(no_interpreter_err_msg);
37e81d9d49SDimitry Andric return false;
38e81d9d49SDimitry Andric }
39e81d9d49SDimitry Andric
ExecuteInterpreterLoop()4014f1b3e8SDimitry Andric void ScriptInterpreterNone::ExecuteInterpreterLoop() {
41b1c73532SDimitry Andric m_debugger.GetErrorStream().PutCString(no_interpreter_err_msg);
42e81d9d49SDimitry Andric }
43e81d9d49SDimitry Andric
Initialize()4414f1b3e8SDimitry Andric void ScriptInterpreterNone::Initialize() {
4574a628f7SDimitry Andric static llvm::once_flag g_once_flag;
46e81d9d49SDimitry Andric
4774a628f7SDimitry Andric llvm::call_once(g_once_flag, []() {
4814f1b3e8SDimitry Andric PluginManager::RegisterPlugin(GetPluginNameStatic(),
4914f1b3e8SDimitry Andric GetPluginDescriptionStatic(),
50e81d9d49SDimitry Andric lldb::eScriptLanguageNone, CreateInstance);
51e81d9d49SDimitry Andric });
52e81d9d49SDimitry Andric }
53e81d9d49SDimitry Andric
Terminate()5414f1b3e8SDimitry Andric void ScriptInterpreterNone::Terminate() {}
55e81d9d49SDimitry Andric
56e81d9d49SDimitry Andric lldb::ScriptInterpreterSP
CreateInstance(Debugger & debugger)575f29bb8aSDimitry Andric ScriptInterpreterNone::CreateInstance(Debugger &debugger) {
585f29bb8aSDimitry Andric return std::make_shared<ScriptInterpreterNone>(debugger);
59e81d9d49SDimitry Andric }
60e81d9d49SDimitry Andric
GetPluginDescriptionStatic()61c0981da4SDimitry Andric llvm::StringRef ScriptInterpreterNone::GetPluginDescriptionStatic() {
62e81d9d49SDimitry Andric return "Null script interpreter";
63e81d9d49SDimitry Andric }
64