Bug 50664 - GDB rebuilt by i686-w64-mingw32-gcc4.6.2's "-Os" crashed when debugging, but "-O2" is OK.
Summary: GDB rebuilt by i686-w64-mingw32-gcc4.6.2's "-Os" crashed when debugging, but ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 4.6.2
: P3 critical
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-08 14:33 UTC by xunxun
Modified: 2011-10-20 06:39 UTC (History)
0 users

See Also:
Host: *-mingw32
Target: *-mingw32
Build:
Known to work: 4.6.1
Known to fail: 4.6.2
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description xunxun 2011-10-08 14:33:23 UTC
I don't know which section this issue can be reported in.

I rebuilt the latest gcc4.6 branch on Win7 and I found a weird probem.
When I use the editon to build gdb with "-Os", it won't list source code, and if you input list twice, gdb will crash.

The debug log:
--------------------------------------------------------------
GNU gdb (GDB) 7.3.1.20110921-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-w64-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from E:\MyPack\MinGW\bin/gdb-1.exe...done.
(gdb) run
Starting program: E:\MyPack\MinGW\bin/gdb-1.exe
[New Thread 2212.0x1ba8]
GNU gdb (pcx32) 7.3.1
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-w64-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) file a.exe
Reading symbols from e:\t\temp\a.exe...done.
(gdb) l
(gdb) No source file named main.
l
[New Thread 2212.0xe34]
[New Thread 2212.0x654]

Program received signal SIGSEGV, Segmentation fault.
0x0041ad8b in exceptions_state_mc (action=CATCH_THROWING) at exceptions.c:126
126      switch (current_catcher->state)
(gdb) bt
#0  0x0041ad8b in exceptions_state_mc (action=CATCH_THROWING)
    at exceptions.c:126
#1  0x0041ad0d in throw_exception (exception=...) at exceptions.c:240
#2  0x0041ae68 in exceptions_state_mc (action=<optimized out>)
    at exceptions.c:191
#3  0x0041b1d4 in catch_errors (func=0x40181e <captured_main>,
    func_args=0x28fe90, errstring=0x614070 "", mask=6) at exceptions.c:519
#4  0x0040262c in gdb_main (args=0x28fe90) at ./main.c:949
#5  0x00608ef0 in main (argc=1, argv=0x3f2fc0) at gdb.c:35
(gdb) bt 30
#0  0x0041ad8b in exceptions_state_mc (action=CATCH_THROWING)
    at exceptions.c:126
#1  0x0041ad0d in throw_exception (exception=...) at exceptions.c:240
#2  0x0041ae68 in exceptions_state_mc (action=<optimized out>)
    at exceptions.c:191
#3  0x0041b1d4 in catch_errors (func=0x40181e <captured_main>,
    func_args=0x28fe90, errstring=0x614070 "", mask=6) at exceptions.c:519
#4  0x0040262c in gdb_main (args=0x28fe90) at ./main.c:949
#5  0x00608ef0 in main (argc=1, argv=0x3f2fc0) at gdb.c:35
(gdb) q
A debugging session is active.

    Inferior 1 [process 2212] will be killed.

Quit anyway? (y or n)
---------------------------------------------------------------------------- 

But if I replace "-Os" with "-O2" to rebuild again, gdb will work ok.

And gcc4.6.1 release haven't the issue.
I don't know why.
So it's gcc's -Os bug?
But I only found the issue when I built gdb, other projects with "-Os" work well.
Comment 1 xunxun 2011-10-20 06:39:17 UTC
gcc-4.6.2-RC-20111019 has not the problem.
May be solved.
Comment 2 xunxun 2011-10-20 06:39:50 UTC
gcc-4.6.2-RC-20111019 has not the problem.
May be solved.