From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32754 invoked by alias); 18 Nov 2001 19:45:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 32511 invoked from network); 18 Nov 2001 19:45:52 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sourceware.cygnus.com with SMTP; 18 Nov 2001 19:45:52 -0000 Received: from fri.redhat.lsd.ic.unicamp.br (cse.cygnus.com [205.180.230.236]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id LAA29407; Sun, 18 Nov 2001 11:45:46 -0800 (PST) Received: from free.redhat.lsd.ic.unicamp.br (free.redhat.lsd.ic.unicamp.br [192.168.160.1]) by fri.redhat.lsd.ic.unicamp.br (8.11.6/8.11.6) with ESMTP id fAIJjiD21576; Sun, 18 Nov 2001 17:45:44 -0200 Received: (from aoliva@localhost) by free.redhat.lsd.ic.unicamp.br (8.11.6/8.11.6) id fAIJjhi03680; Sun, 18 Nov 2001 17:45:43 -0200 X-Authentication-Warning: free.redhat.lsd.ic.unicamp.br: aoliva set sender to aoliva@redhat.com using -f To: tromey@redhat.com Cc: Zack Weinberg , Ira Ruben , Robert Lipe , Graham Stott , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Add -### option References: <3BDDD87E.584226E8@redhat.com> <20011029172933.B852@rjlhome.caldera.com> <20011029163342.A17908@codesourcery.com> <87y9lt6a7d.fsf@creche.redhat.com> From: Alexandre Oliva Organization: GCC Team, Red Hat Date: Tue, 13 Nov 2001 15:03:00 -0000 In-Reply-To: Tom Tromey's message of "29 Oct 2001 21:08:54 -0700" Message-ID: User-Agent: Gnus/5.0805 (Gnus v5.8.5) Emacs/20.7 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SW-Source: 2001-11/txt/msg00506.txt.bz2 --=-=-= Content-length: 871 On Oct 30, 2001, Tom Tromey wrote: >>>>>> "Zack" == Zack Weinberg writes: Zack> As a vaguely related thing: I was contemplating, not so long Zack> ago, a mode for the driver where it would run gdb on cc1 for Zack> you. I got stuck because as far as I know there is no way to Zack> set the debuggee's command line arguments from gdb's command Zack> line. Your script sounds like it solves this - how? > I've long wanted the same thing. I've written a patch to gdb which > lets you set the inferior's command-line arguments from the gdb > command line: > gdb --args cc1 -ffoo -fbar ... > This patch is still in progress. I need to rewrite it before the gdb > maintainers will accept it. Meanwhile, this is what I use. Unfortunately, it's not whitespace- or shell-quoting-safe, but it has been of great help to me. --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=debug Content-length: 1653 #! /bin/sh # Copyright 1999, 2000, 2001 Free Software Foundation # This script is Free Software, and it can be copied, distributed and # modified as defined in the GNU General Public License. A copy of # its license can be downloaded from http://www.gnu.org/copyleft/gpl.html # by Alexandre Oliva if test $# -lt 1; then echo usage: env DEBUG="" $0 "" args... >&2 exit 1 fi : ${DEBUG=emacs} prog="$1"; shift 1 gdbinitdir=/tmp/.gdbinit.$$ gdbinit=$gdbinitdir/init mkdir $gdbinitdir || { echo directory $gdbinitdir already exists >&2; exit 1; } { echo "shell rm -rf /tmp/.gdbinit.$$" echo "cd `pwd`" echo "set args $*" } >$gdbinit case `$DEBUG --version /dev/null` in "GDB"*|"GNU gdb"*) # start command-line gdb within the correct working directory, # and set up the specified argument list exec $DEBUG -command $gdbinit $prog;; "DDD"*) # start DDD/gdb within the correct working directory, # and set up the specified argument list exec $DEBUG --debugger "${GDB-gdb} -command $gdbinit" $prog;; "GNU Emacs"*) # start gdb within GNU Emacs, move into the current working # directory and set up the specified argument list exec $DEBUG -eval "(progn (gdb \"${GDB-gdb} $prog\") (gud-call \"source $gdbinit\"))";; XEmacs*) # start gdb within XEmacs, move into the current working # directory and set up the specified argument list exec $DEBUG -eval "(progn ${GDB+(setq gdb-command-name \"$GDB\")} (gdb \"$prog\") (gdb-call \"source $gdbinit\"))";; *) echo you must set DEBUG to either emacs or gdb >&2;; esac rm -rf /tmp/.gdbinit.$$ exit 1 --=-=-= Content-length: 290 -- Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/ Red Hat GCC Developer aoliva@{cygnus.com, redhat.com} CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org} Free Software Evangelist *Please* write to mailing lists, not to me --=-=-=--