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/Utility/Stream.h"
13#include "lldb/Utility/StringList.h"
14
15#include "llvm/Support/Threading.h"
16
17#include <mutex>
18
19using namespace lldb;
20using namespace lldb_private;
21
22LLDB_PLUGIN_DEFINE(ScriptInterpreterNone)
23
24ScriptInterpreterNone::ScriptInterpreterNone(Debugger &debugger)
25 : ScriptInterpreter(debugger, eScriptLanguageNone) {}
26
27ScriptInterpreterNone::~ScriptInterpreterNone() = default;
28
29static const char *no_interpreter_err_msg =
30 "error: Embedded script interpreter unavailable. LLDB was built without "
31 "scripting language support.\n";
32
33bool ScriptInterpreterNone::ExecuteOneLine(llvm::StringRef command,
34 CommandReturnObject *,
35 const ExecuteScriptOptions &) {
36 m_debugger.GetErrorStream().PutCString(cstr: no_interpreter_err_msg);
37 return false;
38}
39
40void ScriptInterpreterNone::ExecuteInterpreterLoop() {
41 m_debugger.GetErrorStream().PutCString(cstr: no_interpreter_err_msg);
42}
43
44void ScriptInterpreterNone::Initialize() {
45 static llvm::once_flag g_once_flag;
46
47 llvm::call_once(flag&: g_once_flag, F: []() {
48 PluginManager::RegisterPlugin(name: GetPluginNameStatic(),
49 description: GetPluginDescriptionStatic(),
50 script_lang: lldb::eScriptLanguageNone, create_callback: CreateInstance);
51 });
52}
53
54void ScriptInterpreterNone::Terminate() {}
55
56lldb::ScriptInterpreterSP
57ScriptInterpreterNone::CreateInstance(Debugger &debugger) {
58 return std::make_shared<ScriptInterpreterNone>(args&: debugger);
59}
60
61llvm::StringRef ScriptInterpreterNone::GetPluginDescriptionStatic() {
62 return "Null script interpreter";
63}
64

source code of lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp