14#include "lldb/Host/Config.h"
66 "Couldn't cast lldb::SBEvent to lldb_private::Event.");
82 "lldb_private::CommandReturnObject.");
94 "Couldn't cast lldb::SBStream to lldb_private::Stream.");
107 "Couldn't cast lldb::SBFrame to lldb_private::StackFrame.");
120 "Couldn't cast lldb::SBThread to lldb_private::Thread.");
134 "Couldn't cast lldb::SBSymbolContext to lldb_private::SymbolContext.");
148 "Couldn't cast lldb::SBData to lldb::DataExtractorSP.");
162 if (!sb_breakpoint) {
164 "Couldn't cast lldb::SBBreakpoint to lldb::BreakpointSP.");
181 "Couldn't cast lldb::SBBreakpointLocation to "
182 "lldb::BreakpointLocationSP.");
195 if (!sb_attach_info) {
197 "Couldn't cast lldb::SBAttachInfo to lldb::ProcessAttachInfoSP.");
210 if (!sb_launch_info) {
212 "Couldn't cast lldb::SBLaunchInfo to lldb::ProcessLaunchInfoSP.");
220std::optional<MemoryRegionInfo>
228 if (!sb_mem_reg_info) {
230 "Couldn't cast lldb::SBMemoryRegionInfo to "
231 "lldb_private::MemoryRegionInfo.");
249 "Couldn't cast lldb::SBExecutionContext to "
250 "lldb::ExecutionContextRefSP.");
263 if (!unsigned_or_err) {
267 unsigned long long unsigned_val = *unsigned_or_err;
269 error =
Status(
"value too large for lldb::DescriptionLevel.");
283 if (!sb_frame_list) {
285 "couldn't cast lldb::SBFrameList to lldb::StackFrameListSP.");
300 "couldn't cast lldb::SBValue to lldb::ValueObjectSP");
315 "couldn't cast lldb::SBTarget to lldb::TargetSP");
333 for (uint32_t i = 0, e = sb_value_list->GetSize(); i < e; ++i) {
334 SBValue value = sb_value_list->GetValueAtIndex(i);
349 bool aborted =
false;
354 "ValueObjectList item at index {0} is not a "
355 "StructuredData::Generic",
362 static_cast<PyObject *
>(generic->GetValue())));
365 out->Append(valobj_sp);
375 "couldn't extract ValueObjectList from Python return value");
380std::optional<lldb::ValueType>
386 llvm::Expected<unsigned long long> val = p.AsUnsignedLongLong();
391 unsigned long long unmasked = *val & ~kValueTypeFlagsMask;
395 "value type invalid or too large (got {0} | {1:x})", unmasked, flags);
399 return static_cast<ValueType>(unmasked | flags);
410 "couldn't cast lldb::SBDebugger to lldb::DebuggerSP.");
415std::vector<std::string>
418 std::vector<std::string> result;
420 if (!list.IsValid()) {
422 "couldn't extract std::vector<std::string>: not a Python list.");
426 const uint32_t size = list.GetSize();
427 result.reserve(size);
428 for (uint32_t i = 0; i < size; ++i) {
430 list.GetItemAtIndex(i).get());
433 result.push_back(item.GetString().str());
static llvm::raw_ostream & error(Stream &strm)
Represents a list of SBFrame objects.
static SymbolContext GetSymbolContext(const lldb::SBSymbolContext &sym_ctx)
static lldb::DataExtractorSP GetDataExtractor(const lldb::SBData &data)
static lldb::BreakpointLocationSP GetBreakpointLocation(const lldb::SBBreakpointLocation &break_loc)
static lldb::ProcessLaunchInfoSP GetProcessLaunchInfo(const lldb::SBLaunchInfo &launch_info)
static CommandReturnObject * GetCommandReturnObject(const lldb::SBCommandReturnObject &cmd_retobj)
static lldb::BreakpointSP GetBreakpoint(const lldb::SBBreakpoint &breakpoint)
static lldb::ThreadSP GetThread(const lldb::SBThread &thread)
static lldb::ExecutionContextRefSP GetExecutionContextRef(const lldb::SBExecutionContext &exe_ctx)
static lldb::TargetSP GetTarget(const lldb::SBTarget &target)
static lldb::DebuggerSP GetDebugger(const lldb::SBDebugger &debugger)
static lldb::ProcessAttachInfoSP GetProcessAttachInfo(const lldb::SBAttachInfo &attach_info)
static lldb::StackFrameSP GetStackFrame(const lldb::SBFrame &frame)
static lldb::StackFrameListSP GetStackFrameList(const lldb::SBFrameList &frame_list)
static lldb::StreamSP GetStream(const lldb::SBStream &stream)
static Event * GetEvent(const lldb::SBEvent &event)
static std::optional< MemoryRegionInfo > GetMemoryRegionInfo(const lldb::SBMemoryRegionInfo &mem_region)
static lldb::ValueObjectSP GetValueObject(const lldb::SBValue &value)
static Status GetStatus(const lldb::SBError &error)
ScriptedInterface()=default
ScriptInterpreterPythonImpl & m_interpreter
T ExtractValueFromPythonObject(python::PythonObject &p, Status &error)
ScriptedPythonInterface(ScriptInterpreterPythonImpl &interpreter)
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
bool ForEach(std::function< bool(Object *object)> const &foreach_callback) const
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
std::shared_ptr< Array > ArraySP
Defines a symbol context baton that can be handed other debug core functions.
StructuredData::DictionarySP CreateStructuredDictionary() const
StructuredData::ArraySP CreateStructuredArray() const
StructuredData::ObjectSP CreateStructuredObject() const
llvm::Expected< unsigned long long > AsUnsignedLongLong() const
void * LLDBSWIGPython_CastPyObjectToSBExecutionContext(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBFrameList(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBThread(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBData(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBTarget(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBSymbolContext(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBStream(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBCommandReturnObject(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBMemoryRegionInfo(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBDebugger(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBBreakpointLocation(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBError(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBAttachInfo(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBLaunchInfo(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBValueList(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBValue(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBEvent(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBBreakpoint(PyObject *data)
void * LLDBSWIGPython_CastPyObjectToSBFrame(PyObject *data)
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::BreakpointLocation > BreakpointLocationSP
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::ProcessAttachInfo > ProcessAttachInfoSP
std::shared_ptr< lldb_private::Stream > StreamSP
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
std::shared_ptr< lldb_private::ValueObjectList > ValueObjectListSP
std::shared_ptr< lldb_private::Debugger > DebuggerSP
class LLDB_API SBMemoryRegionInfo
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::DataExtractor > DataExtractorSP
std::shared_ptr< lldb_private::ProcessLaunchInfo > ProcessLaunchInfoSP
std::shared_ptr< lldb_private::StackFrameList > StackFrameListSP
std::shared_ptr< lldb_private::ExecutionContextRef > ExecutionContextRefSP