mirror of
https://github.com/apache/nuttx.git
synced 2026-05-13 10:38:40 +08:00
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:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user