diff options
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python')
2 files changed, 20 insertions, 0 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFrameProviderPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFrameProviderPythonInterface.cpp index 3dde503..2d87c1b 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFrameProviderPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFrameProviderPythonInterface.cpp @@ -70,6 +70,24 @@ std::string ScriptedFrameProviderPythonInterface::GetDescription( return obj->GetStringValue().str(); } +std::optional<uint32_t> +ScriptedFrameProviderPythonInterface::GetPriority(llvm::StringRef class_name) { + Status error; + StructuredData::ObjectSP obj = + CallStaticMethod(class_name, "get_priority", error); + + if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj, + error)) + return std::nullopt; + + // Try to extract as unsigned integer. Return nullopt if Python returned None + // or if extraction fails. + if (StructuredData::UnsignedInteger *int_obj = obj->GetAsUnsignedInteger()) + return static_cast<uint32_t>(int_obj->GetValue()); + + return std::nullopt; +} + StructuredData::ObjectSP ScriptedFrameProviderPythonInterface::GetFrameAtIndex(uint32_t index) { Status error; diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFrameProviderPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFrameProviderPythonInterface.h index 97a5cc7..884b035 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFrameProviderPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFrameProviderPythonInterface.h @@ -43,6 +43,8 @@ public: std::string GetDescription(llvm::StringRef class_name) override; + std::optional<uint32_t> GetPriority(llvm::StringRef class_name) override; + StructuredData::ObjectSP GetFrameAtIndex(uint32_t index) override; static void Initialize(); |
