Skip to content

[LLDB][Documentation] Add a doc string to sbprocess to show MemoryRegions is iterable #125557

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 1 commit into from
Feb 3, 2025

Conversation

Jlalond
Copy link
Contributor

@Jlalond Jlalond commented Feb 3, 2025

My colleague, @lukejriddle made the SBMemoryRegionList object iterable in #117358. This isn't documented anywhere and so I added a blurb about it to SBProcess.

@Jlalond Jlalond requested a review from JDevlieghere as a code owner February 3, 2025 19:02
@llvmbot llvmbot added the lldb label Feb 3, 2025
@Jlalond
Copy link
Contributor Author

Jlalond commented Feb 3, 2025

@JDevlieghere You think I should also update the summary of the SBMemoryRegionList type to note it's iterable?

@llvmbot
Copy link
Member

llvmbot commented Feb 3, 2025

@llvm/pr-subscribers-lldb

Author: Jacob Lalonde (Jlalond)

Changes

My colleague, @lukejriddle made the SBMemoryRegionList object iterable in #117358. This isn't documented anywhere and so I added a blurb about it to SBProcess.


Full diff: https://github.com/llvm/llvm-project/pull/125557.diff

1 Files Affected:

  • (modified) lldb/bindings/interface/SBProcessDocstrings.i (+11)
diff --git a/lldb/bindings/interface/SBProcessDocstrings.i b/lldb/bindings/interface/SBProcessDocstrings.i
index 1b98a79e4f6d36..b5b22052a60944 100644
--- a/lldb/bindings/interface/SBProcessDocstrings.i
+++ b/lldb/bindings/interface/SBProcessDocstrings.i
@@ -258,3 +258,14 @@ SBProcess supports thread iteration. For example (from test/lldbutil.py), ::
     Deallocates the block of memory (previously allocated using
     AllocateMemory) given in the argument."
 ) lldb::SBProcess::DeallocateMemory;
+
+%feature("docstring", "
+    Get a list of all the memory regions associated with this process.
+    ```
+        readable_regions = []
+        for region in process.GetMemoryRegions():
+            if region.IsReadable():
+                readable_regions.append(region)
+    ```
+"
+) lldb::SBProcess::GetMemoryRegions;

Copy link
Member

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Jlalond Jlalond merged commit a3321ea into llvm:main Feb 3, 2025
7 of 8 checks passed
Icohedron pushed a commit to Icohedron/llvm-project that referenced this pull request Feb 11, 2025
…ions is iterable (llvm#125557)

My colleague, @lukejriddle made the SBMemoryRegionList object iterable
in llvm#117358. This isn't documented anywhere and so I added a blurb about
it to SBProcess.
@Jlalond Jlalond deleted the getmemoryregions-iterable-documentation branch March 7, 2025 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants