hujun260 opened a new pull request, #18035:
URL: https://github.com/apache/nuttx/pull/18035

   ## 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
   - Fix MemPool.nwaiter property to access semcount via val field in 
tools/pynuttx/nxgdb/mm.py
   - Fix g_iob_sem access in NetStats command to use val.semcount in 
tools/pynuttx/nxgdb/net.py
   - Fix g_throttle_sem access in NetStats command to use val.semcount in 
tools/pynuttx/nxgdb/net.py
   - Fix semaphore access in NetCheck command to use val.semcount in 
tools/pynuttx/nxgdb/net.py
   
   ### 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:
   
   1. Built NuttX with debugging symbols
   2. Ran nxgdb debugging commands for memory pool inspection
   3. Executed NetStats command to check network buffer statistics
   4. Ran NetCheck command to verify network buffer diagnostics
   5. Verified all semaphore count values correctly retrieved and displayed
   
   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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to