public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Debugging ICE in GCC
@ 2020-05-29 23:55 Manfred Schwarb
  2020-05-30  2:01 ` Dan Kegel
  2020-05-30  7:39 ` Jonathan Wakely
  0 siblings, 2 replies; 7+ messages in thread
From: Manfred Schwarb @ 2020-05-29 23:55 UTC (permalink / raw)
  To: gcc-help

Hi,
I tried to debug fortran.dg/pr95090.f90, which showed

f951: internal compiler error: Segmentation fault
0x83cfe3c ???
        ../sysdeps/i386/start.S:117
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


Using GDB (8.3.1), I got
#> f951="`$instdir/bin/gcc -print-prog-name=f951`"
#> gdb -ex run -ex bt --batch --args $f951 fortran.dg/pr95090.f90

Program received signal SIGSEGV, Segmentation fault.
0xf7aa5162 in __strlen_sse2_bsf () from /lib/libc.so.6
#0  0xf7aa5162 in __strlen_sse2_bsf () from /lib/libc.so.6
#1  0x083e7c3f in get_unique_hashed_string(char*, gfc_symbol*) ()
#2  0x083e85a4 in gfc_find_derived_vtab(gfc_symbol*) ()
#3  0x0847fde1 in resolve_fl_derived(gfc_symbol*) ()
#4  0x0847c717 in resolve_symbol(gfc_symbol*) ()
#5  0x084a78d0 in do_traverse_symtree(gfc_symtree*, void (*)(gfc_symtree*), void (*)(gfc_symbol*)) ()
#6  0x08487f77 in resolve_types(gfc_namespace*) ()
#7  0x0847b6e5 in gfc_resolve(gfc_namespace*) ()
#8  0x0846e9f6 in gfc_parse_file() ()
#9  0x084bebe7 in gfc_be_parse_file() ()
#10 0x08a3b59e in compile_file() ()
#11 0x083c98a5 in toplev::main(int, char**) ()
#12 0x083cd9b1 in main ()


So far so good, but there are no file locations shown, and I can't
switch frames and list code in GDB.
This although I built GCC with debug information and binaries are not stripped.

I built GCC with
#> ../configure --enable-checking=yes,extra i686-linux
#> make BOOT_CFLAGS="-O2 -ggdb" bootstrap2-lean

In desperation, I even tried
#> make BOOT_CFLAGS="-O2 -fanalyzer" bootstrap2-lean
and
#> make BOOT_CFLAGS="-O2 -fsanitize=address" bootstrap2-lean
but both compilation attempts failed.


Are there any magic knobs to make GDB output more useful?

Thanks,
Manfred


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

* Re: Debugging ICE in GCC
  2020-05-29 23:55 Debugging ICE in GCC Manfred Schwarb
