add stallion's rdb helper mentioned in rdb(8) Reference: /n/atom/patch/applied/rdbhelper Date: Tue Mar 11 15:36:21 CET 2014 Signed-off-by: quanstro@quanstro.net --- /rc/bin/rdb Thu Jan 1 00:00:00 1970 +++ /rc/bin/rdb Tue Mar 11 15:35:41 2014 @@ -0,0 +1,51 @@ +#!/bin/rc +# rdb - remote kernel debugging + +rfork en + +flagfmt=() +ptflagfmt='q,w,l library,m machine' +ptargs='acid options' # usage: print [acid options] not actual options +args='system [text]' +if(! ifs=() eval `{aux/getflags $*} || ~ $#* 0){ + aux/usage + exit usage +} +sys=$1 +text=$2 + +server=`{consoleof $sys} +if(~ $server ''){ + echo >[1=2] rdb: unknown console server for $sys + exit noconsole +} + +if (~ $text ''){ + pxe=`{pxeof $sys} + if (~ $pxe ''){ + echo >[1=2] rdb: unknown pxe configuration for $sys + exit notext + } + text=`{grep '^bootfile=' $pxe | sed 's/\.gz$//' | awk -F! '{print $2}'} +} +if(! test -f $text){ + echo >[1=2] rdb: file not found: $text + exit notext +} + +# kernel may be installed. find the original text. +textbase=`{basename -d $text} +s=`{src -n $textbase} +if(~ $#s 1) + textbase=`{basename -d $s} +textbase=`{basename -d $text} +acid=$textbase/acid +if(! test -f $acid) + @{cd $textbase && mk acid} +if(! test -f $acid) + exit noacidlib + +import $server /mnt/consoles +rdbfs /mnt/consoles/$sys +acid -k -l kernel -l mach -l $acid $ptflag -r $text +exit ''