tools/gdb: avoid direct access to tcb['name']

It could be disabled at compile time. Use utils.get_task_name to handle it

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
This commit is contained in:
xuxingliang 2024-10-08 11:50:22 +08:00 committed by Xiang Xiao
parent 41c4eb08c0
commit 358261af19
2 changed files with 4 additions and 4 deletions

View file

@ -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"]),

View file

@ -264,7 +264,7 @@ class Nxinfothreads(gdb.Command):
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"],
@ -509,7 +509,7 @@ class Ps(gdb.Command):
] # 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"]),
@ -527,7 +527,7 @@ class Ps(gdb.Command):
# 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")