summaryrefslogtreecommitdiffstats
path: root/contrib/openpam/pamgdb.in
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/openpam/pamgdb.in')
-rw-r--r--contrib/openpam/pamgdb.in41
1 files changed, 41 insertions, 0 deletions
diff --git a/contrib/openpam/pamgdb.in b/contrib/openpam/pamgdb.in
new file mode 100644
index 0000000..2ec2d65
--- /dev/null
+++ b/contrib/openpam/pamgdb.in
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# $Id: pamgdb.in 583 2012-04-07 18:56:13Z des $
+#
+
+srcdir="@abs_top_srcdir@"
+builddir="@abs_top_builddir@"
+
+# Make sure we get the right version of libpam
+pam_libdir="${builddir}/lib/.libs"
+LD_LIBRARY_PATH="${pam_libdir}:${LD_LIBRARY_PATH}"
+LD_LIBRARY_PATH="${LD_LIBRARY_PATH%:}"
+export LD_LIBRARY_PATH
+
+# DWIM, assuming that the first positional argument is the name of the
+# program to debug rather than a gdb option.
+prog="$1"
+if expr "${prog}" : ".*/.*" >/dev/null ; then
+ # The first argument is an absolute or relative path. There
+ # is a good chance that it points to the wrapper script
+ # generated by libtool rather than the actual binary.
+ altprog="${prog%/*}/.libs/${prog##*/}"
+ if [ -x "${altprog}" ] ; then
+ shift
+ set "${altprog}" "$@"
+ fi
+elif expr "${prog}" : "[a-z.-][a-z.-]*" >/dev/null ; then
+ # The first argument is just the name of the program. Look for
+ # it in the build directory.
+ for libdir in $(find "${builddir}" -type d -name .libs -print) ; do
+ altprog="${libdir}/${prog}"
+ if [ -x "${altprog}" ] ; then
+ shift
+ set "${altprog}" "$@"
+ break
+ fi
+ done
+fi
+
+# Let's go!
+exec gdb "$@"
OpenPOWER on IntegriCloud