Files
mercury/tools/gdbrun
Zoltan Somogyi 47a1a02a92 Add vim modelines to most tools.
tools/add_cont_lines:
tools/appears:
tools/assemble:
tools/avg_frame_size:
tools/build_srcdist:
tools/cleanint:
tools/compare_frame_sizes:
tools/configure_mingw_cross:
tools/cont:
tools/ctor_rep_stats:
tools/cur_param:
tools/dd_speedtest:
tools/divide:
tools/extract_dd_stats:
tools/file_name_translation_stats:
tools/frame_sizes:
tools/gdbrun:
tools/half:
tools/info_stats.awk:
tools/linear:
tools/lmc.in:
tools/mai_stats:
tools/make_arena:
tools/next_param:
tools/not:
tools/optstages:
tools/type_ctor_stats:
    Add vim mode lines. Replace tabs with spaces.
2021-04-27 03:54:27 +10:00

35 lines
1.2 KiB
Bash
Executable File

#!/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 <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" ;;
esac
done
echo "set args $runargs" > "$tmpfile"
echo gdb --command="$tmpfile" $program
gdb --command="$tmpfile" $program