]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / source / Plugins / ScriptInterpreter / None / ScriptInterpreterNone.cpp
1 //===-- ScriptInterpreterNone.cpp -------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "ScriptInterpreterNone.h"
11 #include "lldb/Core/Debugger.h"
12 #include "lldb/Core/PluginManager.h"
13 #include "lldb/Core/Stream.h"
14 #include "lldb/Core/StreamFile.h"
15 #include "lldb/Core/StringList.h"
16 #include "lldb/Interpreter/CommandInterpreter.h"
17
18 #include <mutex>
19
20 using namespace lldb;
21 using namespace lldb_private;
22
23 ScriptInterpreterNone::ScriptInterpreterNone(CommandInterpreter &interpreter)
24     : ScriptInterpreter(interpreter, eScriptLanguageNone) {}
25
26 ScriptInterpreterNone::~ScriptInterpreterNone() {}
27
28 bool ScriptInterpreterNone::ExecuteOneLine(const char *command,
29                                            CommandReturnObject *,
30                                            const ExecuteScriptOptions &) {
31   m_interpreter.GetDebugger().GetErrorFile()->PutCString(
32       "error: there is no embedded script interpreter in this mode.\n");
33   return false;
34 }
35
36 void ScriptInterpreterNone::ExecuteInterpreterLoop() {
37   m_interpreter.GetDebugger().GetErrorFile()->PutCString(
38       "error: there is no embedded script interpreter in this mode.\n");
39 }
40
41 void ScriptInterpreterNone::Initialize() {
42   static std::once_flag g_once_flag;
43
44   std::call_once(g_once_flag, []() {
45     PluginManager::RegisterPlugin(GetPluginNameStatic(),
46                                   GetPluginDescriptionStatic(),
47                                   lldb::eScriptLanguageNone, CreateInstance);
48   });
49 }
50
51 void ScriptInterpreterNone::Terminate() {}
52
53 lldb::ScriptInterpreterSP
54 ScriptInterpreterNone::CreateInstance(CommandInterpreter &interpreter) {
55   return std::make_shared<ScriptInterpreterNone>(interpreter);
56 }
57
58 lldb_private::ConstString ScriptInterpreterNone::GetPluginNameStatic() {
59   static ConstString g_name("script-none");
60   return g_name;
61 }
62
63 const char *ScriptInterpreterNone::GetPluginDescriptionStatic() {
64   return "Null script interpreter";
65 }
66
67 lldb_private::ConstString ScriptInterpreterNone::GetPluginName() {
68   return GetPluginNameStatic();
69 }
70
71 uint32_t ScriptInterpreterNone::GetPluginVersion() { return 1; }