ScriptInterpreterNone.cpp revision 360784
1//===-- ScriptInterpreterNone.cpp -------------------------------*- C++ -*-===//
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
20using namespace lldb;
21using namespace lldb_private;
22
23ScriptInterpreterNone::ScriptInterpreterNone(Debugger &debugger)
24    : ScriptInterpreter(debugger, eScriptLanguageNone) {}
25
26ScriptInterpreterNone::~ScriptInterpreterNone() {}
27
28bool ScriptInterpreterNone::ExecuteOneLine(llvm::StringRef command,
29                                           CommandReturnObject *,
30                                           const ExecuteScriptOptions &) {
31  m_debugger.GetErrorStream().PutCString(
32      "error: there is no embedded script interpreter in this mode.\n");
33  return false;
34}
35
36void ScriptInterpreterNone::ExecuteInterpreterLoop() {
37  m_debugger.GetErrorStream().PutCString(
38      "error: there is no embedded script interpreter in this mode.\n");
39}
40
41void ScriptInterpreterNone::Initialize() {
42  static llvm::once_flag g_once_flag;
43
44  llvm::call_once(g_once_flag, []() {
45    PluginManager::RegisterPlugin(GetPluginNameStatic(),
46                                  GetPluginDescriptionStatic(),
47                                  lldb::eScriptLanguageNone, CreateInstance);
48  });
49}
50
51void ScriptInterpreterNone::Terminate() {}
52
53lldb::ScriptInterpreterSP
54ScriptInterpreterNone::CreateInstance(Debugger &debugger) {
55  return std::make_shared<ScriptInterpreterNone>(debugger);
56}
57
58lldb_private::ConstString ScriptInterpreterNone::GetPluginNameStatic() {
59  static ConstString g_name("script-none");
60  return g_name;
61}
62
63const char *ScriptInterpreterNone::GetPluginDescriptionStatic() {
64  return "Null script interpreter";
65}
66
67lldb_private::ConstString ScriptInterpreterNone::GetPluginName() {
68  return GetPluginNameStatic();
69}
70
71uint32_t ScriptInterpreterNone::GetPluginVersion() { return 1; }
72