15ffd83dbSDimitry Andric //===-- ScriptInterpreterNone.cpp -----------------------------------------===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric
90b57cec5SDimitry Andric #include "ScriptInterpreterNone.h"
100b57cec5SDimitry Andric #include "lldb/Core/Debugger.h"
110b57cec5SDimitry Andric #include "lldb/Core/PluginManager.h"
120b57cec5SDimitry Andric #include "lldb/Core/StreamFile.h"
130b57cec5SDimitry Andric #include "lldb/Utility/Stream.h"
140b57cec5SDimitry Andric #include "lldb/Utility/StringList.h"
150b57cec5SDimitry Andric
160b57cec5SDimitry Andric #include "llvm/Support/Threading.h"
170b57cec5SDimitry Andric
180b57cec5SDimitry Andric #include <mutex>
190b57cec5SDimitry Andric
200b57cec5SDimitry Andric using namespace lldb;
210b57cec5SDimitry Andric using namespace lldb_private;
220b57cec5SDimitry Andric
LLDB_PLUGIN_DEFINE(ScriptInterpreterNone)235ffd83dbSDimitry Andric LLDB_PLUGIN_DEFINE(ScriptInterpreterNone)
245ffd83dbSDimitry Andric
250b57cec5SDimitry Andric ScriptInterpreterNone::ScriptInterpreterNone(Debugger &debugger)
260b57cec5SDimitry Andric : ScriptInterpreter(debugger, eScriptLanguageNone) {}
270b57cec5SDimitry Andric
28*5f7ddb14SDimitry Andric ScriptInterpreterNone::~ScriptInterpreterNone() = default;
290b57cec5SDimitry Andric
ExecuteOneLine(llvm::StringRef command,CommandReturnObject *,const ExecuteScriptOptions &)300b57cec5SDimitry Andric bool ScriptInterpreterNone::ExecuteOneLine(llvm::StringRef command,
310b57cec5SDimitry Andric CommandReturnObject *,
320b57cec5SDimitry Andric const ExecuteScriptOptions &) {
339dba64beSDimitry Andric m_debugger.GetErrorStream().PutCString(
340b57cec5SDimitry Andric "error: there is no embedded script interpreter in this mode.\n");
350b57cec5SDimitry Andric return false;
360b57cec5SDimitry Andric }
370b57cec5SDimitry Andric
ExecuteInterpreterLoop()380b57cec5SDimitry Andric void ScriptInterpreterNone::ExecuteInterpreterLoop() {
399dba64beSDimitry Andric m_debugger.GetErrorStream().PutCString(
400b57cec5SDimitry Andric "error: there is no embedded script interpreter in this mode.\n");
410b57cec5SDimitry Andric }
420b57cec5SDimitry Andric
Initialize()430b57cec5SDimitry Andric void ScriptInterpreterNone::Initialize() {
440b57cec5SDimitry Andric static llvm::once_flag g_once_flag;
450b57cec5SDimitry Andric
460b57cec5SDimitry Andric llvm::call_once(g_once_flag, []() {
470b57cec5SDimitry Andric PluginManager::RegisterPlugin(GetPluginNameStatic(),
480b57cec5SDimitry Andric GetPluginDescriptionStatic(),
490b57cec5SDimitry Andric lldb::eScriptLanguageNone, CreateInstance);
500b57cec5SDimitry Andric });
510b57cec5SDimitry Andric }
520b57cec5SDimitry Andric
Terminate()530b57cec5SDimitry Andric void ScriptInterpreterNone::Terminate() {}
540b57cec5SDimitry Andric
550b57cec5SDimitry Andric lldb::ScriptInterpreterSP
CreateInstance(Debugger & debugger)560b57cec5SDimitry Andric ScriptInterpreterNone::CreateInstance(Debugger &debugger) {
570b57cec5SDimitry Andric return std::make_shared<ScriptInterpreterNone>(debugger);
580b57cec5SDimitry Andric }
590b57cec5SDimitry Andric
GetPluginNameStatic()600b57cec5SDimitry Andric lldb_private::ConstString ScriptInterpreterNone::GetPluginNameStatic() {
610b57cec5SDimitry Andric static ConstString g_name("script-none");
620b57cec5SDimitry Andric return g_name;
630b57cec5SDimitry Andric }
640b57cec5SDimitry Andric
GetPluginDescriptionStatic()650b57cec5SDimitry Andric const char *ScriptInterpreterNone::GetPluginDescriptionStatic() {
660b57cec5SDimitry Andric return "Null script interpreter";
670b57cec5SDimitry Andric }
680b57cec5SDimitry Andric
GetPluginName()690b57cec5SDimitry Andric lldb_private::ConstString ScriptInterpreterNone::GetPluginName() {
700b57cec5SDimitry Andric return GetPluginNameStatic();
710b57cec5SDimitry Andric }
720b57cec5SDimitry Andric
GetPluginVersion()730b57cec5SDimitry Andric uint32_t ScriptInterpreterNone::GetPluginVersion() { return 1; }
74