[Lldb-commits] [lldb] 3d098f7 - [LLDB] Update SBMemoryRegionInfo doc strings to document len and str (#149903)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Aug 1 09:36:51 PDT 2025
Author: barsolo2000
Date: 2025-08-01T09:36:48-07:00
New Revision: 3d098f78bfa82bfae5242402d4b8201b1ec38d06
URL: https://github.com/llvm/llvm-project/commit/3d098f78bfa82bfae5242402d4b8201b1ec38d06
DIFF: https://github.com/llvm/llvm-project/commit/3d098f78bfa82bfae5242402d4b8201b1ec38d06.diff
LOG: [LLDB] Update SBMemoryRegionInfo doc strings to document len and str (#149903)
Updated SBMemoryRegionInfo doc strings:
- Added detailed documentation for the GetDescription() method.
- Included information about the overwritten len() and str() functions
for the SBMemoryRegionInfo type, explaining their behavior and usage.
---------
Co-authored-by: Bar Soloveychik <barsolo at fb.com>
Added:
Modified:
lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i
lldb/include/lldb/API/SBMemoryRegionInfo.h
Removed:
################################################################################
diff --git a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i
index d7c68baf100e2..99fe91b4558a4 100644
--- a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i
+++ b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i
@@ -1,5 +1,10 @@
%feature("docstring",
-"API clients can get information about memory regions in processes."
+"API clients can get information about memory regions in processes.
+
+For Python users, `len()` is overriden to output the size of the memory region in bytes.
+For Python users, `str()` is overriden with the results of the GetDescription function-
+ produces a formatted string that describes a memory range in the form:
+ [Hex start - Hex End) with associated permissions (RWX)"
) lldb::SBMemoryRegionInfo;
%feature("docstring", "
@@ -29,3 +34,11 @@
Return the size of pages in this memory region. 0 will be returned
if this information was unavailable."
) lldb::SBMemoryRegionInfo::GetPageSize();
+
+%feature("docstring", "
+ Takes an SBStream parameter to write output to,
+ formatted [Hex start - Hex End) with associated permissions (RWX).
+ If the function results false, no output will be written.
+ If results true, the output will be written to the stream.
+ "
+) lldb::SBMemoryRegionInfo::GetDescription;
\ No newline at end of file
diff --git a/lldb/include/lldb/API/SBMemoryRegionInfo.h b/lldb/include/lldb/API/SBMemoryRegionInfo.h
index f9a5dc993d7cb..dc5aa0858e1e3 100644
--- a/lldb/include/lldb/API/SBMemoryRegionInfo.h
+++ b/lldb/include/lldb/API/SBMemoryRegionInfo.h
@@ -115,6 +115,17 @@ class LLDB_API SBMemoryRegionInfo {
bool operator!=(const lldb::SBMemoryRegionInfo &rhs) const;
+ /// writes a description of the memory region to a SBStream.
+ ///
+ /// \param[in,out] description
+ /// A stream object where the description will be written.
+ ///
+ /// \return
+ /// Returns true if the description was successfully written,
+ /// false otherwise.
+ ///
+ /// The description format is: [Hex start - Hex End) with associated
+ /// permissions (RWX)
bool GetDescription(lldb::SBStream &description);
private:
More information about the lldb-commits
mailing list