Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions tools/pynuttx/nxgdb/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,7 @@ def invoke(self, args, from_tty):
if tcb["task_state"] == gdb.parse_and_eval("TSTATE_WAIT_SEM"):
mutex = tcb["waitobj"].cast(utils.lookup_type("sem_t").pointer())
if mutex["flags"] & SEM_TYPE_MUTEX:
mutex = tcb["waitobj"].cast(utils.lookup_type("mutex_t").pointer())
statename = f"Waiting,Mutex:{mutex['holder']}"
statename = f"Waiting,Mutex:{utils.mutex_get_holder(mutex)}"

try:
"""Maybe tcb not have name member, or name is not utf-8"""
Expand Down Expand Up @@ -488,7 +487,7 @@ def cast2ptr(x, t):
)

waiter = (
str(int(cast2ptr(tcb["waitobj"], "mutex_t")["holder"]))
str(utils.mutex_get_holder(cast2ptr(tcb["waitobj"], "sem_t")))
if tcb["waitobj"]
and cast2ptr(tcb["waitobj"], "sem_t")["flags"] & get_macro("SEM_TYPE_MUTEX")
else ""
Expand Down
6 changes: 6 additions & 0 deletions tools/pynuttx/nxgdb/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,12 @@ def get_task_name(tcb):
return ""


# sem
def mutex_get_holder(sem):
NXSEM_MBLOCKING_BIT = 1 << 31
return sem["val"]["mholder"] & ~NXSEM_MBLOCKING_BIT


def switch_inferior(inferior):
state = suppress_cli_notifications(True)

Expand Down