1 //===-- ScriptInterpreterNone.cpp -----------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "ScriptInterpreterNone.h" 10 #include "lldb/Core/Debugger.h" 11 #include "lldb/Core/PluginManager.h" 12 #include "lldb/Core/StreamFile.h" 13 #include "lldb/Utility/Stream.h" 14 #include "lldb/Utility/StringList.h" 15 16 #include "llvm/Support/Threading.h" 17 18 #include <mutex> 19 20 using namespace lldb; 21 using namespace lldb_private; 22 23 LLDB_PLUGIN_DEFINE(ScriptInterpreterNone) 24 25 ScriptInterpreterNone::ScriptInterpreterNone(Debugger &debugger) 26 : ScriptInterpreter(debugger, eScriptLanguageNone) {} 27 28 ScriptInterpreterNone::~ScriptInterpreterNone() = default; 29 30 bool ScriptInterpreterNone::ExecuteOneLine(llvm::StringRef command, 31 CommandReturnObject *, 32 const ExecuteScriptOptions &) { 33 m_debugger.GetErrorStream().PutCString( 34 "error: there is no embedded script interpreter in this mode.\n"); 35 return false; 36 } 37 38 void ScriptInterpreterNone::ExecuteInterpreterLoop() { 39 m_debugger.GetErrorStream().PutCString( 40 "error: there is no embedded script interpreter in this mode.\n"); 41 } 42 43 void ScriptInterpreterNone::Initialize() { 44 static llvm::once_flag g_once_flag; 45 46 llvm::call_once(g_once_flag, []() { 47 PluginManager::RegisterPlugin(GetPluginNameStatic(), 48 GetPluginDescriptionStatic(), 49 lldb::eScriptLanguageNone, CreateInstance); 50 }); 51 } 52 53 void ScriptInterpreterNone::Terminate() {} 54 55 lldb::ScriptInterpreterSP 56 ScriptInterpreterNone::CreateInstance(Debugger &debugger) { 57 return std::make_shared<ScriptInterpreterNone>(debugger); 58 } 59 60 lldb_private::ConstString ScriptInterpreterNone::GetPluginNameStatic() { 61 static ConstString g_name("script-none"); 62 return g_name; 63 } 64 65 const char *ScriptInterpreterNone::GetPluginDescriptionStatic() { 66 return "Null script interpreter"; 67 } 68 69 lldb_private::ConstString ScriptInterpreterNone::GetPluginName() { 70 return GetPluginNameStatic(); 71 } 72 73 uint32_t ScriptInterpreterNone::GetPluginVersion() { return 1; } 74