# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-# gcore.sh
# Script to generate a core file of a running program.
# It starts up gdb, attaches to the given PID and invokes the gcore command.
#
if [ "$#" -eq "0" ]
then
- echo "usage: gcore [-o filename] pid"
+ echo "usage: @GCORE_TRANSFORM_NAME@ [-o filename] pid"
exit 2
fi
if [ "$#" -lt "3" ]
then
# Not enough arguments.
- echo "usage: gcore [-o filename] pid"
+ echo "usage: @GCORE_TRANSFORM_NAME@ [-o filename] pid"
exit 2
fi
name=$2
do
# `</dev/null' to avoid touching interactive terminal if it is
# available but not accessible as GDB would get stopped on SIGTTIN.
- gdb </dev/null --nx --batch \
+ @GDB_TRANSFORM_NAME@ </dev/null --nx --batch \
-ex "set pagination off" -ex "set height 0" -ex "set width 0" \
-ex "attach $pid" -ex "gcore $name.$pid" -ex detach -ex quit
if [ -r $name.$pid ] ; then
rc=0
else
- echo gcore: failed to create $name.$pid
+ echo "@GCORE_TRANSFORM_NAME@: failed to create $name.$pid"
rc=1
break
fi