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 <hujun5@xiaomi.com>
This commit is contained in:
hujun5
2025-05-26 16:40:50 +08:00
committed by Xiang Xiao
parent 646010d0a0
commit a50737a75f
2 changed files with 7 additions and 5 deletions
+3 -1
View File
@@ -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:
+4 -4
View File
@@ -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
)