12#include "lldb/Host/Config.h"
33llvm::Expected<StructuredData::GenericSP>
38 std::make_shared<ExecutionContextRef>(exe_ctx);
41 scripted_metadata, script_obj, exe_ctx_ref_sp, args_sp);
72 llvm::Expected<SymbolContext> sym_ctx_or_err =
74 if (!sym_ctx_or_err) {
76 "get_symbol_context failed: {0}");
80 return *sym_ctx_or_err;
89 return obj->GetStringValue().str();
92std::optional<std::string>
95 Dispatch(
"get_display_function_name"), LLVM_PRETTY_FUNCTION);
99 return obj->GetStringValue().str();
108 return obj->GetBooleanValue();
117 return obj->GetBooleanValue();
126 return obj->GetBooleanValue();
132 LLVM_PRETTY_FUNCTION);
145 return obj->GetStringValue().str();
150 LLVM_PRETTY_FUNCTION);
153std::optional<lldb::ValueType>
157 "get_value_type_for_variable", std::move(value)),
158 LLVM_PRETTY_FUNCTION);
163 llvm::StringRef expr, uint32_t options,
Status &status) {
164 llvm::Expected<lldb::ValueObjectSP> val_or_err =
166 expr.data(), options, status);
175llvm::Expected<ScriptedMetadata>
183 llvm::Expected<std::optional<StructuredData::DictionarySP>> dict_or_err =
185 "get_plan_spec_for_step_type", step_type);
187 return llvm::joinErrors(
188 llvm::createStringError(
189 "error dispatching get_plan_spec_for_step_type"),
190 dict_or_err.takeError());
195 if (!dict_sp || !dict_sp->IsValid())
196 return no_plan_return;
200 return llvm::createStringError(
"Required 'class_name' field not provided.");
202 std::string class_string = obj->GetStringValue().str();
207 if (!class_string.empty()) {
208 const char *class_str = class_string.c_str();
210 return llvm::createStringError(
211 "class_name specified a class: '%s' that does not exist.", class_str);
217 if (dict_sp->GetValueForKeyAsDictionary(
"extra_args", extra_args_ptr))
218 extra_args_sp = std::static_pointer_cast<StructuredData::Dictionary>(
219 extra_args_ptr->shared_from_this());
224 return plan_metadata;
230 "Provide frame state for scripted threads and frame providers.",
#define LLDB_LOG_ERROR(log, error,...)
ScriptInterpreterPythonImpl::Locker Locker
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
std::optional< std::string > GetRegisterContext() override
lldb::user_id_t GetID() override
static llvm::StringRef GetPluginNameStatic()
std::optional< lldb::ValueType > GetValueTypeForVariable(lldb::ValueObjectSP value) override
Report which kind of variable valobj is presented as, for instance eValueTypeVariableLocal to have it...
llvm::Expected< ScriptedMetadata > GetThreadPlanMetadataForStepType(lldb::StepType step_type) override
lldb::addr_t GetCFA() override
lldb::addr_t GetPC() override
lldb::ValueObjectListSP GetVariables() override
std::optional< std::string > GetDisplayFunctionName() override
std::optional< SymbolContext > GetSymbolContext() override
StructuredData::DictionarySP GetRegisterInfo() override
bool IsInlined() override
lldb::ValueObjectSP GetValueObjectForVariableExpression(llvm::StringRef expr, uint32_t options, Status &status) override
std::optional< std::string > GetFunctionName() override
bool IsArtificial() override
llvm::Expected< StructuredData::GenericSP > CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx, StructuredData::DictionarySP args_sp, StructuredData::Generic *script_obj=nullptr) override
ScriptedFramePythonInterface(ScriptInterpreterPythonImpl &interpreter)
static bool CreateInstance(lldb::ScriptLanguage language, ScriptedInterfaceUsages usages)
ScriptInterpreterPythonImpl & m_interpreter
static T LogAndDefault(llvm::Expected< T > value_or_err, llvm::StringRef caller)
Log the failure in value_or_err and fall back to a default-constructed T.
ScriptedPythonInterface(ScriptInterpreterPythonImpl &interpreter)
llvm::Expected< T > Dispatch(llvm::StringRef method_name, Args &&...args)
Call method_name on the scripted object.
llvm::Expected< std::optional< T > > DispatchToOptional(llvm::StringRef method_name, Args &&...args)
Call an optional method_name, reporting "the script doesn't implementit" as std::nullopt rather than ...
llvm::Expected< StructuredData::GenericSP > CreatePluginObject(const ScriptedMetadata &scripted_metadata, StructuredData::Generic *script_obj, Args... args)
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
#define LLDB_INVALID_ADDRESS
#define LLDB_INVALID_FRAME_ID
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
@ eScriptedExtensionScriptedFrame
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::ValueObjectList > ValueObjectListSP
std::shared_ptr< lldb_private::ExecutionContextRef > ExecutionContextRefSP