aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/stack13
1 files changed, 12 insertions, 1 deletions
diff --git a/bin/stack b/bin/stack
index af649d55..933a6132 100755
--- a/bin/stack
+++ b/bin/stack
@@ -1,3 +1,14 @@
#!/usr/local/plan9/bin/rc
-echo '$c' | 9 db -q $*
+pid=$1
+shift
+if(! ~ $pid [0-9] [0-9]*[0-9] */core *.core core.* */core.*){
+ name=$pid
+ pid=`{psu|awk '$NF=="'$name'" {print $2}'}
+ if(~ $#pid 0){
+ echo 'stack: no process '$name
+ exit none
+ }
+}
+for(p in $pid)
+ echo '$c' | 9 db -q $p $*