This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: debugging gcc/cc1
- From: Janis Johnson <janis187 at us dot ibm dot com>
- To: Johnny Huynh <huynh at ugrad dot cs dot ualberta dot ca>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 26 May 2004 14:21:02 -0700
- Subject: Re: debugging gcc/cc1
- References: <Pine.LNX.4.56.0405261421500.20553@csu510.cs.ualberta.ca>
On Wed, May 26, 2004 at 02:29:03PM -0600, Johnny Huynh wrote:
>
> I've tried using the output provided by "gcc -v -save-temps ..." and then
> invoke cc1 from inside gdb, but thats not immediately working, and its
> a pain to have to copy and paste huge chunks of text everytime I want to
> trace my new changes.
I add -v to the gcc line and redirect stderr to a file called gdb.in, then
edit that file to:
remove all lines before cc1 and all lines after that
remove -v and -verbose from that line
split the line before cc1 and its arguments
add "# gdb" before the cc1 pathname
add "run " before the arguments
add breakpoints between those lines (unless I want it to run until it
dies)
Then I run this script:
#! /bin/sh
SCR=gdb.in
test "$1" != "" && SCR=$1
eval `head -1 $SCR | sed 's/# //'`
and at the gdb prompt enter "source gdb.in".
The whole think is very quick after you've done it a couple of times,
and you can add new breakpoints or other commands to gdb.in as you go.
Janis