Newsgroups: comp.parallel.pvm
From: zender@sage.cgd.ucar.edu (Charlie Zender)
Subject: modified debugger script for xdbx, SunOS, AIX
Organization: National Center for Atmospheric Research/Boulder, CO
Date: 18 Sep 1994 20:43:14 GMT
Message-ID: <35i8p2$gqi@ncar.ucar.edu>

i put together the following script as an alternative to the
debugger scripts supplied with the pvm distribution. this script
will be call whenever pvm_spawn is called with pvmtaskdebug set.
the best way to access it is to override the default debugging
script by placing, e.g.,

bx=/crestone/u1/zender/pvm3/debugger

in your host file. this modified script attempts to open xdbx (Sun) or xde
(AIX) with your source code displayed. the script doesn't call
the debugger from a separate shell, so the number of windows displayed
on your system isn't unreasonable. some debugging information is also
placed in the /tmp/pvml log file.

-- 
Charlie Zender                Tel: (303) 497-1612 
NCAR/CGD/CMS Rm ML-320        fax: (303) 497-1324
P.O. Box 3000                 zender@ncar.ucar.edu
Boulder CO 80307-3000         http://www.cgd.ucar.edu/cms/zender

#!/bin/csh -f
#
# Replacement script for the distribution $(PVM_ROOT)/lib/debugger
# and debugger 2 scripts. 
#
# This script calls the windowing debuggers on AIX and SUN4 systems
# without spawning a shell window. The debuggers are called with
# startup scripts to stop execution at the first command so that
# breakpoints may be set and execution resumed.
#
#
if ($#argv < 1) then
	echo "usage: debugger command [args]"
	exit 1
endif
#
set DBX_START_SCRIPT=dbx_init.$$
#
switch ($PVM_ARCH)
#
case SUN2:
case SUN3:
case SUN4:
case SUN4SOL2:
	set DBX_EXECUTABLE="xdbx"
#
# the -s tells dbx to read a startup file. the appended r tells
# dbx to delete the startup file upon completion.
#
	set DBX_ARGUMENTS="-sr $DBX_START_SCRIPT"
#
# xdbx may be started without specifying any executable
#
	set debug_command="$DBX_EXECUTABLE $DBX_ARGUMENTS"
#
# specify the executable in the startup script.
#
	echo debug $argv[1] > $DBX_START_SCRIPT
#
# for C programs, "stop in main()" puts the point at the first 
# executable statement. this is untested with fortran.
#
	echo stop in main >> $DBX_START_SCRIPT
#
# The next command is tells dbx where to look for source files
# besides the local directory.
#
#	echo use /crestone/u1/zender/pvm3 /crestone/u1/zender/pvm3/bin/$PVM_ARCH >> $DBX_START_SCRIPT
#
# Getting the source automatically displayed is tricky with xdbx.
# Using file <filename> after the debug command works the xdbx 2.1
#
	echo file pvm_test.c >> $DBX_START_SCRIPT
	echo run $argv[2-] >> $DBX_START_SCRIPT
#
	breaksw
case RS6K:
	set DBX_EXECUTABLE="xde"
#
# the -c tells dbx to read a startup file. there is no option
# to automatically delete the startup file after use, so this
# is handled manually at the end of the script.
#
	set DBX_ARGUMENTS="-c $DBX_START_SCRIPT"
#
# xde wants the executable on the command line, otherwise xde won't
# start.
#
	set debug_command="$DBX_EXECUTABLE $DBX_ARGUMENTS $argv[1]"
#
	echo stop in main > $DBX_START_SCRIPT
	echo run $argv[2-] >> $DBX_START_SCRIPT
#
	breaksw
default:
	breaksw
endsw
#
set noglob
set hn=`hostname`
#
# These three lines cause the contents of the $DBX_START_SCRIPT to be
# displayed in the /tmp/pvml log file. They are for debugging
# purposes.
#
echo contents of DBX_START_SCRIPT = $DBX_START_SCRIPT are:
echo `cat $DBX_START_SCRIPT`
echo executing command $debug_command
#
$debug_command
#
# Get rid of the startup script after we're done.
#
/bin/rm -f $DBX_START_SCRIPT