@ 2020-05-30  2:01 ` Dan Kegel
       [not found]   ` <77248fa9-0729-28a1-ea61-1ed2005f9b66@gmx.ch>
  2020-05-30  7:39 ` Jonathan Wakely
  1 sibling, 1 reply; 7+ messages in thread
From: Dan Kegel @ 2020-05-30  2:01 UTC (permalink / raw)
  To: Manfred Schwarb; +Cc: gcc-help

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95090 looks sorted, did you
figure out your gdb question?

On Fri, May 29, 2020, 16:55 Manfred Schwarb <manfred99@gmx.ch> wrote:

> Hi,
> I tried to debug fortran.dg/pr95090.f90, which showed
>
> f951: internal compiler error: Segmentation fault
> 0x83cfe3c ???
>         ../sysdeps/i386/start.S:117
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <https://gcc.gnu.org/bugs/> for instructions.
>
>
> Using GDB (8.3.1), I got
> #> f951="`$instdir/bin/gcc -print-prog-name=f951`"
> #> gdb -ex run -ex bt --batch --args $f951 fortran.dg/pr95090.f90
>
> Program received signal SIGSEGV, Segmentation fault.
> 0xf7aa5162 in __strlen_sse2_bsf () from /lib/libc.so.6
> #0  0xf7aa5162 in __strlen_sse2_bsf () from /lib/libc.so.6
> #1  0x083e7c3f in get_unique_hashed_string(char*, gfc_symbol*) ()
> #2  0x083e85a4 in gfc_find_derived_vtab(gfc_symbol*) ()
> #3  0x0847fde1 in resolve_fl_derived(gfc_symbol*) ()
> #4  0x0847c717 in resolve_symbol(gfc_symbol*) ()
> #5  0x084a78d0 in do_traverse_symtree(gfc_symtree*, void
> (*)(gfc_symtree*), void (*)(gfc_symbol*)) ()
> #6  0x08487f77 in resolve_types(gfc_namespace*) ()
> #7  0x0847b6e5 in gfc_resolve(gfc_namespace*) ()
> #8  0x0846e9f6 in gfc_parse_file() ()
> #9  0x084bebe7 in gfc_be_parse_file() ()
> #10 0x08a3b59e in compile_file() ()
> #11 0x083c98a5 in toplev::main(int, char**) ()
> #12 0x083cd9b1 in main ()
>
>
> So far so good, but there are no file locations shown, and I can't
> switch frames and list code in GDB.
> This although I built GCC with debug information and binaries are not
> stripped.
>
> I built GCC with
> #> ../configure --enable-checking=yes,extra i686-linux
> #> make BOOT_CFLAGS="-O2 -ggdb" bootstrap2-lean
>
> In desperation, I even tried
> #> make BOOT_CFLAGS="-O2 -fanalyzer" bootstrap2-lean
> and
> #> make BOOT_CFLAGS="-O2 -fsanitize=address" bootstrap2-lean
> but both compilation attempts failed.
>
>
> Are there any magic knobs to make GDB output more useful?
>
> Thanks,
> Manfred
>
>
>

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

* Re: Debugging ICE in GCC
  2020-05-29 23:55 Debugging ICE in GCC Manfred Schwarb
  2020-05-30  2:01 ` Dan Kegel
@ 2020-05-30  7:39 ` Jonathan Wakely
  2020-05-30 23:46   ` Manfred Schwarb
  1 sibling, 1 reply; 7+ messages in thread
From: Jonathan Wakely @ 2020-05-30  7:39 UTC (permalink / raw)
  To: Manfred Schwarb; +Cc: gcc-help

On Sat, 30 May 2020 at 02:01, Manfred Schwarb <manfred99@gmx.ch> wrote:
>
> Hi,
> I tried to debug fortran.dg/pr95090.f90, which showed
>
> f951: internal compiler error: Segmentation fault
> 0x83cfe3c ???
>         ../sysdeps/i386/start.S:117
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <https://gcc.gnu.org/bugs/> for instructions.
>
>
> Using GDB (8.3.1), I got
> #> f951="`$instdir/bin/gcc -print-prog-name=f951`"
> #> gdb -ex run -ex bt --batch --args $f951 fortran.dg/pr95090.f90
>
> Program received signal SIGSEGV, Segmentation fault.
> 0xf7aa5162 in __strlen_sse2_bsf () from /lib/libc.so.6
> #0  0xf7aa5162 in __strlen_sse2_bsf () from /lib/libc.so.6
> #1  0x083e7c3f in get_unique_hashed_string(char*, gfc_symbol*) ()
> #2  0x083e85a4 in gfc_find_derived_vtab(gfc_symbol*) ()
> #3  0x0847fde1 in resolve_fl_derived(gfc_symbol*) ()
> #4  0x0847c717 in resolve_symbol(gfc_symbol*) ()
> #5  0x084a78d0 in do_traverse_symtree(gfc_symtree*, void (*)(gfc_symtree*), void (*)(gfc_symbol*)) ()
> #6  0x08487f77 in resolve_types(gfc_namespace*) ()
> #7  0x0847b6e5 in gfc_resolve(gfc_namespace*) ()
> #8  0x0846e9f6 in gfc_parse_file() ()
> #9  0x084bebe7 in gfc_be_parse_file() ()
> #10 0x08a3b59e in compile_file() ()
> #11 0x083c98a5 in toplev::main(int, char**) ()
> #12 0x083cd9b1 in main ()
>
>
> So far so good, but there are no file locations shown, and I can't
> switch frames and list code in GDB.
> This although I built GCC with debug information and binaries are not stripped.
>
> I built GCC with
> #> ../configure --enable-checking=yes,extra i686-linux
> #> make BOOT_CFLAGS="-O2 -ggdb" bootstrap2-lean
>
> In desperation, I even tried
> #> make BOOT_CFLAGS="-O2 -fanalyzer" bootstrap2-lean
> and
> #> make BOOT_CFLAGS="-O2 -fsanitize=address" bootstrap2-lean
> but both compilation attempts failed.
>
>
> Are there any magic knobs to make GDB output more useful?

