Skip to content

[LLDB] Update SBMemoryRegionInfo doc strings to document len and str #149903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i
Original file line number Diff line number Diff line change
@@ -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", "
Expand Down Expand Up @@ -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;
11 changes: 11 additions & 0 deletions lldb/include/lldb/API/SBMemoryRegionInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading