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
LLDB_PLUGIN_DEFINE(ScriptInterpreterNone)23 LLDB_PLUGIN_DEFINE(ScriptInterpreterNone)
24
25 ScriptInterpreterNone::ScriptInterpreterNone(Debugger &debugger)
26 : ScriptInterpreter(debugger, eScriptLanguageNone) {}
27
28 ScriptInterpreterNone::~ScriptInterpreterNone() = default;
29
ExecuteOneLine(llvm::StringRef command,CommandReturnObject *,const ExecuteScriptOptions &)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
ExecuteInterpreterLoop()38 void ScriptInterpreterNone::ExecuteInterpreterLoop() {
39 m_debugger.GetErrorStream().PutCString(
40 "error: there is no embedded script interpreter in this mode.\n");
41 }
42
Initialize()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
Terminate()53 void ScriptInterpreterNone::Terminate() {}
54
55 lldb::ScriptInterpreterSP
CreateInstance(Debugger & debugger)56 ScriptInterpreterNone::CreateInstance(Debugger &debugger) {
57 return std::make_shared<ScriptInterpreterNone>(debugger);
58 }
59
GetPluginDescriptionStatic()60 llvm::StringRef ScriptInterpreterNone::GetPluginDescriptionStatic() {
61 return "Null script interpreter";
62 }
63