LLDB mainline
ScriptInterpreterLua.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_ScriptInterpreterLua_h_
10#define liblldb_ScriptInterpreterLua_h_
11
12#include <vector>
13
17#include "lldb/Utility/Status.h"
19
20namespace lldb_private {
21class Lua;
23public:
25 public:
28 }
30 : BreakpointOptions::CommandData(), m_extra_args_sp(extra_args_sp) {
32 }
34 };
35
37
39
40 bool ExecuteOneLine(
41 llvm::StringRef command, CommandReturnObject *result,
42 const ExecuteScriptOptions &options = ExecuteScriptOptions()) override;
43
44 void ExecuteInterpreterLoop() override;
45
46 bool LoadScriptingModule(const char *filename,
47 const LoadScriptOptions &options,
49 StructuredData::ObjectSP *module_sp = nullptr,
50 FileSpec extra_search_dir = {}) override;
51
53
54 // Static Functions
55 static void Initialize();
56
57 static void Terminate();
58
60
61 static llvm::StringRef GetPluginNameStatic() { return "script-lua"; }
62
63 static llvm::StringRef GetPluginDescriptionStatic();
64
65 static bool BreakpointCallbackFunction(void *baton,
67 lldb::user_id_t break_id,
68 lldb::user_id_t break_loc_id);
69
70 static bool WatchpointCallbackFunction(void *baton,
72 lldb::user_id_t watch_id);
73
74 // PluginInterface protocol
75 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
76
77 Lua &GetLua();
78
79 llvm::Error EnterSession(lldb::user_id_t debugger_id);
80 llvm::Error LeaveSession();
81
83 std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec,
84 CommandReturnObject &result) override;
85
86 void
88 CommandReturnObject &result) override;
89
91 const char *command_body_text,
92 bool is_callback) override;
93
95 const char *command_body_text,
96 bool is_callback) override;
97
99 BreakpointOptions &bp_options, const char *function_name,
100 StructuredData::ObjectSP extra_args_sp) override;
101
102private:
103 std::unique_ptr<Lua> m_lua;
105
107 const char *command_body_text,
108 StructuredData::ObjectSP extra_args_sp);
109
111 const char *command_body_text,
112 StructuredData::ObjectSP extra_args_sp);
113};
114
115} // namespace lldb_private
116
117#endif // liblldb_ScriptInterpreterLua_h_
static llvm::raw_ostream & error(Stream &strm)
"lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a breakpoint or breakpoint lo...
A class to manage flag bits.
Definition: Debugger.h:79
A file utility class.
Definition: FileSpec.h:56
CommandDataLua(StructuredData::ObjectSP extra_args_sp)
Status SetBreakpointCommandCallbackFunction(BreakpointOptions &bp_options, const char *function_name, StructuredData::ObjectSP extra_args_sp) override
Set a script function as the callback for the breakpoint.
llvm::Error EnterSession(lldb::user_id_t debugger_id)
static bool WatchpointCallbackFunction(void *baton, StoppointCallbackContext *context, lldb::user_id_t watch_id)
static lldb::ScriptInterpreterSP CreateInstance(Debugger &debugger)
Status SetBreakpointCommandCallback(BreakpointOptions &bp_options, const char *command_body_text, bool is_callback) override
void SetWatchpointCommandCallback(WatchpointOptions *wp_options, const char *command_body_text, bool is_callback) override
Set a one-liner as the callback for the watchpoint.
llvm::StringRef GetPluginName() override
static bool BreakpointCallbackFunction(void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
bool LoadScriptingModule(const char *filename, const LoadScriptOptions &options, lldb_private::Status &error, StructuredData::ObjectSP *module_sp=nullptr, FileSpec extra_search_dir={}) override
void CollectDataForWatchpointCommandCallback(WatchpointOptions *wp_options, CommandReturnObject &result) override
bool ExecuteOneLine(llvm::StringRef command, CommandReturnObject *result, const ExecuteScriptOptions &options=ExecuteScriptOptions()) override
Status RegisterBreakpointCallback(BreakpointOptions &bp_options, const char *command_body_text, StructuredData::ObjectSP extra_args_sp)
static llvm::StringRef GetPluginNameStatic()
void CollectDataForBreakpointCommandCallback(std::vector< std::reference_wrapper< BreakpointOptions > > &bp_options_vec, CommandReturnObject &result) override
StructuredData::DictionarySP GetInterpreterInfo() override
static llvm::StringRef GetPluginDescriptionStatic()
Status RegisterWatchpointCallback(WatchpointOptions *wp_options, const char *command_body_text, StructuredData::ObjectSP extra_args_sp)
An error handling class.
Definition: Status.h:44
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
"lldb/Breakpoint/WatchpointOptions.h" Class that manages the options on a watchpoint.
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
@ eScriptLanguageLua
std::shared_ptr< lldb_private::ScriptInterpreter > ScriptInterpreterSP
Definition: lldb-forward.h:398
uint64_t user_id_t
Definition: lldb-types.h:80