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

Jacob Lalonde via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 3 11:02:44 PST 2025


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

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.

>From 9abe2bf9c55ecfb56ed7e46ddbdaa998be6e6fc7 Mon Sep 17 00:00:00 2001
From: Jacob Lalonde <jalalonde at fb.com>
Date: Mon, 3 Feb 2025 10:59:25 -0800
Subject: [PATCH] Add a doc string to sbprocess to show MemoryRegions is
 iterable

---
 lldb/bindings/interface/SBProcessDocstrings.i | 11 +++++++++++
 1 file changed, 11 insertions(+)

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;



More information about the lldb-commits mailing list