1061da546Spatrick //===-- ScriptInterpreterLua.h ----------------------------------*- C++ -*-===// 2061da546Spatrick // 3061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4061da546Spatrick // See https://llvm.org/LICENSE.txt for license information. 5061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6061da546Spatrick // 7061da546Spatrick //===----------------------------------------------------------------------===// 8061da546Spatrick 9061da546Spatrick #ifndef liblldb_Lua_h_ 10061da546Spatrick #define liblldb_Lua_h_ 11061da546Spatrick 12*be691f3bSpatrick #include "lldb/API/SBBreakpointLocation.h" 13*be691f3bSpatrick #include "lldb/API/SBFrame.h" 14*be691f3bSpatrick #include "lldb/Core/StructuredDataImpl.h" 15061da546Spatrick #include "lldb/lldb-types.h" 16061da546Spatrick #include "llvm/ADT/StringRef.h" 17061da546Spatrick #include "llvm/Support/Error.h" 18061da546Spatrick 19061da546Spatrick #include "lua.hpp" 20061da546Spatrick 21061da546Spatrick #include <mutex> 22061da546Spatrick 23061da546Spatrick namespace lldb_private { 24061da546Spatrick 25061da546Spatrick extern "C" { 26061da546Spatrick int luaopen_lldb(lua_State *L); 27061da546Spatrick } 28061da546Spatrick 29061da546Spatrick class Lua { 30061da546Spatrick public: 31*be691f3bSpatrick Lua(); 32*be691f3bSpatrick ~Lua(); 33061da546Spatrick 34061da546Spatrick llvm::Error Run(llvm::StringRef buffer); 35*be691f3bSpatrick llvm::Error RegisterBreakpointCallback(void *baton, const char *body); 36*be691f3bSpatrick llvm::Expected<bool> 37*be691f3bSpatrick CallBreakpointCallback(void *baton, lldb::StackFrameSP stop_frame_sp, 38*be691f3bSpatrick lldb::BreakpointLocationSP bp_loc_sp, 39*be691f3bSpatrick StructuredData::ObjectSP extra_args_sp); 40*be691f3bSpatrick llvm::Error RegisterWatchpointCallback(void *baton, const char *body); 41*be691f3bSpatrick llvm::Expected<bool> CallWatchpointCallback(void *baton, 42*be691f3bSpatrick lldb::StackFrameSP stop_frame_sp, 43*be691f3bSpatrick lldb::WatchpointSP wp_sp); 44061da546Spatrick llvm::Error LoadModule(llvm::StringRef filename); 45*be691f3bSpatrick llvm::Error CheckSyntax(llvm::StringRef buffer); 46dda28197Spatrick llvm::Error ChangeIO(FILE *out, FILE *err); 47061da546Spatrick 48061da546Spatrick private: 49061da546Spatrick lua_State *m_lua_state; 50061da546Spatrick }; 51061da546Spatrick 52061da546Spatrick } // namespace lldb_private 53061da546Spatrick 54061da546Spatrick #endif // liblldb_Lua_h_ 55