9#include "lldb/Host/Config.h"
26ScriptedPythonInterface::ScriptedPythonInterface(
27 ScriptInterpreterPythonImpl &interpreter)
32ScriptedPythonInterface::ExtractValueFromPythonObject<StructuredData::ArraySP>(
34 python::PythonList result_list(python::PyRefType::Borrowed, p.get());
35 return result_list.CreateStructuredArray();
40ScriptedPythonInterface::ExtractValueFromPythonObject<
42 python::PythonDictionary result_dict(python::PyRefType::Borrowed, p.get());
43 return result_dict.CreateStructuredDictionary();
47Status ScriptedPythonInterface::ExtractValueFromPythonObject<Status>(
50 python::LLDBSWIGPython_CastPyObjectToSBError(p.get())))
51 return m_interpreter.GetStatusFromSBError(*sb_error);
59Event *ScriptedPythonInterface::ExtractValueFromPythonObject<Event *>(
62 python::LLDBSWIGPython_CastPyObjectToSBEvent(p.get())))
63 return m_interpreter.GetOpaqueTypeFromSBEvent(*sb_event);
65 "Couldn't cast lldb::SBEvent to lldb_private::Event.");
72ScriptedPythonInterface::ExtractValueFromPythonObject<lldb::StreamSP>(
75 python::LLDBSWIGPython_CastPyObjectToSBStream(p.get())))
76 return m_interpreter.GetOpaqueTypeFromSBStream(*sb_stream);
78 "Couldn't cast lldb::SBStream to lldb_private::Stream.");
85ScriptedPythonInterface::ExtractValueFromPythonObject<SymbolContext>(
89 python::LLDBSWIGPython_CastPyObjectToSBSymbolContext(p.get())))
90 return m_interpreter.GetOpaqueTypeFromSBSymbolContext(*sb_symbol_context);
92 "Couldn't cast lldb::SBSymbolContext to lldb_private::SymbolContext.");
99ScriptedPythonInterface::ExtractValueFromPythonObject<lldb::DataExtractorSP>(
102 python::LLDBSWIGPython_CastPyObjectToSBData(p.get()));
106 "Couldn't cast lldb::SBData to lldb::DataExtractorSP.");
110 return m_interpreter.GetDataExtractorFromSBData(*sb_data);
115ScriptedPythonInterface::ExtractValueFromPythonObject<lldb::BreakpointSP>(
118 python::LLDBSWIGPython_CastPyObjectToSBBreakpoint(p.get()));
120 if (!sb_breakpoint) {
122 "Couldn't cast lldb::SBBreakpoint to lldb::BreakpointSP.");
126 return m_interpreter.GetOpaqueTypeFromSBBreakpoint(*sb_breakpoint);
133 python::LLDBSWIGPython_CastPyObjectToSBAttachInfo(p.get()));
135 if (!sb_attach_info) {
137 "Couldn't cast lldb::SBAttachInfo to lldb::ProcessAttachInfoSP.");
141 return m_interpreter.GetOpaqueTypeFromSBAttachInfo(*sb_attach_info);
148 python::LLDBSWIGPython_CastPyObjectToSBLaunchInfo(p.get()));
150 if (!sb_launch_info) {
152 "Couldn't cast lldb::SBLaunchInfo to lldb::ProcessLaunchInfoSP.");
156 return m_interpreter.GetOpaqueTypeFromSBLaunchInfo(*sb_launch_info);
160std::optional<MemoryRegionInfo>
161ScriptedPythonInterface::ExtractValueFromPythonObject<
162 std::optional<MemoryRegionInfo>>(python::PythonObject &p,
Status &
error) {
166 python::LLDBSWIGPython_CastPyObjectToSBMemoryRegionInfo(p.get()));
168 if (!sb_mem_reg_info) {
170 "Couldn't cast lldb::SBMemoryRegionInfo to "
171 "lldb_private::MemoryRegionInfo.");
175 return m_interpreter.GetOpaqueTypeFromSBMemoryRegionInfo(*sb_mem_reg_info);
180ScriptedPythonInterface::ExtractValueFromPythonObject<
185 python::LLDBSWIGPython_CastPyObjectToSBExecutionContext(p.get()));
189 "Couldn't cast lldb::SBExecutionContext to "
190 "lldb::ExecutionContextRefSP.");
194 return m_interpreter.GetOpaqueTypeFromSBExecutionContext(*sb_exe_ctx);
static llvm::raw_ostream & error(Stream &strm)
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Array > ArraySP
Defines a symbol context baton that can be handed other debug core functions.
A class that represents a running process on the host machine.
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::DataExtractor > DataExtractorSP
std::shared_ptr< lldb_private::ProcessLaunchInfo > ProcessLaunchInfoSP
std::shared_ptr< lldb_private::ExecutionContextRef > ExecutionContextRefSP