You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by bt...@apache.org on 2021/01/17 05:33:51 UTC
[incubator-nuttx] branch master updated: gdbinit: add support for
reporting total and used stack size
This is an automated email from the ASF dual-hosted git repository.
btashton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new a150e03 gdbinit: add support for reporting total and used stack size
a150e03 is described below
commit a150e03e248add82a23bb5ffb2242037cdcdd5d6
Author: Matias N <ma...@protobits.dev>
AuthorDate: Sun Jan 17 00:18:04 2021 -0300
gdbinit: add support for reporting total and used stack size
This checks if the required function is defined (when stack coloration
is enabled) and, if so, calls it to get used stack. Otherwise it just
reports zero used stack.
---
tools/nuttx-gdbinit | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/tools/nuttx-gdbinit b/tools/nuttx-gdbinit
index e917bfd..fb0b91d 100644
--- a/tools/nuttx-gdbinit
+++ b/tools/nuttx-gdbinit
@@ -67,6 +67,9 @@ define _examine_target
set $_target_max_tasks = sizeof(g_pidhash) / sizeof(struct pidhash_s)
+ python if (type(gdb.lookup_global_symbol("up_check_tcbstack")) is gdb.Symbol) : \
+ gdb.execute("set $_target_has_stack_coloration = 1")
+
printf "target examined \n"
python print("_target_arch.name=" + _target_arch.name())
@@ -88,9 +91,15 @@ define _print_thread
printf " "
end
- printf "%d Thread 0x%x (Name: %s, State: %s, Priority: %d) 0x%x in ", \
+ if ($_target_has_stack_coloration)
+ set $stack_used = up_check_tcbstack($tcb)
+ else
+ set $stack_used = 0
+ end
+
+ printf "%d Thread 0x%x (Name: %s, State: %s, Priority: %d, Stack: %d/%d) PC: 0x%x in ", \
$tcb->pid, $tcb, $tcb->name, g_statenames[$tcb->task_state], $tcb->sched_priority, \
- $tcb->xcp.regs[$_pc_reg_idx]
+ $stack_used, $tcb->adj_stack_size, $tcb->xcp.regs[$_pc_reg_idx]
python _symbol = gdb.execute("info symbol $tcb->xcp.regs[$_pc_reg_idx]", to_string=True); \
print(_symbol.split()[0] + "()")
end