tools/pynuttx/nxgdb: fix semaphore field access in debugging scripts #18035
+7
−5
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.