This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new a50737a75f5 tools/pynuttx/nxgdb: fix semaphore field access in 
debugging scripts
a50737a75f5 is described below

commit a50737a75f5454024c53be60929ca62f4ae4b1b1
Author: hujun5 <[email protected]>
AuthorDate: Mon May 26 16:40:50 2025 +0800

    tools/pynuttx/nxgdb: fix semaphore field access in debugging scripts
    
    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 <[email protected]>
---
 tools/pynuttx/nxgdb/mm.py  | 4 +++-
 tools/pynuttx/nxgdb/net.py | 8 ++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/pynuttx/nxgdb/mm.py b/tools/pynuttx/nxgdb/mm.py
index 7ec814164d6..dbb1e56dec6 100644
--- a/tools/pynuttx/nxgdb/mm.py
+++ b/tools/pynuttx/nxgdb/mm.py
@@ -223,7 +223,9 @@ class MemPool(Value, p.MemPool):
 
     @property
     def nwaiter(self) -> int:
-        return -int(self.waitsem.semcount) if self.wait and self.expandsize == 
0 else 0
+        return (
+            -int(self.waitsem.val.semcount) if self.wait and self.expandsize 
== 0 else 0
+        )
 
     @property
     def nused(self) -> int:
diff --git a/tools/pynuttx/nxgdb/net.py b/tools/pynuttx/nxgdb/net.py
index ffb23a113d4..95f6680127f 100644
--- a/tools/pynuttx/nxgdb/net.py
+++ b/tools/pynuttx/nxgdb/net.py
@@ -128,11 +128,11 @@ class NetStats(gdb.Command):
             size = utils.get_symbol_value("CONFIG_IOB_BUFSIZE")
             ntotal = utils.get_symbol_value("CONFIG_IOB_NBUFFERS")
 
-            nfree = gdb.parse_and_eval("g_iob_sem")["semcount"]
+            nfree = gdb.parse_and_eval("g_iob_sem")["val"]["semcount"]
             nwait, nfree = (0, nfree) if nfree >= 0 else (-nfree, 0)
 
             nthrottle = (
-                gdb.parse_and_eval("g_throttle_sem")["semcount"]
+                gdb.parse_and_eval("g_throttle_sem")["val"]["semcount"]
                 if utils.get_symbol_value("CONFIG_IOB_THROTTLE") > 0
                 else 0
             )
@@ -293,9 +293,9 @@ class NetCheck(gdb.Command):
         result = NetCheckResult.PASS
         message = []
         try:
-            nfree = gdb.parse_and_eval("g_iob_sem")["semcount"]
+            nfree = gdb.parse_and_eval("g_iob_sem")["val"]["semcount"]
             nthrottle = (
-                gdb.parse_and_eval("g_throttle_sem")["semcount"]
+                gdb.parse_and_eval("g_throttle_sem")["val"]["semcount"]
                 if utils.get_symbol_value("CONFIG_IOB_THROTTLE") > 0
                 else 0
             )

Reply via email to