Skip to content

Conversation

@ellishg
Copy link
Contributor

@ellishg ellishg commented Nov 7, 2025

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

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
@ellishg ellishg marked this pull request as ready for review November 7, 2025 20:01
@ellishg ellishg requested a review from JDevlieghere as a code owner November 7, 2025 20:01
@llvmbot llvmbot added the lldb label Nov 7, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 7, 2025

@llvm/pr-subscribers-lldb

Author: Ellis Hoag (ellishg)

Changes

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

@ellishg ellishg merged commit 3511388 into llvm:main Nov 7, 2025
14 checks passed
@ellishg ellishg deleted the lldb-docs-fixup branch November 7, 2025 21:19
vinay-deshmukh pushed a commit to vinay-deshmukh/llvm-project that referenced this pull request Nov 8, 2025
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