1183724Ssos#!/bin/sh 2230132Suqs# 3183724Ssos# $Id: pamgdb.in 816 2014-09-12 07:50:22Z des $ 4183724Ssos# 5183724Ssos 6183724Ssossrcdir="@abs_top_srcdir@" 7183724Ssosbuilddir="@abs_top_builddir@" 8183724Ssos 9183724Ssos# Make sure we get the right version of libpam 10183724Ssospam_libdir="${builddir}/lib/.libs" 11183724SsosLD_LIBRARY_PATH="${pam_libdir}:${LD_LIBRARY_PATH}" 12183724SsosLD_LIBRARY_PATH="${LD_LIBRARY_PATH%:}" 13183724Ssosexport LD_LIBRARY_PATH 14183724Ssos 15183724Ssos# DWIM, assuming that the first positional argument is the name of the 16183724Ssos# program to debug rather than a gdb option. 17183724Ssosprog="$1" 18183724Ssosif expr "${prog}" : ".*/.*" >/dev/null ; then 19183724Ssos # The first argument is an absolute or relative path. There 20183724Ssos # is a good chance that it points to the wrapper script 21183724Ssos # generated by libtool rather than the actual binary. 22183724Ssos altprog="${prog%/*}/.libs/${prog##*/}" 23183724Ssos if [ -x "${altprog}" ] ; then 24183724Ssos shift 25183724Ssos set "${altprog}" "$@" 26183724Ssos fi 27183724Ssoselif expr "${prog}" : "[a-z.-][a-z.-]*" >/dev/null ; then 28183724Ssos # The first argument is just the name of the program. Look for 29183724Ssos # it in the build directory. 30183724Ssos for libdir in $(find "${builddir}" -type d -name .libs -print) ; do 31183724Ssos altprog="${libdir}/${prog}" 32183724Ssos if [ -x "${altprog}" ] ; then 33183724Ssos shift 34183724Ssos set "${altprog}" "$@" 35183724Ssos break 36183724Ssos fi 37183724Ssos done 38183724Ssosfi 39183724Ssos 40183724Ssos# Let's go! 41183724Ssosexec gdb "$@" 42183724Ssos