This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: debugging gcc/cc1


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]