[Lldb-commits] [lldb] [LLDB][Documentation] Add a doc string to sbprocess to show MemoryRegions is iterable (PR #125557)

via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 3 11:05:18 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Jacob Lalonde (Jlalond)

<details>
<summary>Changes</summary>

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

``````````

</details>


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


More information about the lldb-commits mailing list