#! /bin/sh pid=$1 # assumes Linux # also assumes that the process has fd 0, 1, and 2 open. gdb /proc/$pid/exe $pid <