1185029Spjd//===-- ScriptInterpreterLua.h ----------------------------------*- C++ -*-===//
2185029Spjd//
3185029Spjd// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4185029Spjd// See https://llvm.org/LICENSE.txt for license information.
5185029Spjd// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6185029Spjd//
7185029Spjd//===----------------------------------------------------------------------===//
8185029Spjd
9185029Spjd#ifndef liblldb_ScriptInterpreterLua_h_
10185029Spjd#define liblldb_ScriptInterpreterLua_h_
11185029Spjd
12185029Spjd#include "lldb/Interpreter/ScriptInterpreter.h"
13185029Spjd
14185029Spjdnamespace lldb_private {
15185029Spjdclass Lua;
16185029Spjdclass ScriptInterpreterLua : public ScriptInterpreter {
17185029Spjdpublic:
18185029Spjd  ScriptInterpreterLua(Debugger &debugger);
19185029Spjd
20185029Spjd  ~ScriptInterpreterLua() override;
21185029Spjd
22185029Spjd  bool ExecuteOneLine(
23185029Spjd      llvm::StringRef command, CommandReturnObject *result,
24185029Spjd      const ExecuteScriptOptions &options = ExecuteScriptOptions()) override;
25185029Spjd
26185029Spjd  void ExecuteInterpreterLoop() override;
27185029Spjd
28185029Spjd  virtual bool
29185029Spjd  LoadScriptingModule(const char *filename, bool init_session,
30185029Spjd                      lldb_private::Status &error,
31185029Spjd                      StructuredData::ObjectSP *module_sp = nullptr) override;
32185029Spjd
33185029Spjd  // Static Functions
34185029Spjd  static void Initialize();
35185029Spjd
36185029Spjd  static void Terminate();
37185029Spjd
38185029Spjd  static lldb::ScriptInterpreterSP CreateInstance(Debugger &debugger);
39185029Spjd
40185029Spjd  static lldb_private::ConstString GetPluginNameStatic();
41185029Spjd
42185029Spjd  static const char *GetPluginDescriptionStatic();
43185029Spjd
44185029Spjd  // PluginInterface protocol
45185029Spjd  lldb_private::ConstString GetPluginName() override;
46185029Spjd
47185029Spjd  uint32_t GetPluginVersion() override;
48185029Spjd
49185029Spjd  Lua &GetLua();
50185029Spjd
51185029Spjd  llvm::Error EnterSession(lldb::user_id_t debugger_id);
52185029Spjd  llvm::Error LeaveSession();
53185029Spjd
54185029Spjdprivate:
55185029Spjd  std::unique_ptr<Lua> m_lua;
56185029Spjd  bool m_session_is_active = false;
57185029Spjd};
58185029Spjd
59185029Spjd} // namespace lldb_private
60185029Spjd
61185029Spjd#endif // liblldb_ScriptInterpreterLua_h_
62185029Spjd