#!/bin/sh

export MCMINI_ROOT=@PWD@
if test ! -e $MCMINI_ROOT/mcmini; then
  echo "$MCMINI_ROOT/mcmini not found"
  echo "Was 'make' run during McMini install?"
  echo ""
  exit 1
fi
if test "$1" = ""; then
  echo "USAGE:  $0 [OPTIONS] TARGET_FILE"
  $MCMINI_ROOT/mcmini
  exit 1
fi

# We need to quote arguments, since '-t <traceSeq>' has spaces.
newargs=""
while [ "$1" != "" ]; do
  newargs="$newargs '$1'"
  shift
done

export MCMINI_ARGS="$newargs"

eval gdb --silent -x $MCMINI_ROOT/gdbinit.mcmini --args $MCMINI_ROOT/mcmini $newargs