There's a whole wiki page about that:
https://gcc.gnu.org/wiki/DebuggingGCC

You probably don't want to use -O2

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

* Re: Debugging ICE in GCC
  2020-05-30  7:39 ` Jonathan Wakely
@ 2020-05-30 23:46   ` Manfred Schwarb
  2020-05-31 13:45     ` Manfred Schwarb
  0 siblings, 1 reply; 7+ messages in thread
From: Manfred Schwarb @ 2020-05-30 23:46 UTC (permalink / raw)
  To: Jonathan Wakely, gcc-help

Am 30.05.20 um 09:39 schrieb Jonathan Wakely:
> On Sat, 30 May 2020 at 02:01, Manfred Schwarb <manfred99@gmx.ch> wrote:
>>
>> Hi,
>> I tried to debug fortran.dg/pr95090.f90, which showed
>>
>> f951: internal compiler error: Segmentation fault
>> 0x83cfe3c ???
>>         ../sysdeps/i386/start.S:117
>> Please submit a full bug report,
>> with preprocessed source if appropriate.
>> Please include the complete backtrace with any bug report.
>> See <https://gcc.gnu.org/bugs/> for instructions.
>>
>>
>> Using GDB (8.3.1), I got
>> #> f951="`$instdir/bin/gcc -print-prog-name=f951`"
>> #> gdb -ex run -ex bt --batch --args $f951 fortran.dg/pr95090.f90
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0xf7aa5162 in __strlen_sse2_bsf () from /lib/libc.so.6
>> #0  0xf7aa5162 in __strlen_sse2_bsf () from /lib/libc.so.6
>> #1  0x083e7c3f in get_unique_hashed_string(char*, gfc_symbol*) ()
>> #2  0x083e85a4 in gfc_find_derived_vtab(gfc_symbol*) ()
>> #3  0x0847fde1 in resolve_fl_derived(gfc_symbol*) ()
>> #4  0x0847c717 in resolve_symbol(gfc_symbol*) ()
>> #5  0x084a78d0 in do_traverse_symtree(gfc_symtree*, void (*)(gfc_symtree*), void (*)(gfc_symbol*)) ()
>> #6  0x08487f77 in resolve_types(gfc_namespace*) ()
>> #7  0x0847b6e5 in gfc_resolve(gfc_namespace*) ()
>> #8  0x0846e9f6 in gfc_parse_file() ()
>> #9  0x084bebe7 in gfc_be_parse_file() ()
>> #10 0x08a3b59e in compile_file() ()
>> #11 0x083c98a5 in toplev::main(int, char**) ()
>> #12 0x083cd9b1 in main ()
>>
>>
>> So far so good, but there are no file locations shown, and I can't
>> switch frames and list code in GDB.
>> This although I built GCC with debug information and binaries are not stripped.
>>
>> I built GCC with
>> #> ../configure --enable-checking=yes,extra i686-linux
>> #> make BOOT_CFLAGS="-O2 -ggdb" bootstrap2-lean
>>
>> In desperation, I even tried
>> #> make BOOT_CFLAGS="-O2 -fanalyzer" bootstrap2-lean
>> and
>> #> make BOOT_CFLAGS="-O2 -fsanitize=address" bootstrap2-lean
>> but both compilation attempts failed.
>>
>>
>> Are there any magic knobs to make GDB output more useful?
>
> There's a whole wiki page about that:
> https://gcc.gnu.org/wiki/DebuggingGCC
>

Thanks a lot for the pointer.
I didn't know about "--enable-valgrind-annotations" and "setarch -R".
But this does not help me getting gdb working.
As mentioned, gdb does not let me change frames or list code, unfortunately.

BOOT_CFLAGS="-O2 -fsanitize=address" would be really handy, it seems to me...


> You probably don't want to use -O2
>


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

* Re: Debugging ICE in GCC
       [not found]   ` <77248fa9-0729-28a1-ea61-1ed2005f9b66@gmx.ch>
