Skip to content

Commit

Permalink
Add a script to dump all stacks from the debug shell (#10178)
Browse files Browse the repository at this point in the history
* Add a script to dump init's stacks and fd's

* Fix LF
  • Loading branch information
OneBlue authored Jun 13, 2023
1 parent b88ff2d commit 1a0696e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions diagnostics/dump-init-stacks.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1a0696e

Please sign in to comment.