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 Wednesday, May 26, 2004, at 01:29 PM, Johnny Huynh wrote:
This must have been asked before, but my google and mailing list searches
havent gotten me anything too useful...

http://gcc.gnu.org/ml/gcc/2000-09/msg00705.html


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 then
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:


run

that's one word, no pasting. If you have a program that needs input, you do

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.


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