1 //===-- ScriptInterpreterLua.h ----------------------------------*- 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 #ifndef liblldb_ScriptInterpreterLua_h_
10 #define liblldb_ScriptInterpreterLua_h_
11 
12 #include "lldb/Interpreter/ScriptInterpreter.h"
13 
14 namespace lldb_private {
15 class Lua;
16 class ScriptInterpreterLua : public ScriptInterpreter {
17 public:
18   ScriptInterpreterLua(Debugger &debugger);
19 
20   ~ScriptInterpreterLua() override;
21 
22   bool ExecuteOneLine(
23       llvm::StringRef command, CommandReturnObject *result,
24       const ExecuteScriptOptions &options = ExecuteScriptOptions()) override;
25 
26   void ExecuteInterpreterLoop() override;
27 
28   bool
29   LoadScriptingModule(const char *filename, bool init_session,
30                       lldb_private::Status &error,
31                       StructuredData::ObjectSP *module_sp = nullptr) override;
32 
33   // Static Functions
34   static void Initialize();
35 
36   static void Terminate();
37 
38   static lldb::ScriptInterpreterSP CreateInstance(Debugger &debugger);
39 
40   static lldb_private::ConstString GetPluginNameStatic();
41 
42   static const char *GetPluginDescriptionStatic();
43 
44   // PluginInterface protocol
45   lldb_private::ConstString GetPluginName() override;
46 
47   uint32_t GetPluginVersion() override;
48 
49   Lua &GetLua();
50 
51   llvm::Error EnterSession(lldb::user_id_t debugger_id);
52   llvm::Error LeaveSession();
53 
54 private:
55   std::unique_ptr<Lua> m_lua;
56   bool m_session_is_active = false;
57 };
58 
59 } // namespace lldb_private
60 
61 #endif // liblldb_ScriptInterpreterLua_h_
62