Bug 11031

Summary: gdb terminates when trying to set breakpoint at C++ exception
Product: gdb Reporter: Eran Ifrah <eran.ifrah>
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: critical CC: gdb-prs, jan, tromey
Priority: P2    
Version: 7.0   
Target Milestone: 7.1   
Host: Target:
Build: Last reconfirmed:

Description Eran Ifrah 2009-11-29 19:25:31 UTC
Hi,

I am using MinGW (g++4.4.0) + gdb 7.0.
If I set from a breakpoint: 'catch throw'
the minute I type 'c' to the debugger it crashes with the following error message:

"../../gdb-7.0/gdb/breakpoint.c:5989: internal-error: expand_line_sal_maybe: Asse
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y
../../gdb-7.0/gdb/breakpoint.c:5989: internal-error: expand_line_sal_maybe: Asse
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) y

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information."

the same happens if I try to break at:
b __cxa_throw

Note: both used to work with gdb6.8, I dont want to downgrade since I really
like the unicode support introduced in 7.0

Eran
Comment 1 Eran Ifrah 2009-11-29 19:26:28 UTC
Forget to add: my OS is Windows XP sp3
Comment 2 Paul Pluzhnikov 2009-11-30 04:03:33 UTC
Does not reproduce for me using gdb-7.0 (official release) built with "gcc.exe
(GCC) 4.4.0" from:
http://sourceforge.net/projects/mingw/files/GCC%20Version%204/gcc-core-4.4.0-mingw32-bin.tar.gz/download

Here is what I see:

$ cat t.cc
int main(int argc, char *argv[])
{
  if (argc > 1)
    throw 1;
  return 0;
}

$ g++ -g t.cc -o t

$ ~/gdb-7.0/build-mingw32/gdb/gdb ./t.exe
GNU gdb (GDB) 7.0
Copyright (C) 2009 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 "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from C:\cygwin\tmp/./t.exe...done.
(gdb) catch throw
Catchpoint 1 (throw)
(gdb) run 1
Starting program: C:\cygwin\tmp/./t.exe 1
[New Thread 6736.0x2b8]
Catchpoint 1 (exception thrown), __cxa_throw (obj=0x3f2580, tinfo=0x40e98c,
    dest=0) at ../../../../gcc-4.4.0/libstdc++-v3/libsupc++/eh_throw.cc:66
        in ../../../../gcc-4.4.0/libstdc++-v3/libsupc++/eh_throw.cc
(gdb) Error: dll starting at 0x77d40000 not found.
warning: Can not parse XML library list; XML support was disabled at compile time
Error: dll starting at 0x77d40000 not found.
Error: dll starting at 0x77c20000 not found.
66      ../../../../gcc-4.4.0/libstdc++-v3/libsupc++/eh_throw.cc: No such file
or directory.
where
#0  __cxa_throw (obj=0x3f2580, tinfo=0x40e98c, dest=0)
    at ../../../../gcc-4.4.0/libstdc++-v3/libsupc++/eh_throw.cc:66
#1  0x004013d0 in main (argc=2, argv=0x3f24f8) at t.cc:4
(gdb) c
Continuing.

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
terminate called after throwing an instance of 'int'

Program exited with code 03.
(gdb) q

Comment 3 Eran Ifrah 2009-11-30 06:01:14 UTC
Can you please provide me a link to the gdb that you are using? if it solves my
problem, I can live with that :P

I obtained my gdb from here:
https://sourceforge.net/projects/mingw/files/GNU%20Source-Level%20Debugger/GDB-7.0/gdb-7.0-mingw32-bin.tar.gz/download

Eran
Comment 4 Paul Pluzhnikov 2009-11-30 06:57:29 UTC
(In reply to comment #3)

> I obtained my gdb from here:
>
https://sourceforge.net/projects/mingw/files/GNU%20Source-Level%20Debugger/GDB-7.0/gdb-7.0-mingw32-bin.tar.gz/download

I just installed that copy, and observed the exact same output on my test
program from comment 2.

I suspect the problem may only be triggered by your real code, and not by the
test program. Please try to build the test program from comment 2, and if GDB
doesn't work for it, please paste your *entire* GDB session.

If GDB does work for the test program, then try to reduce your real executable
to the point where it contains no proprietary code and is small enought that it
can be attached to this PR.
Comment 5 asmwarrior 2010-02-26 09:41:38 UTC
@Eran
Today, I also meet this kind of debug error when I'm trying to debug a program
built from mingw GCC 4.4.3. Finally, the latest GDB didn't have this problem.

I have some discussion on the Codeblocks's forum, you can see here:
http://forums.codeblocks.org/index.php/topic,11301.msg82105.html#msg82105
Comment 6 Jan Kratochvil 2011-05-06 15:25:58 UTC
The `internal-error: expand_line_sal_maybe:' problem is now fixed by PR 12573.
But unaware of the MS-Windows issues.
Comment 7 Tom Tromey 2011-08-02 19:08:01 UTC
I think this was reported as fixed and there aren't
other open issues in this bug.  So, I'm closing it.
If I'm mistaken, please reopen and clarify, thanks.