@ 2020-05-30 23:48     ` Manfred Schwarb
  0 siblings, 0 replies; 7+ messages in thread
From: Manfred Schwarb @ 2020-05-30 23:48 UTC (permalink / raw)
  To: gcc-help

Bah, I hit the wrong button, answer went only to Dan.

Am 31.05.20 um 01:45 schrieb Manfred Schwarb:
> Am 30.05.20 um 04:01 schrieb Dan Kegel:
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95090 looks sorted, did you
>> figure out your gdb question?
>>
>
> Bug is sorted now, but debugging with printf's is a bit tedious ...
> So no, gdb question is not resolved. The issue is, I can't change frames
> or list code in GDB somehow.
>
>
>> On Fri, May 29, 2020, 16:55 Manfred Schwarb <manfred99@gmx.ch> wrote:
>>
>>> Hi,
>>> I tried to debug fortran.dg/pr95090.f90, which showed
>>>
>>> f951: internal compiler error: Segmentation fault
>>> 0x83cfe3c ???
>>>         ../sysdeps/i386/start.S:117
>>> Please submit a full bug report,
>>> with preprocessed source if appropriate.
>>> Please include the complete backtrace with any bug report.
>>> See <https://gcc.gnu.org/bugs/> for instructions.
>>>
>>>
>>> Using GDB (8.3.1), I got
>>> #> f951="`$instdir/bin/gcc -print-prog-name=f951`"
>>> #> gdb -ex run -ex bt --batch --args $f951 fortran.dg/pr95090.f90
>>>
>>> Program received signal SIGSEGV, Segmentation fault.
>>> 0xf7aa5162 in __strlen_sse2_bsf () from /lib/libc.so.6
>>> #0  0xf7aa5162 in __strlen_sse2_bsf () from /lib/libc.so.6
>>> #1  0x083e7c3f in get_unique_hashed_string(char*, gfc_symbol*) ()
>>> #2  0x083e85a4 in gfc_find_derived_vtab(gfc_symbol*) ()
>>> #3  0x0847fde1 in resolve_fl_derived(gfc_symbol*) ()
>>> #4  0x0847c717 in resolve_symbol(gfc_symbol*) ()
>>> #5  0x084a78d0 in do_traverse_symtree(gfc_symtree*, void
>>> (*)(gfc_symtree*), void (*)(gfc_symbol*)) ()
>>> #6  0x08487f77 in resolve_types(gfc_namespace*) ()
>>> #7  0x0847b6e5 in gfc_resolve(gfc_namespace*) ()
>>> #8  0x0846e9f6 in gfc_parse_file() ()
>>> #9  0x084bebe7 in gfc_be_parse_file() ()
>>> #10 0x08a3b59e in compile_file() ()
>>> #11 0x083c98a5 in toplev::main(int, char**) ()
>>> #12 0x083cd9b1 in main ()
>>>
>>>
>>> So far so good, but there are no file locations shown, and I can't
>>> switch frames and list code in GDB.
>>> This although I built GCC with debug information and binaries are not
>>> stripped.
>>>
>>> I built GCC with
>>> #> ../configure --enable-checking=yes,extra i686-linux
>>> #> make BOOT_CFLAGS="-O2 -ggdb" bootstrap2-lean
>>>
>>> In desperation, I even tried
>>> #> make BOOT_CFLAGS="-O2 -fanalyzer" bootstrap2-lean
>>> and
>>> #> make BOOT_CFLAGS="-O2 -fsanitize=address" bootstrap2-lean
>>> but both compilation attempts failed.
>>>
>>>
>>> Are there any magic knobs to make GDB output more useful?
>>>
>>> Thanks,
>>> Manfred
>>>
>>>
>>>
>>
>


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

* Re: Debugging ICE in GCC
  2020-05-30 23:46   ` Manfred Schwarb
