public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* How to debug lto1 ICE?
@ 2009-11-03 20:57 Basile STARYNKEVITCH
  2009-11-03 21:12 ` Rafael Espindola
  0 siblings, 1 reply; 3+ messages in thread
From: Basile STARYNKEVITCH @ 2009-11-03 20:57 UTC (permalink / raw)
  To: GCC Mailing List

Hello All

I just encountered a ICE from LTO. I hope I gave enough details in 
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41932

BTW, I am quite scared of the official policy of only preprocessed files 
in bugzilla. I feel it does not match well LTO issues. I tried to make a 
bug report as precise as possible.

Since it is a SIGSEGV ICE, I would have been happy to investigate it 
myself (even if today I don't know anything about LTO).

However, I have no idea of how and what to start under the debugger. 
Running the faulty gcc with gcc -v gives me
% gcc-trunk -v -flto -O2 -shared -o libcamlrun_shared.so interp.pic.o 
misc.pic.o stacks.pic.o fix_code.pic.o startup.pic.o freelist.pic.o 
major_gc.pic.o minor_gc.pic.o memory.pic.o alloc.pic.o roots.pic.o 
globroots.pic.o fail.pic.o signals.pic.o signals_byt.pic.o 
printexc.pic.o backtrace.pic.o compare.pic.o ints.pic.o floats.pic.o 
str.pic.o array.pic.o io.pic.o extern.pic.o intern.pic.o hash.pic.o 
sys.pic.o meta.pic.o parsing.pic.o gc_ctrl.pic.o terminfo.pic.o 
md5.pic.o obj.pic.o lexing.pic.o callback.pic.o debugger.pic.o 
weak.pic.o compact.pic.o finalise.pic.o custom.pic.o dynlink.pic.o 
unix.pic.o main.pic.o -lm  -ldl -lcurses -lpthread
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /usr/src/Lang/gcc-trunk-bstarynk/configure 
--program-suffix=-trunk --libdir=/usr/local/lib/gcc-trunk 
--libexecdir=/usr/local/libexec/gcc-trunk 
--with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ 
--disable-multilib --enable-languages=c,c++ --enable-lto 
--enable-plugins --enable-maintainer-mode : (reconfigured) 
/usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk 
--libdir=/usr/local/lib/gcc-trunk 
--libexecdir=/usr/local/libexec/gcc-trunk 
--with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ 
--disable-multilib --enable-languages=c,c++ --enable-lto 
--enable-plugins --enable-maintainer-mode : (reconfigured) 
/usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk 
--libdir=/usr/local/lib/gcc-trunk 
--libexecdir=/usr/local/libexec/gcc-trunk 
--with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ 
--disable-multilib --enable-lto --enable-plugins 
--enable-maintainer-mode --enable-languages=c,c++,lto --no-create 
--no-recursion : (reconfigured) 
/usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk 
--libdir=/usr/local/lib/gcc-trunk 
--libexecdir=/usr/local/libexec/gcc-trunk 
--with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ 
--disable-multilib --enable-lto --enable-plugins 
--enable-maintainer-mode --enable-languages=c,c++,lto --no-create 
--no-recursion : (reconfigured) 
/usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk 
--libdir=/usr/local/lib/gcc-trunk 
--libexecdir=/usr/local/libexec/gcc-trunk 
--with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ 
--disable-multilib --enable-lto --enable-plugins 
--enable-maintainer-mode --enable-languages=c,c++,lto --no-create 
--no-recursion
Thread model: posix
gcc version 4.5.0 20091103 (experimental) (GCC)
COMPILER_PATH=/usr/local/libexec/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/:/usr/local/libexec/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/:/usr/local/libexec/gcc-trunk/gcc/x86_64-unknown-linux-gnu/:/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/:/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/
LIBRARY_PATH=/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/:/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-flto' '-O2' '-shared' '-o' 
'libcamlrun_shared.so' '-mtune=generic'
 
/usr/local/libexec/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/collect2 
-flto --eh-frame-hdr -m elf_x86_64 -shared -o libcamlrun_shared.so 
/usr/lib/../lib64/crti.o 
/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/crtbeginS.o 
-L/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0 
-L/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../lib64 
-L/lib/../lib64 -L/usr/lib/../lib64 
-L/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/../../.. 
interp.pic.o misc.pic.o stacks.pic.o fix_code.pic.o startup.pic.o 
freelist.pic.o major_gc.pic.o minor_gc.pic.o memory.pic.o alloc.pic.o 
roots.pic.o globroots.pic.o fail.pic.o signals.pic.o signals_byt.pic.o 
printexc.pic.o backtrace.pic.o compare.pic.o ints.pic.o floats.pic.o 
str.pic.o array.pic.o io.pic.o extern.pic.o intern.pic.o hash.pic.o 
sys.pic.o meta.pic.o parsing.pic.o gc_ctrl.pic.o terminfo.pic.o 
md5.pic.o obj.pic.o lexing.pic.o callback.pic.o debugger.pic.o 
weak.pic.o compact.pic.o finalise.pic.o custom.pic.o dynlink.pic.o 
unix.pic.o main.pic.o -lm -ldl -lcurses -lpthread -lgcc --as-needed 
-lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed 
/usr/local/lib/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/crtendS.o 
/usr/lib/../lib64/crtn.o
Using built-in specs.
COLLECT_GCC=/usr/local/bin/gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /usr/src/Lang/gcc-trunk-bstarynk/configure 
--program-suffix=-trunk --libdir=/usr/local/lib/gcc-trunk 
--libexecdir=/usr/local/libexec/gcc-trunk 
--with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ 
--disable-multilib --enable-languages=c,c++ --enable-lto 
--enable-plugins --enable-maintainer-mode : (reconfigured) 
/usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk 
--libdir=/usr/local/lib/gcc-trunk 
--libexecdir=/usr/local/libexec/gcc-trunk 
--with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ 
--disable-multilib --enable-languages=c,c++ --enable-lto 
--enable-plugins --enable-maintainer-mode : (reconfigured) 
/usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk 
--libdir=/usr/local/lib/gcc-trunk 
--libexecdir=/usr/local/libexec/gcc-trunk 
--with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ 
--disable-multilib --enable-lto --enable-plugins 
--enable-maintainer-mode --enable-languages=c,c++,lto --no-create 
--no-recursion : (reconfigured) 
/usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk 
--libdir=/usr/local/lib/gcc-trunk 
--libexecdir=/usr/local/libexec/gcc-trunk 
--with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ 
--disable-multilib --enable-lto --enable-plugins 
--enable-maintainer-mode --enable-languages=c,c++,lto --no-create 
--no-recursion : (reconfigured) 
/usr/src/Lang/gcc-trunk-bstarynk/configure --program-suffix=-trunk 
--libdir=/usr/local/lib/gcc-trunk 
--libexecdir=/usr/local/libexec/gcc-trunk 
--with-gxx-include-dir=/usr/local/lib/gcc-trunk/include/c++/ 
--disable-multilib --enable-lto --enable-plugins 
--enable-maintainer-mode --enable-languages=c,c++,lto --no-create 
--no-recursion
Thread model: posix
gcc version 4.5.0 20091103 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-combine' '-c' '-o' '/tmp/ccKdeyrC.lto.o' '-v' 
'-O2' '-shared' '-mtune=generic'
  /usr/local/libexec/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/lto1 
-quiet -dumpbase interp.pic.o -mtune=generic -auxbase-strip 
/tmp/ccKdeyrC.lto.o -O2 -version @/tmp/ccJMSLwC -o /tmp/ccODq2S4.s
GNU GIMPLE (GCC) version 4.5.0 20091103 (experimental) 
(x86_64-unknown-linux-gnu)
	compiled by GNU C version 4.5.0 20091103 (experimental), GMP version 
4.3.1, MPFR version 2.4.1-p2, MPC version 0.7
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU GIMPLE (GCC) version 4.5.0 20091103 (experimental) 
(x86_64-unknown-linux-gnu)
	compiled by GNU C version 4.5.0 20091103 (experimental), GMP version 
4.3.1, MPFR version 2.4.1-p2, MPC version 0.7
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
gc_ctrl.c:44:16: warning: type of 'caml_major_heap_increment' does not 
match original declaration
major_gc.c:33:8: note: previously declared here
lto1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
lto-wrapper: /usr/local/bin/gcc-trunk returned 1 exit status
collect2: lto-wrapper returned 1 exit status


But with the above details, how can I figure out how to run gdb, ie what 
arguments to give to gdb --args?

I suppose the offending process is probably
/usr/local/libexec/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/lto1 
-quiet -dumpbase interp.pic.o -mtune=generic -auxbase-strip 
/tmp/ccKdeyrC.lto.o -O2 -version @/tmp/ccJMSLwC -o /tmp/ccODq2S4.s

But I am not sure to understand correctly, in particular the 
@/tmp/ccJMSLwC argument puzzles me. Apparently, some program arguments 
are collected in some temporary files....

So how do I run lto1 under GDB, knowing the faulty gcc invocation?

Regards.

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to debug lto1 ICE?
  2009-11-03 20:57 How to debug lto1 ICE? Basile STARYNKEVITCH
@ 2009-11-03 21:12 ` Rafael Espindola
  2009-11-03 21:15   ` Andrew Pinski
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael Espindola @ 2009-11-03 21:12 UTC (permalink / raw)
  To: Basile STARYNKEVITCH; +Cc: GCC Mailing List

> But with the above details, how can I figure out how to run gdb, ie what
> arguments to give to gdb --args?

This is an area that needs some improvement :-(
What I do is pass -Wl,-debug to gcc. That will make collect2 print the
call to ld. Add a -plugin-opt=-debug to it and it should print the
call to lto-wrapper.

> I suppose the offending process is probably
> /usr/local/libexec/gcc-trunk/gcc/x86_64-unknown-linux-gnu/4.5.0/lto1 -quiet
> -dumpbase interp.pic.o -mtune=generic -auxbase-strip /tmp/ccKdeyrC.lto.o -O2
> -version @/tmp/ccJMSLwC -o /tmp/ccODq2S4.s
>
> But I am not sure to understand correctly, in particular the @/tmp/ccJMSLwC
> argument puzzles me. Apparently, some program arguments are collected in
> some temporary files....

That is correct. This is to avoid command lines that are too large. We
currently delete those files during the plugin cleanup. I will send a
patch disabling cleanup if -debug is given.

> So how do I run lto1 under GDB, knowing the faulty gcc invocation?

Given the lto-wrapper line above, add -debug to it and it will print
the lto1 invocation.

> Regards.
>


Cheers,
-- 
Rafael Ávila de Espíndola

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to debug lto1 ICE?
  2009-11-03 21:12 ` Rafael Espindola
@ 2009-11-03 21:15   ` Andrew Pinski
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Pinski @ 2009-11-03 21:15 UTC (permalink / raw)
  To: Rafael Espindola; +Cc: Basile STARYNKEVITCH, GCC Mailing List

On Tue, Nov 3, 2009 at 1:12 PM, Rafael Espindola <espindola@google.com> wrote:
> That is correct. This is to avoid command lines that are too large. We
> currently delete those files during the plugin cleanup. I will send a
> patch disabling cleanup if -debug is given.

-save-temps will also keep the files around which is what I use to be
able to debug lto1.

Thanks,
Andrew Pinski

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-03 21:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-03 20:57 How to debug lto1 ICE? Basile STARYNKEVITCH
2009-11-03 21:12 ` Rafael Espindola
2009-11-03 21:15   ` Andrew Pinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).