Path: blob/main/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h
39642 views
//===-- ScriptInterpreterLua.h ----------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef liblldb_ScriptInterpreterLua_h_9#define liblldb_ScriptInterpreterLua_h_1011#include <vector>1213#include "lldb/Breakpoint/WatchpointOptions.h"14#include "lldb/Core/StructuredDataImpl.h"15#include "lldb/Interpreter/ScriptInterpreter.h"16#include "lldb/Utility/Status.h"17#include "lldb/lldb-enumerations.h"1819namespace lldb_private {20class Lua;21class ScriptInterpreterLua : public ScriptInterpreter {22public:23class CommandDataLua : public BreakpointOptions::CommandData {24public:25CommandDataLua() : BreakpointOptions::CommandData() {26interpreter = lldb::eScriptLanguageLua;27}28CommandDataLua(StructuredData::ObjectSP extra_args_sp)29: BreakpointOptions::CommandData(), m_extra_args_sp(extra_args_sp) {30interpreter = lldb::eScriptLanguageLua;31}32StructuredData::ObjectSP m_extra_args_sp;33};3435ScriptInterpreterLua(Debugger &debugger);3637~ScriptInterpreterLua() override;3839bool ExecuteOneLine(40llvm::StringRef command, CommandReturnObject *result,41const ExecuteScriptOptions &options = ExecuteScriptOptions()) override;4243void ExecuteInterpreterLoop() override;4445bool LoadScriptingModule(const char *filename,46const LoadScriptOptions &options,47lldb_private::Status &error,48StructuredData::ObjectSP *module_sp = nullptr,49FileSpec extra_search_dir = {}) override;5051StructuredData::DictionarySP GetInterpreterInfo() override;5253// Static Functions54static void Initialize();5556static void Terminate();5758static lldb::ScriptInterpreterSP CreateInstance(Debugger &debugger);5960static llvm::StringRef GetPluginNameStatic() { return "script-lua"; }6162static llvm::StringRef GetPluginDescriptionStatic();6364static bool BreakpointCallbackFunction(void *baton,65StoppointCallbackContext *context,66lldb::user_id_t break_id,67lldb::user_id_t break_loc_id);6869static bool WatchpointCallbackFunction(void *baton,70StoppointCallbackContext *context,71lldb::user_id_t watch_id);7273// PluginInterface protocol74llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }7576Lua &GetLua();7778llvm::Error EnterSession(lldb::user_id_t debugger_id);79llvm::Error LeaveSession();8081void CollectDataForBreakpointCommandCallback(82std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec,83CommandReturnObject &result) override;8485void86CollectDataForWatchpointCommandCallback(WatchpointOptions *wp_options,87CommandReturnObject &result) override;8889Status SetBreakpointCommandCallback(BreakpointOptions &bp_options,90const char *command_body_text,91bool is_callback) override;9293void SetWatchpointCommandCallback(WatchpointOptions *wp_options,94const char *command_body_text,95bool is_callback) override;9697Status SetBreakpointCommandCallbackFunction(98BreakpointOptions &bp_options, const char *function_name,99StructuredData::ObjectSP extra_args_sp) override;100101private:102std::unique_ptr<Lua> m_lua;103bool m_session_is_active = false;104105Status RegisterBreakpointCallback(BreakpointOptions &bp_options,106const char *command_body_text,107StructuredData::ObjectSP extra_args_sp);108109Status RegisterWatchpointCallback(WatchpointOptions *wp_options,110const char *command_body_text,111StructuredData::ObjectSP extra_args_sp);112};113114} // namespace lldb_private115116#endif // liblldb_ScriptInterpreterLua_h_117118119