aboutsummaryrefslogtreecommitdiff
path: root/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
blob: 1a352fa1987fd5d38396f8905fa3735614a10f11 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//===-- ScriptInterpreterNone.cpp -------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "ScriptInterpreterNone.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StringList.h"
#include "lldb/Interpreter/CommandInterpreter.h"

#include <mutex>

using namespace lldb;
using namespace lldb_private;

ScriptInterpreterNone::ScriptInterpreterNone(CommandInterpreter &interpreter)
    : ScriptInterpreter(interpreter, eScriptLanguageNone)
{
}

ScriptInterpreterNone::~ScriptInterpreterNone()
{
}

bool
ScriptInterpreterNone::ExecuteOneLine(const char *command, CommandReturnObject *, const ExecuteScriptOptions &)
{
    m_interpreter.GetDebugger().GetErrorFile()->PutCString(
        "error: there is no embedded script interpreter in this mode.\n");
    return false;
}

void
ScriptInterpreterNone::ExecuteInterpreterLoop()
{
    m_interpreter.GetDebugger().GetErrorFile()->PutCString(
        "error: there is no embedded script interpreter in this mode.\n");
}

void
ScriptInterpreterNone::Initialize()
{
    static std::once_flag g_once_flag;

    std::call_once(g_once_flag, []()
                   {
                       PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(),
                                                     lldb::eScriptLanguageNone, CreateInstance);
                   });
}

void
ScriptInterpreterNone::Terminate()
{
}

lldb::ScriptInterpreterSP
ScriptInterpreterNone::CreateInstance(CommandInterpreter &interpreter)
{
    return std::make_shared<ScriptInterpreterNone>(interpreter);
}

lldb_private::ConstString
ScriptInterpreterNone::GetPluginNameStatic()
{
    static ConstString g_name("script-none");
    return g_name;
}

const char *
ScriptInterpreterNone::GetPluginDescriptionStatic()
{
    return "Null script interpreter";
}

lldb_private::ConstString
ScriptInterpreterNone::GetPluginName()
{
    return GetPluginNameStatic();
}

uint32_t
ScriptInterpreterNone::GetPluginVersion()
{
    return 1;
}