Skip to content

tools/pynuttx: read the mutex holder from sem_t - #22732

Open
anjiahao1 wants to merge 1 commit into
apache:masterfrom
anjiahao1:20261202_nxgdb-mutex-holder
Open

anjiahao1 wants to merge 1 commit into
apache:masterfrom
anjiahao1:20261202_nxgdb-mutex-holder

Conversation

@anjiahao1

Copy link
Copy Markdown
Contributor

Summary

A mutex holder is stored in the low 31 bits of sem.val.mholder, with
bit 31 as the blocking flag; mutex_t no longer carries a holder field of
its own. Read it through a sem_t and mask the blocking bit in the
thread listing and in ps, instead of casting to mutex_t and reading a
holder member that no longer exists. The helper is added to utils.

Impact

tools/pynuttx/nxgdb/thread.py and tools/pynuttx/nxgdb/utils.py only;
both commands are changed to read the value the C code actually stores.

Testing

  • tools/checkpatch.sh -c -u -m passes.
  • python3 -m py_compile tools/pynuttx/nxgdb/thread.py tools/pynuttx/nxgdb/utils.py passes.

The holder of a mutex lives in the low 31 bits of sem.val.mholder, with
bit 31 as the blocking flag; mutex_t no longer carries a holder field of
its own.  Read it through a sem_t with the blocking bit masked in
thread.py, both in the thread listing and in ps, and add the helper to
utils.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants