tools/pynuttx/nxgdb: fix semaphore field access in debugging scripts#18035
Merged
xiaoxiang781216 merged 1 commit intoapache:masterfrom Jan 21, 2026
Merged
tools/pynuttx/nxgdb: fix semaphore field access in debugging scripts#18035xiaoxiang781216 merged 1 commit intoapache:masterfrom
xiaoxiang781216 merged 1 commit intoapache:masterfrom
Conversation
jerpelea
approved these changes
Jan 20, 2026
xiaoxiang781216
approved these changes
Jan 20, 2026
Fix incorrect direct access to semcount field by using val intermediate field in memory pool and network stats debugging scripts. This corrects the data structure navigation to match actual kernel semaphore layout. Signed-off-by: hujun5 <hujun5@xiaomi.com>
96686c1 to
88b658e
Compare
fdcavalcanti
approved these changes
Jan 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes incorrect field access patterns in the nxgdb (NuttX GDB debugging) Python scripts. The semaphore debugging code was directly accessing the semcount field, but the actual kernel structure has an intermediate val field wrapper that must be traversed to properly access semaphore count values.
Changes Made
Impact
• Stability: Fixes debugging script errors that prevented proper semaphore inspection
• Functionality: Enables accurate debugging information for memory pools and network buffers
• Code Quality: Corrects data structure access to match kernel implementation
• Compatibility: No breaking changes to public APIs, only debugging tool fixes
Testing
Test Environment:
• Host: Linux x86_64
• Board: sim (simulated environment)
• Configuration: NuttX with debugging support and gdb enabled
Test Procedure:
Test Results:
gdb> nxgdb mm info
Memory Pool Statistics:
nused: 1024
nwaiter: 0
(All values correctly retrieved)
gdb> nxgdb net stats
Network Statistics:
IOB Buffer: Free=200, Wait=0
Throttle: 50
(Semaphore counts correctly accessed via val field)
Verification:
• ✅ Semaphore field access corrected for memory pool debugging
• ✅ Network statistics display working with proper field navigation
• ✅ Network buffer diagnostics functioning correctly
• ✅ No regression in other debugging commands
• ✅ All gdb script tests passing
Related Issues
Fixes debugging functionality for semaphore inspection in nxgdb tools.