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 23*fbb4d1e4SJonas Devlieghere LLDB_PLUGIN(ScriptInterpreterNone); 24*fbb4d1e4SJonas Devlieghere 258d1fb843SJonas Devlieghere ScriptInterpreterNone::ScriptInterpreterNone(Debugger &debugger) 268d1fb843SJonas Devlieghere : ScriptInterpreter(debugger, eScriptLanguageNone) {} 272c1f46dcSZachary Turner 28b9c1b51eSKate Stone ScriptInterpreterNone::~ScriptInterpreterNone() {} 292c1f46dcSZachary Turner 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 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 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 53b9c1b51eSKate Stone void ScriptInterpreterNone::Terminate() {} 542c1f46dcSZachary Turner 552c1f46dcSZachary Turner lldb::ScriptInterpreterSP 568d1fb843SJonas Devlieghere ScriptInterpreterNone::CreateInstance(Debugger &debugger) { 578d1fb843SJonas Devlieghere return std::make_shared<ScriptInterpreterNone>(debugger); 582c1f46dcSZachary Turner } 592c1f46dcSZachary Turner 60b9c1b51eSKate Stone lldb_private::ConstString ScriptInterpreterNone::GetPluginNameStatic() { 612c1f46dcSZachary Turner static ConstString g_name("script-none"); 622c1f46dcSZachary Turner return g_name; 632c1f46dcSZachary Turner } 642c1f46dcSZachary Turner 65b9c1b51eSKate Stone const char *ScriptInterpreterNone::GetPluginDescriptionStatic() { 662c1f46dcSZachary Turner return "Null script interpreter"; 672c1f46dcSZachary Turner } 682c1f46dcSZachary Turner 69b9c1b51eSKate Stone lldb_private::ConstString ScriptInterpreterNone::GetPluginName() { 702c1f46dcSZachary Turner return GetPluginNameStatic(); 712c1f46dcSZachary Turner } 722c1f46dcSZachary Turner 73b9c1b51eSKate Stone uint32_t ScriptInterpreterNone::GetPluginVersion() { return 1; } 74