• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_Lua_h_
10 #define liblldb_Lua_h_
11 
12 #include "lldb/API/SBBreakpointLocation.h"
13 #include "lldb/API/SBFrame.h"
14 #include "lldb/lldb-types.h"
15 #include "llvm/ADT/StringRef.h"
16 #include "llvm/Support/Error.h"
17 
18 #include "lua.hpp"
19 
20 #include <mutex>
21 
22 namespace lldb_private {
23 
24 extern "C" {
25 int luaopen_lldb(lua_State *L);
26 }
27 
28 class Lua {
29 public:
30   Lua();
31   ~Lua();
32 
33   llvm::Error Run(llvm::StringRef buffer);
34   llvm::Error RegisterBreakpointCallback(void *baton, const char *body);
35   llvm::Expected<bool>
36   CallBreakpointCallback(void *baton, lldb::StackFrameSP stop_frame_sp,
37                          lldb::BreakpointLocationSP bp_loc_sp);
38   llvm::Error LoadModule(llvm::StringRef filename);
39   llvm::Error ChangeIO(FILE *out, FILE *err);
40 
41 private:
42   lua_State *m_lua_state;
43 };
44 
45 } // namespace lldb_private
46 
47 #endif // liblldb_Lua_h_
48