[Lldb-commits] [lldb] [lldb][ResolveSourceFileCallback] Update SBFileSpec/SBModule (PR #120832)
via lldb-commits
lldb-commits at lists.llvm.org
Sat Dec 21 01:00:21 PST 2024
https://github.com/rchamala updated https://github.com/llvm/llvm-project/pull/120832
>From 7cc031dbd888fdfa993c08da837df956f263877f Mon Sep 17 00:00:00 2001
From: Rahul Reddy Chamala <rachamal at fb.com>
Date: Thu, 19 Dec 2024 19:09:34 -0800
Subject: [PATCH] [lldb][ResolveSourceFileCallback] Update SBFileSpec/SBModule
Summary:
RFC https://discourse.llvm.org/t/rfc-python-callback-for-source-file-resolution/83545
SBFileSpec and SBModule will be used for resolve source file callback as Python
function arguments. This diff allows these things.
Can be instantiated from SBPlatform.
Can be passed to/from Python.
Test Plan:
N/A. The next set of diffs in the stack have unittests and shell test validation
---
lldb/bindings/python/python-swigsafecast.swig | 5 +++++
lldb/include/lldb/API/SBModule.h | 3 +++
.../Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h | 1 +
3 files changed, 9 insertions(+)
diff --git a/lldb/bindings/python/python-swigsafecast.swig b/lldb/bindings/python/python-swigsafecast.swig
index 7a4f7e81f1cc3b..429baad158ca5d 100644
--- a/lldb/bindings/python/python-swigsafecast.swig
+++ b/lldb/bindings/python/python-swigsafecast.swig
@@ -23,6 +23,11 @@ PythonObject SWIGBridge::ToSWIGWrapper(lldb::ProcessSP process_sp) {
SWIGTYPE_p_lldb__SBProcess);
}
+PythonObject SWIGBridge::ToSWIGWrapper(lldb::ModuleSP module_sp) {
+ return ToSWIGHelper(new lldb::SBModule(std::move(module_sp)),
+ SWIGTYPE_p_lldb__SBModule);
+}
+
PythonObject SWIGBridge::ToSWIGWrapper(lldb::ThreadPlanSP thread_plan_sp) {
return ToSWIGHelper(new lldb::SBThreadPlan(std::move(thread_plan_sp)),
SWIGTYPE_p_lldb__SBThreadPlan);
diff --git a/lldb/include/lldb/API/SBModule.h b/lldb/include/lldb/API/SBModule.h
index 7200a1ef53fd82..85332066ee6875 100644
--- a/lldb/include/lldb/API/SBModule.h
+++ b/lldb/include/lldb/API/SBModule.h
@@ -301,9 +301,12 @@ class LLDB_API SBModule {
friend class SBFrame;
friend class SBSection;
friend class SBSymbolContext;
+ friend class SBPlatform;
friend class SBTarget;
friend class SBType;
+ friend class lldb_private::python::SWIGBridge;
+
explicit SBModule(const lldb::ModuleSP &module_sp);
ModuleSP GetSP() const;
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h b/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
index 518a478af5f6a8..0f0e4a563e8b2b 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
@@ -84,6 +84,7 @@ class SWIGBridge {
static PythonObject ToSWIGWrapper(lldb::ValueObjectSP value_sp);
static PythonObject ToSWIGWrapper(lldb::TargetSP target_sp);
static PythonObject ToSWIGWrapper(lldb::ProcessSP process_sp);
+ static PythonObject ToSWIGWrapper(lldb::ModuleSP module_sp);
static PythonObject ToSWIGWrapper(lldb::ThreadPlanSP thread_plan_sp);
static PythonObject ToSWIGWrapper(lldb::BreakpointSP breakpoint_sp);
static PythonObject ToSWIGWrapper(Status &&status);
More information about the lldb-commits
mailing list