[Lldb-commits] [lldb] [lldb][docs] Use section_iter() to iterate over sections (PR #167012)

via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 7 12:02:32 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Ellis Hoag (ellishg)

<details>
<summary>Changes</summary>

Iterating over an `SBModule` directly will give you symbols, not sections. According to the docs, we can use `section_iter()` to iterate over sections.

https://lldb.llvm.org/python_api/lldb.SBModule.html#lldb.SBModule

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


1 Files Affected:

- (modified) lldb/bindings/interface/SBSectionDocstrings.i (+1-1) 


``````````diff
diff --git a/lldb/bindings/interface/SBSectionDocstrings.i b/lldb/bindings/interface/SBSectionDocstrings.i
index 231e9e89da116..9c9cb813158d9 100644
--- a/lldb/bindings/interface/SBSectionDocstrings.i
+++ b/lldb/bindings/interface/SBSectionDocstrings.i
@@ -4,7 +4,7 @@
 SBSection supports iteration through its subsection, represented as SBSection
 as well.  For example, ::
 
-    for sec in exe_module:
+    for sec in exe_module.section_iter():
         if sec.GetName() == '__TEXT':
             print sec
             break

``````````

</details>


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


More information about the lldb-commits mailing list