#!/bin/sh # vim: ft=sh ts=4 sw=4 et #---------------------------------------------------------------------------# # Copyright (C) 2001 The University of Melbourne. # This file may only be copied under the terms of the GNU General # Public License - see the file COPYING in the Mercury distribution. #---------------------------------------------------------------------------# # # Usage: gdbrun # Invokes gdb on , and runs the program with the given . # program="$1" tmpfile=/tmp/gdbrun.$$ trap "rm -f $tmpfile" 0 1 2 3 13 15 shift runargs="" for arg in "$@" do # This quotes spaces properly, which is necessary to handle some of # the arguments created by lmc. We do not quote other special characters # (e.g. #, >, and \) properly. At the moment there is no need to do so, # since lmc does not pass us strings containing such characters # (in the usual case that the workspace name has no such characters). case "$arg" in *" "*) runargs="$runargs \"$arg\"" ;; *) runargs="$runargs $arg" ;; esac done echo "set args $runargs" > "$tmpfile" echo gdb --command="$tmpfile" $program gdb --command="$tmpfile" $program