This is the mail archive of the
mailing list for the GCC project.
Re: debugging gcc/cc1
- From: Mike Stump <mrs at apple 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 13:59:52 -0700
- Subject: Re: debugging gcc/cc1
On Wednesday, May 26, 2004, at 01:29 PM, Johnny Huynh wrote:
This must have been asked before, but my google and mailing list
havent gotten me anything too useful...
I have written an extra pass that is causes a seg fault in my gcc
cross-compiler, but no core file is generated (presumably from the sig
handler) and I don't know how to attach gdb to my cross-compiler.
gcc -v t.c -c
gcc -E t.c >t.i
and the mostly likely command under gdb:
run -quiet t.i
Some platforms might have flags you might have to add, -fPIC and the
testcase might be dependent upon optimization (-O2), but 90% of
testcases run this simply.
I've tried using the output provided by "gcc -v -save-temps ..." and
invoke cc1 from inside gdb, but thats not immediately working
Then you probably did it wrong. Run with -v again, and see what other
flags are being passed to cc1, and pass more of them until you find the
one you need.
and its a pain to have to copy and paste huge chunks of text everytime
I want to
trace my new changes.
? You're doing something wrong. 90% of the time, in gdb, you just say:
that's one word, no pasting. If you have a program that needs input,
run ... <file
to test, and just run thereafter, again, one word.
tips on how to disable the sig handler (to get a core file) or trace my
new changes (preferred) would be appreciated.
On my platform, I see:
$ gcc -c -v t.cc
Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
Thread model: posix
gcc version 3.3 20030304 (Apple Computer, Inc. build 1490)
/usr/libexec/gcc/darwin/ppc/3.3/cc1plus -quiet -v -D__GNUC__=3
-D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 -D__APPLE_CC__=1490
-D__DYNAMIC__ t.cc -D__GNUG__=3 -fPIC -quiet -dumpbase t.cc -auxbase t
-version -D__private_extern__=extern -o /var/tmp//cccKpmT6.s
technically, I might need to pass all of these, 98% of the time, -fPIC
-quiet and the filename is enough.