#!/bin/bash # Copyright 2010,2012 Google Inc. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # Script to launch gdb for crack. in_prog_args=false declare -a gdb_args declare -a prog_args i=0 for arg in "$@"; do if [ "$arg" = '--' ]; then in_prog_args=true elif $in_prog_args; then echo "setting program arg $i to [$arg]" prog_args[$((i++))]="$arg" echo "args are now ${prog_args[*]}" else gdb_args[$((i++))]="$arg" fi done type LIBS=$(dirname $0)/.libs if [ -n "${prog_args[*]}" ]; then echo "set args ${prog_args[*]}" >.crack_dbg.args LD_LIBRARY_PATH=$LIBS gdb $LIBS/crack "${gdb_args[@]}" -x .crack_dbg.args else LD_LIBRARY_PATH=$LIBS gdb $LIBS/crack "${gdb_args[@]}" fi