From 1a0696ef348050ebc3c1644eaa66dc429d2329ed Mon Sep 17 00:00:00 2001 From: Blue Date: Tue, 13 Jun 2023 14:52:18 -0700 Subject: [PATCH] Add a script to dump all stacks from the debug shell (#10178) * Add a script to dump init's stacks and fd's * Fix LF --- diagnostics/dump-init-stacks.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 diagnostics/dump-init-stacks.sh diff --git a/diagnostics/dump-init-stacks.sh b/diagnostics/dump-init-stacks.sh new file mode 100644 index 00000000..6ffd0cbd --- /dev/null +++ b/diagnostics/dump-init-stacks.sh @@ -0,0 +1,28 @@ +#! /bin/bash + +set -ue + +for proc in /proc/[0-9]*; do + pid=$(basename "$proc") + + echo -e "\nProcess: $pid" + echo -en "cmd: " + cat "/proc/$pid/cmdline" || true + echo -e "\nstat: " + cat "/proc/$pid/stat" || true + + for tid in $(ls "/proc/$pid/task" || true); do + echo -n "tid: $tid - " + cat "/proc/$pid/task/$tid/comm" || true + cat "/proc/$pid/task/$tid/stack" || true + done + + echo "fds: " + ls -la "/proc/$pid/fd" || true +done + +echo "hvsockets: " +ss -lap --vsock + +echo "meminfo: " +cat /proc/meminfo \ No newline at end of file