@ 2020-05-31 13:45     ` Manfred Schwarb
  2020-05-31 20:30       ` Jonathan Wakely
  0 siblings, 1 reply; 7+ messages in thread
From: Manfred Schwarb @ 2020-05-31 13:45 UTC (permalink / raw)
  To: Jonathan Wakely, gcc-help

Am 31.05.20 um 01:46 schrieb Manfred Schwarb:
> Am 30.05.20 um 09:39 schrieb Jonathan Wakely:
>> On Sat, 30 May 2020 at 02:01, Manfred Schwarb <manfred99@gmx.ch> wrote:

>>>
>>> I built GCC with
>>> #> ../configure --enable-checking=yes,extra i686-linux
>>> #> make BOOT_CFLAGS="-O2 -ggdb" bootstrap2-lean
>>>

OK, I found it. I was perhaps a bit too clever: while "bootstrap2"
really speeds up things a lot, it seems to hamper debugability.
So if I bootstrap with "bootstrap", my backtraces show up as they should.


BTW: is bootstrapping with BOOT_CFLAGS="-Og -g" meant to work?
With "-Og" I get multiple errors of the category "-Werror=maybe-uninitialized"
and "-Werror=format-whatever" and bootstrap fails.

I can bootstrap with "-O0" and "-O2" though.

Cheers,
Manfred

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

* Re: Debugging ICE in GCC
  2020-05-31 13:45     ` Manfred Schwarb
@ 2020-05-31 20:30       ` Jonathan Wakely
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Wakely @ 2020-05-31 20:30 UTC (permalink / raw)
  To: Manfred Schwarb; +Cc: gcc-help

On Sun, 31 May 2020 at 14:45, Manfred Schwarb <manfred99@gmx.ch> wrote:
>
> Am 31.05.20 um 01:46 schrieb Manfred Schwarb:
> > Am 30.05.20 um 09:39 schrieb Jonathan Wakely:
> >> On Sat, 30 May 2020 at 02:01, Manfred Schwarb <manfred99@gmx.ch> wrote:
>
> >>>
> >>> I built GCC with
> >>> #> ../configure --enable-checking=yes,extra i686-linux
> >>> #> make BOOT_CFLAGS="-O2 -ggdb" bootstrap2-lean
> >>>
>
> OK, I found it. I was perhaps a bit too clever: while "bootstrap2"
> really speeds up things a lot, it seems to hamper debugability.
> So if I bootstrap with "bootstrap", my backtraces show up as they should.

You can just do "make" and not ask for any bootstrap targets. The
default is a normal bootstrap, which would have worked fine.

> BTW: is bootstrapping with BOOT_CFLAGS="-Og -g" meant to work?

Yes.

> With "-Og" I get multiple errors of the category "-Werror=maybe-uninitialized"
> and "-Werror=format-whatever" and bootstrap fails.

--disable-werror

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

end of thread, other threads:[~2020-05-31 20:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29 23:55 Debugging ICE in GCC Manfred Schwarb
2020-05-30  2:01 ` Dan Kegel
     [not found]   ` <77248fa9-0729-28a1-ea61-1ed2005f9b66@gmx.ch>
2020-05-30 23:48     ` Manfred Schwarb
2020-05-30  7:39 ` Jonathan Wakely
2020-05-30 23:46   ` Manfred Schwarb
2020-05-31 13:45     ` Manfred Schwarb
2020-05-31 20:30       ` Jonathan Wakely

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).