LLDB  mainline
Lua.h
Go to the documentation of this file.
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 
13 #include "lldb/API/SBFrame.h"
15 #include "lldb/lldb-types.h"
16 #include "llvm/ADT/StringRef.h"
17 #include "llvm/Support/Error.h"
18 
19 #include "lua.hpp"
20 
21 #include <mutex>
22 
23 namespace lldb_private {
24 
25 extern "C" {
26 int luaopen_lldb(lua_State *L);
27 }
28 
29 class Lua {
30 public:
31  Lua();
32  ~Lua();
33 
34  llvm::Error Run(llvm::StringRef buffer);
35  llvm::Error RegisterBreakpointCallback(void *baton, const char *body);
36  llvm::Expected<bool>
37  CallBreakpointCallback(void *baton, lldb::StackFrameSP stop_frame_sp,
38  lldb::BreakpointLocationSP bp_loc_sp,
39  StructuredData::ObjectSP extra_args_sp);
40  llvm::Error RegisterWatchpointCallback(void *baton, const char *body);
41  llvm::Expected<bool> CallWatchpointCallback(void *baton,
42  lldb::StackFrameSP stop_frame_sp,
43  lldb::WatchpointSP wp_sp);
44  llvm::Error LoadModule(llvm::StringRef filename);
45  llvm::Error CheckSyntax(llvm::StringRef buffer);
46  llvm::Error ChangeIO(FILE *out, FILE *err);
47 
48 private:
49  lua_State *m_lua_state;
50 };
51 
52 } // namespace lldb_private
53 
54 #endif // liblldb_Lua_h_
lldb_private::Lua
Definition: Lua.h:29
lldb_private::Lua::CallWatchpointCallback
llvm::Expected< bool > CallWatchpointCallback(void *baton, lldb::StackFrameSP stop_frame_sp, lldb::WatchpointSP wp_sp)
Definition: Lua.cpp:136
lldb_private::Lua::CheckSyntax
llvm::Error CheckSyntax(llvm::StringRef buffer)
Definition: Lua.cpp:145
lldb_private::Lua::CallBreakpointCallback
llvm::Expected< bool > CallBreakpointCallback(void *baton, lldb::StackFrameSP stop_frame_sp, lldb::BreakpointLocationSP bp_loc_sp, StructuredData::ObjectSP extra_args_sp)
Definition: Lua.cpp:102
lldb_private::Lua::ChangeIO
llvm::Error ChangeIO(FILE *out, FILE *err)
Definition: Lua.cpp:191
SBFrame.h
lldb_private::StructuredData::ObjectSP
std::shared_ptr< Object > ObjectSP
Definition: StructuredData.h:59
lldb_private::Lua::~Lua
~Lua()
Definition: Lua.cpp:65
lldb_private::Lua::Run
llvm::Error Run(llvm::StringRef buffer)
Definition: Lua.cpp:70
lldb_private::Lua::RegisterBreakpointCallback
llvm::Error RegisterBreakpointCallback(void *baton, const char *body)
Definition: Lua.cpp:85
lldb_private::luaopen_lldb
int luaopen_lldb(lua_State *L)
lldb_private::Lua::m_lua_state
lua_State * m_lua_state
Definition: Lua.h:49
lldb-types.h
SBBreakpointLocation.h
StructuredDataImpl.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
Error
llvm::Error Error
Definition: UdtRecordCompleter.cpp:29
lldb_private::Lua::RegisterWatchpointCallback
llvm::Error RegisterWatchpointCallback(void *baton, const char *body)
Definition: Lua.cpp:119
lldb_private::Lua::LoadModule
llvm::Error LoadModule(llvm::StringRef filename)
Definition: Lua.cpp:162
lldb_private::Lua::Lua
Lua()
Definition: Lua.cpp:57