19f2f44ceSEd Maste //===-- ScriptInterpreterNone.cpp -------------------------------*- C++ -*-===// 29f2f44ceSEd Maste // 39f2f44ceSEd Maste // The LLVM Compiler Infrastructure 49f2f44ceSEd Maste // 59f2f44ceSEd Maste // This file is distributed under the University of Illinois Open Source 69f2f44ceSEd Maste // License. See LICENSE.TXT for details. 79f2f44ceSEd Maste // 89f2f44ceSEd Maste //===----------------------------------------------------------------------===// 99f2f44ceSEd Maste 109f2f44ceSEd Maste #include "ScriptInterpreterNone.h" 119f2f44ceSEd Maste #include "lldb/Core/Debugger.h" 129f2f44ceSEd Maste #include "lldb/Core/PluginManager.h" 139f2f44ceSEd Maste #include "lldb/Core/StreamFile.h" 149f2f44ceSEd Maste #include "lldb/Interpreter/CommandInterpreter.h" 15f678e45dSDimitry Andric #include "lldb/Utility/Stream.h" 16f678e45dSDimitry Andric #include "lldb/Utility/StringList.h" 17f678e45dSDimitry Andric 18f678e45dSDimitry Andric #include "llvm/Support/Threading.h" 199f2f44ceSEd Maste 209f2f44ceSEd Maste #include <mutex> 219f2f44ceSEd Maste 229f2f44ceSEd Maste using namespace lldb; 239f2f44ceSEd Maste using namespace lldb_private; 249f2f44ceSEd Maste ScriptInterpreterNone(CommandInterpreter & interpreter)259f2f44ceSEd MasteScriptInterpreterNone::ScriptInterpreterNone(CommandInterpreter &interpreter) 26435933ddSDimitry Andric : ScriptInterpreter(interpreter, eScriptLanguageNone) {} 279f2f44ceSEd Maste ~ScriptInterpreterNone()28435933ddSDimitry AndricScriptInterpreterNone::~ScriptInterpreterNone() {} 299f2f44ceSEd Maste ExecuteOneLine(llvm::StringRef command,CommandReturnObject *,const ExecuteScriptOptions &)30*4ba319b5SDimitry Andricbool ScriptInterpreterNone::ExecuteOneLine(llvm::StringRef command, 31435933ddSDimitry Andric CommandReturnObject *, 32435933ddSDimitry Andric const ExecuteScriptOptions &) { 339f2f44ceSEd Maste m_interpreter.GetDebugger().GetErrorFile()->PutCString( 349f2f44ceSEd Maste "error: there is no embedded script interpreter in this mode.\n"); 359f2f44ceSEd Maste return false; 369f2f44ceSEd Maste } 379f2f44ceSEd Maste ExecuteInterpreterLoop()38435933ddSDimitry Andricvoid ScriptInterpreterNone::ExecuteInterpreterLoop() { 399f2f44ceSEd Maste m_interpreter.GetDebugger().GetErrorFile()->PutCString( 409f2f44ceSEd Maste "error: there is no embedded script interpreter in this mode.\n"); 419f2f44ceSEd Maste } 429f2f44ceSEd Maste Initialize()43435933ddSDimitry Andricvoid ScriptInterpreterNone::Initialize() { 44f678e45dSDimitry Andric static llvm::once_flag g_once_flag; 459f2f44ceSEd Maste 46f678e45dSDimitry Andric llvm::call_once(g_once_flag, []() { 47435933ddSDimitry Andric PluginManager::RegisterPlugin(GetPluginNameStatic(), 48435933ddSDimitry Andric GetPluginDescriptionStatic(), 499f2f44ceSEd Maste lldb::eScriptLanguageNone, CreateInstance); 509f2f44ceSEd Maste }); 519f2f44ceSEd Maste } 529f2f44ceSEd Maste Terminate()53435933ddSDimitry Andricvoid ScriptInterpreterNone::Terminate() {} 549f2f44ceSEd Maste 559f2f44ceSEd Maste lldb::ScriptInterpreterSP CreateInstance(CommandInterpreter & interpreter)56435933ddSDimitry AndricScriptInterpreterNone::CreateInstance(CommandInterpreter &interpreter) { 579f2f44ceSEd Maste return std::make_shared<ScriptInterpreterNone>(interpreter); 589f2f44ceSEd Maste } 599f2f44ceSEd Maste GetPluginNameStatic()60435933ddSDimitry Andriclldb_private::ConstString ScriptInterpreterNone::GetPluginNameStatic() { 619f2f44ceSEd Maste static ConstString g_name("script-none"); 629f2f44ceSEd Maste return g_name; 639f2f44ceSEd Maste } 649f2f44ceSEd Maste GetPluginDescriptionStatic()65435933ddSDimitry Andricconst char *ScriptInterpreterNone::GetPluginDescriptionStatic() { 669f2f44ceSEd Maste return "Null script interpreter"; 679f2f44ceSEd Maste } 689f2f44ceSEd Maste GetPluginName()69435933ddSDimitry Andriclldb_private::ConstString ScriptInterpreterNone::GetPluginName() { 709f2f44ceSEd Maste return GetPluginNameStatic(); 719f2f44ceSEd Maste } 729f2f44ceSEd Maste GetPluginVersion()73435933ddSDimitry Andricuint32_t ScriptInterpreterNone::GetPluginVersion() { return 1; } 74