12#include "lldb/Host/Config.h"
64 "Couldn't cast lldb::SBEvent to lldb_private::Event.");
77 return m_interpreter.GetOpaqueTypeFromSBCommandReturnObject(*sb_cmd_retobj);
80 "lldb_private::CommandReturnObject.");
90 return m_interpreter.GetOpaqueTypeFromSBStream(*sb_stream);
92 "Couldn't cast lldb::SBStream to lldb_private::Stream.");
103 return m_interpreter.GetOpaqueTypeFromSBFrame(*sb_frame);
105 "Couldn't cast lldb::SBFrame to lldb_private::StackFrame.");
116 return m_interpreter.GetOpaqueTypeFromSBThread(*sb_thread);
118 "Couldn't cast lldb::SBThread to lldb_private::Thread.");
130 return m_interpreter.GetOpaqueTypeFromSBSymbolContext(*sb_symbol_context);
132 "Couldn't cast lldb::SBSymbolContext to lldb_private::SymbolContext.");
146 "Couldn't cast lldb::SBData to lldb::DataExtractorSP.");
150 return m_interpreter.GetDataExtractorFromSBData(*sb_data);
160 if (!sb_breakpoint) {
162 "Couldn't cast lldb::SBBreakpoint to lldb::BreakpointSP.");
166 return m_interpreter.GetOpaqueTypeFromSBBreakpoint(*sb_breakpoint);
179 "Couldn't cast lldb::SBBreakpointLocation to "
180 "lldb::BreakpointLocationSP.");
184 return m_interpreter.GetOpaqueTypeFromSBBreakpointLocation(*sb_break_loc);
193 if (!sb_attach_info) {
195 "Couldn't cast lldb::SBAttachInfo to lldb::ProcessAttachInfoSP.");
199 return m_interpreter.GetOpaqueTypeFromSBAttachInfo(*sb_attach_info);
208 if (!sb_launch_info) {
210 "Couldn't cast lldb::SBLaunchInfo to lldb::ProcessLaunchInfoSP.");
214 return m_interpreter.GetOpaqueTypeFromSBLaunchInfo(*sb_launch_info);
218std::optional<MemoryRegionInfo>
226 if (!sb_mem_reg_info) {
228 "Couldn't cast lldb::SBMemoryRegionInfo to "
229 "lldb_private::MemoryRegionInfo.");
233 return m_interpreter.GetOpaqueTypeFromSBMemoryRegionInfo(*sb_mem_reg_info);
247 "Couldn't cast lldb::SBExecutionContext to "
248 "lldb::ExecutionContextRefSP.");
252 return m_interpreter.GetOpaqueTypeFromSBExecutionContext(*sb_exe_ctx);
261 if (!unsigned_or_err) {
265 unsigned long long unsigned_val = *unsigned_or_err;
267 error =
Status(
"value too large for lldb::DescriptionLevel.");
281 if (!sb_frame_list) {
283 "couldn't cast lldb::SBFrameList to lldb::StackFrameListSP.");
287 return m_interpreter.GetOpaqueTypeFromSBFrameList(*sb_frame_list);
298 "couldn't cast lldb::SBValue to lldb::ValueObjectSP");
302 return m_interpreter.GetOpaqueTypeFromSBValue(*sb_value);
313 "couldn't cast lldb::SBTarget to lldb::TargetSP");
317 return m_interpreter.GetOpaqueTypeFromSBTarget(*sb_target);
331 for (uint32_t i = 0, e = sb_value_list->GetSize(); i < e; ++i) {
332 SBValue value = sb_value_list->GetValueAtIndex(i);
333 out->Append(m_interpreter.GetOpaqueTypeFromSBValue(value));
347 bool aborted =
false;
352 "ValueObjectList item at index {0} is not a "
353 "StructuredData::Generic",
360 static_cast<PyObject *
>(generic->GetValue())));
362 if (
auto valobj_sp = m_interpreter.GetOpaqueTypeFromSBValue(*sb_value))
363 out->Append(valobj_sp);
373 "couldn't extract ValueObjectList from Python return value");
378std::optional<lldb::ValueType>
384 llvm::Expected<unsigned long long> val = p.AsUnsignedLongLong();
389 unsigned long long unmasked = *val & ~kValueTypeFlagsMask;
393 "value type invalid or too large (got {0} | {1:x})", unmasked, flags);
397 return static_cast<ValueType>(unmasked | flags);
406 return m_interpreter.GetOpaqueTypeFromSBDebugger(*sb_dbg);
408 "couldn't cast lldb::SBDebugger to lldb::DebuggerSP.");
413std::vector<std::string>
416 std::vector<std::string> result;
418 if (!list.IsValid()) {
420 "couldn't extract std::vector<std::string>: not a Python list.");
424 const uint32_t size = list.GetSize();
425 result.reserve(size);
426 for (uint32_t i = 0; i < size; ++i) {
428 list.GetItemAtIndex(i).get());
431 result.push_back(item.GetString().str());
static llvm::raw_ostream & error(Stream &strm)
Represents a list of SBFrame objects.
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