[m-rev.] for review: gdbrun bug fix

Zoltan Somogyi zs at cs.mu.OZ.AU
Fri Apr 27 13:53:29 AEST 2001


On 26-Apr-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> The quoting is still not 100% correct, though.
> To do it properly you'd have to also quote stuff containing "#"
> or ">" and escape stuff containing "$" or "\" and maybe more.

However, there is no need to quote stuff that lmc never passes to gdb.
Here is the version I intend to commit; it has the other changes you suggested.

Zoltan.

#!/bin/sh
#---------------------------------------------------------------------------#
# 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 <program> <arguments>
# Invokes gdb on <program>, and runs the program with the given <arguments>.
#
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" ;;
done
echo "run$runargs" > "$tmpfile"

echo gdb --command="$tmpfile" $program
gdb --command="$tmpfile" $program
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list