diff options
Diffstat (limited to 'lldb/include')
-rw-r--r-- | lldb/include/lldb/API/SBSymbolContext.h | 2 | ||||
-rw-r--r-- | lldb/include/lldb/Breakpoint/BreakpointResolverScripted.h | 4 | ||||
-rw-r--r-- | lldb/include/lldb/Expression/DWARFExpression.h | 12 | ||||
-rw-r--r-- | lldb/include/lldb/Interpreter/Interfaces/ScriptedBreakpointInterface.h | 32 | ||||
-rw-r--r-- | lldb/include/lldb/Interpreter/ScriptInterpreter.h | 30 | ||||
-rw-r--r-- | lldb/include/lldb/lldb-forward.h | 3 |
6 files changed, 58 insertions, 25 deletions
diff --git a/lldb/include/lldb/API/SBSymbolContext.h b/lldb/include/lldb/API/SBSymbolContext.h index ae9fd84..128b0b6 100644 --- a/lldb/include/lldb/API/SBSymbolContext.h +++ b/lldb/include/lldb/API/SBSymbolContext.h @@ -80,6 +80,8 @@ protected: lldb_private::SymbolContext *get() const; + friend class lldb_private::ScriptInterpreter; + private: std::unique_ptr<lldb_private::SymbolContext> m_opaque_up; }; diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolverScripted.h b/lldb/include/lldb/Breakpoint/BreakpointResolverScripted.h index 0e4a1d7..0322fd9 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointResolverScripted.h +++ b/lldb/include/lldb/Breakpoint/BreakpointResolverScripted.h @@ -12,6 +12,7 @@ #include "lldb/Breakpoint/BreakpointResolver.h" #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/Interfaces/ScriptedBreakpointInterface.h" #include "lldb/lldb-forward.h" namespace lldb_private { @@ -64,7 +65,8 @@ private: std::string m_class_name; lldb::SearchDepth m_depth; StructuredDataImpl m_args; - StructuredData::GenericSP m_implementation_sp; + Status m_error; + lldb::ScriptedBreakpointInterfaceSP m_interface_sp; BreakpointResolverScripted(const BreakpointResolverScripted &) = delete; const BreakpointResolverScripted & diff --git a/lldb/include/lldb/Expression/DWARFExpression.h b/lldb/include/lldb/Expression/DWARFExpression.h index 37853c0..8fcc5d3 100644 --- a/lldb/include/lldb/Expression/DWARFExpression.h +++ b/lldb/include/lldb/Expression/DWARFExpression.h @@ -52,10 +52,10 @@ public: GetVendorDWARFOpcodeSize(const DataExtractor &data, const lldb::offset_t data_offset, const uint8_t op) const = 0; - virtual bool ParseVendorDWARFOpcode(uint8_t op, - const DataExtractor &opcodes, - lldb::offset_t &offset, - Stack &stack) const = 0; + virtual bool + ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes, + lldb::offset_t &offset, RegisterContext *reg_ctx, + lldb::RegisterKind reg_kind, Stack &stack) const = 0; Delegate(const Delegate &) = delete; Delegate &operator=(const Delegate &) = delete; @@ -163,6 +163,10 @@ public: bool MatchesOperand(StackFrame &frame, const Instruction::Operand &op) const; + static llvm::Error ReadRegisterValueAsScalar(RegisterContext *reg_ctx, + lldb::RegisterKind reg_kind, + uint32_t reg_num, Value &value); + private: /// A data extractor capable of reading opcode bytes DataExtractor m_data; diff --git a/lldb/include/lldb/Interpreter/Interfaces/ScriptedBreakpointInterface.h b/lldb/include/lldb/Interpreter/Interfaces/ScriptedBreakpointInterface.h new file mode 100644 index 0000000..28d6ed9 --- /dev/null +++ b/lldb/include/lldb/Interpreter/Interfaces/ScriptedBreakpointInterface.h @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_INTERPRETER_INTERFACES_SCRIPTEDBREAKPOINTINTERFACE_H +#define LLDB_INTERPRETER_INTERFACES_SCRIPTEDBREAKPOINTINTERFACE_H + +#include "ScriptedInterface.h" +#include "lldb/Symbol/SymbolContext.h" +#include "lldb/lldb-private.h" + +namespace lldb_private { +class ScriptedBreakpointInterface : public ScriptedInterface { +public: + virtual llvm::Expected<StructuredData::GenericSP> + CreatePluginObject(llvm::StringRef class_name, lldb::BreakpointSP break_sp, + const StructuredDataImpl &args_sp) = 0; + + /// "ResolverCallback" will get called when a new module is loaded. The + /// new module information is passed in sym_ctx. The Resolver will add + /// any breakpoint locations it found in that module. + virtual bool ResolverCallback(SymbolContext sym_ctx) { return true; } + virtual lldb::SearchDepth GetDepth() { return lldb::eSearchDepthModule; } + virtual std::optional<std::string> GetShortHelp() { return nullptr; } +}; +} // namespace lldb_private + +#endif // LLDB_INTERPRETER_INTERFACES_SCRIPTEDSTOPHOOKINTERFACE_H diff --git a/lldb/include/lldb/Interpreter/ScriptInterpreter.h b/lldb/include/lldb/Interpreter/ScriptInterpreter.h index f1c3eef..dffb9b8 100644 --- a/lldb/include/lldb/Interpreter/ScriptInterpreter.h +++ b/lldb/include/lldb/Interpreter/ScriptInterpreter.h @@ -18,6 +18,7 @@ #include "lldb/API/SBLaunchInfo.h" #include "lldb/API/SBMemoryRegionInfo.h" #include "lldb/API/SBStream.h" +#include "lldb/API/SBSymbolContext.h" #include "lldb/Breakpoint/BreakpointOptions.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Core/SearchFilter.h" @@ -29,6 +30,7 @@ #include "lldb/Interpreter/Interfaces/ScriptedProcessInterface.h" #include "lldb/Interpreter/Interfaces/ScriptedThreadInterface.h" #include "lldb/Interpreter/ScriptObject.h" +#include "lldb/Symbol/SymbolContext.h" #include "lldb/Utility/Broadcaster.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StructuredData.h" @@ -257,26 +259,6 @@ public: return false; } - virtual StructuredData::GenericSP - CreateScriptedBreakpointResolver(const char *class_name, - const StructuredDataImpl &args_data, - lldb::BreakpointSP &bkpt_sp) { - return StructuredData::GenericSP(); - } - - virtual bool - ScriptedBreakpointResolverSearchCallback(StructuredData::GenericSP implementor_sp, - SymbolContext *sym_ctx) - { - return false; - } - - virtual lldb::SearchDepth - ScriptedBreakpointResolverSearchDepth(StructuredData::GenericSP implementor_sp) - { - return lldb::eSearchDepthModule; - } - virtual StructuredData::ObjectSP LoadPluginModule(const FileSpec &file_spec, lldb_private::Status &error) { return StructuredData::ObjectSP(); @@ -566,6 +548,11 @@ public: return {}; } + virtual lldb::ScriptedBreakpointInterfaceSP + CreateScriptedBreakpointInterface() { + return {}; + } + virtual StructuredData::ObjectSP CreateStructuredDataFromScriptObject(ScriptObject obj) { return {}; @@ -580,6 +567,9 @@ public: lldb::StreamSP GetOpaqueTypeFromSBStream(const lldb::SBStream &stream) const; + SymbolContext + GetOpaqueTypeFromSBSymbolContext(const lldb::SBSymbolContext &sym_ctx) const; + lldb::BreakpointSP GetOpaqueTypeFromSBBreakpoint(const lldb::SBBreakpoint &breakpoint) const; diff --git a/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h index 2bc85a2..483dce9 100644 --- a/lldb/include/lldb/lldb-forward.h +++ b/lldb/include/lldb/lldb-forward.h @@ -188,6 +188,7 @@ class Scalar; class ScriptInterpreter; class ScriptInterpreterLocker; class ScriptedMetadata; +class ScriptedBreakpointInterface; class ScriptedPlatformInterface; class ScriptedProcessInterface; class ScriptedStopHookInterface; @@ -418,6 +419,8 @@ typedef std::shared_ptr<lldb_private::ScriptedThreadInterface> ScriptedThreadInterfaceSP; typedef std::shared_ptr<lldb_private::ScriptedThreadPlanInterface> ScriptedThreadPlanInterfaceSP; +typedef std::shared_ptr<lldb_private::ScriptedBreakpointInterface> + ScriptedBreakpointInterfaceSP; typedef std::shared_ptr<lldb_private::Section> SectionSP; typedef std::unique_ptr<lldb_private::SectionList> SectionListUP; typedef std::weak_ptr<lldb_private::Section> SectionWP; |