gdbwhere.pl and gdb.input files
#!/usr/bin/perl
if ($argc > 0) # search for the program named on the command line
{
$mpi_pids=`ps -u $ENV{USER} -o pid,state,cmd | grep -v grep | grep -v 'ps ' | grep -v 'perl ' | grep -v gdbwhere.pl | grep -v mpirun | grep $ARGV[0]`;
}
else
{
# mercury and abe mpi processes are typically in run state R
$mpi_pids=`ps -u $ENV{USER} -o pid,state,cmd | grep ' R '| grep -v grep | grep -v 'ps ' | grep -v 'perl '`;
}
(@mpi_pids)= split /\n/, $mpi_pids;
foreach $rank_pid (@mpi_pids)
{
($rank_pid, $junk)= split /\s\S\s/, $rank_pid;
print "PROCESS ID: $rank_pid\n";
# verbose gdb output
$rank_where=`gdb -pid $rank_pid -batch -x /home/ncsa/consult/debug/gdb.input`;
print $rank_where;
kill CONT, ($rank_pid);
#system "kill -CONT $rank_pid";
}
##############################
-bash-3.1$ cat gdb.input
where
quit
y
-bash-3.1$
|
|
|