Skip to content

Commit

Permalink
tools/gdb: avoid direct access to tcb['name']
Browse files Browse the repository at this point in the history
It could be disabled at compile time. Use utils.get_task_name to handle it

Signed-off-by: xuxingliang <[email protected]>
  • Loading branch information
XuNeo authored and xiaoxiang781216 committed Nov 24, 2024
1 parent 41c4eb0 commit 358261a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tools/gdb/nuttxgdb/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def fetch_stacks():

try:
stacks[int(tcb["pid"])] = Stack(
tcb["name"].string(),
utils.get_task_name(tcb),
hex(tcb["entry"]["pthread"]), # should use main?
int(tcb["stack_base_ptr"]),
int(tcb["stack_alloc_ptr"]),
Expand Down
6 changes: 3 additions & 3 deletions tools/gdb/nuttxgdb/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def invoke(self, args, from_tty):
info = (
"(Name: \x1b[31;1m%s\x1b[m, State: %s, Priority: %d, Stack: %d)"
% (
tcb["name"].string(),
utils.get_task_name(tcb),
statename,
tcb["sched_priority"],
tcb["adj_stack_size"],
Expand Down Expand Up @@ -509,7 +509,7 @@ def cast2ptr(x, t):
] # exclude "0x"

st = Stack(
tcb["name"].string(),
utils.get_task_name(tcb),
hex(tcb["entry"]["pthread"]), # should use main?
int(tcb["stack_base_ptr"]),
int(tcb["stack_alloc_ptr"]),
Expand All @@ -527,7 +527,7 @@ def cast2ptr(x, t):
# For a task we need to display its cmdline arguments, while for a thread we display
# pointers to its entry and argument
cmd = ""
name = tcb["name"].string()
name = utils.get_task_name(tcb)

if int(tcb["flags"] & get_macro("TCB_FLAG_TTYPE_MASK")) == int(
get_macro("TCB_FLAG_TTYPE_PTHREAD")
Expand Down

0 comments on commit 358261a

Please sign in to comment.