xref: /llvm-project/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp (revision 67de896229c0f1918f50a48973b7ce0007a181a9)
1 //===-- ScriptInterpreterLua.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 "ScriptInterpreterLua.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 
23 ScriptInterpreterLua::ScriptInterpreterLua(Debugger &debugger)
24     : ScriptInterpreter(debugger, eScriptLanguageLua) {}
25 
26 ScriptInterpreterLua::~ScriptInterpreterLua() {}
27 
28 bool ScriptInterpreterLua::ExecuteOneLine(llvm::StringRef command,
29                                           CommandReturnObject *,
30                                           const ExecuteScriptOptions &) {
31   m_debugger.GetErrorStream().PutCString(
32       "error: the lua script interpreter is not yet implemented.\n");
33   return false;
34 }
35 
36 void ScriptInterpreterLua::ExecuteInterpreterLoop() {
37   m_debugger.GetErrorStream().PutCString(
38       "error: the lua script interpreter is not yet implemented.\n");
39 }
40 
41 void ScriptInterpreterLua::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::eScriptLanguageLua, CreateInstance);
48   });
49 }
50 
51 void ScriptInterpreterLua::Terminate() {}
52 
53 lldb::ScriptInterpreterSP
54 ScriptInterpreterLua::CreateInstance(Debugger &debugger) {
55   return std::make_shared<ScriptInterpreterLua>(debugger);
56 }
57 
58 lldb_private::ConstString ScriptInterpreterLua::GetPluginNameStatic() {
59   static ConstString g_name("script-lua");
60   return g_name;
61 }
62 
63 const char *ScriptInterpreterLua::GetPluginDescriptionStatic() {
64   return "Lua script interpreter";
65 }
66 
67 lldb_private::ConstString ScriptInterpreterLua::GetPluginName() {
68   return GetPluginNameStatic();
69 }
70 
71 uint32_t ScriptInterpreterLua::GetPluginVersion() { return 1; }
72