diff options
| author | Egor Tensin <egor@tensin.name> | 2026-06-06 22:23:54 +0200 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-06-06 22:24:45 +0200 |
| commit | be5e0048913797f2ef91065908730da025113c34 (patch) | |
| tree | dd16e4908bb93953dbc823d7624f76c363a00bf4 /src/_posts/snippets/gdb_sleep_all | |
| parent | bump dependencies (diff) | |
| download | blog-be5e0048913797f2ef91065908730da025113c34.tar.gz blog-be5e0048913797f2ef91065908730da025113c34.zip | |
move Jekyll source files to src/
Diffstat (limited to 'src/_posts/snippets/gdb_sleep_all')
| -rwxr-xr-x | src/_posts/snippets/gdb_sleep_all/gdb_sleep_all.sh | 17 | ||||
| -rw-r--r-- | src/_posts/snippets/gdb_sleep_all/sleep.gdb | 2 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/_posts/snippets/gdb_sleep_all/gdb_sleep_all.sh b/src/_posts/snippets/gdb_sleep_all/gdb_sleep_all.sh new file mode 100755 index 0000000..e923740 --- /dev/null +++ b/src/_posts/snippets/gdb_sleep_all/gdb_sleep_all.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -o errexit -o nounset -o pipefail + +# Select all process IDs that are _not_ children of PID 2, [kthreadd]. +pids="$( ps -o pid --no-headers --ppid 2 -p 2 --deselect )" + +for pid in $pids; do + cmdline="$( cat "/proc/$pid/cmdline" | tr '\0' ' ' )" || continue + echo ------------------------------------------------------------------ + echo "PID: $pid" + echo "Command line: $cmdline" + echo ------------------------------------------------------------------ + gdb -p "$pid" -x sleep.gdb -batch & +done + +wait diff --git a/src/_posts/snippets/gdb_sleep_all/sleep.gdb b/src/_posts/snippets/gdb_sleep_all/sleep.gdb new file mode 100644 index 0000000..6b8f268 --- /dev/null +++ b/src/_posts/snippets/gdb_sleep_all/sleep.gdb @@ -0,0 +1,2 @@ +shell sleep 10 +quit |
