[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@fb.com>
This commit is contained in:
barsolo2000 2025-08-01 09:36:48 -07:00 committed by GitHub
parent 17327482f0
commit 3d098f78bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 1 deletions

View File

@ -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;

View File

@ -115,6 +115,17 @@ public:
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: