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

Ellis Hoag via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 7 12:01:55 PST 2025


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

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

>From 456ca445e36b7af89e0a81cda83440c6b5ddf005 Mon Sep 17 00:00:00 2001
From: Ellis Hoag <ellis.sparky.hoag at gmail.com>
Date: Fri, 7 Nov 2025 12:00:45 -0800
Subject: [PATCH] [lldb][docs] Use section_iter() to iterate over sections

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
---
 lldb/bindings/interface/SBSectionDocstrings.i | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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



More information about the lldb-commits mailing list