Discussion:
[Bug gdb/21078] New: gdb compiled with mingw32 crashes on Windows7 when entering any invalid command
david at engster dot org
2017-01-24 16:11:59 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21078

Bug ID: 21078
Summary: gdb compiled with mingw32 crashes on Windows7 when
entering any invalid command
Product: gdb
Version: 7.12.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: david at engster dot org
Target Milestone: ---

Created attachment 9770
--> https://sourceware.org/bugzilla/attachment.cgi?id=9770&action=edit
config.log file from configure run

I have built the latest gdb (7.12.1) with i686-w64-mingw32 (gcc v6.3.0, MSYS2)
on a Windows 7 64bit system, simply using

./configure --prefix=/opt/gdb

(I attached the config.log to this report.)

When I start gdb and enter any invalid command that would normally lead to an
error message (like "help foobar"), the process just aborts (like from an
unhandled exception):

(gdb) help foobar

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

Version 7.12 has the same problem, but 7.11 works fine, so this must be
triggered by something since 7.11. I also tried building with the old mingw gcc
from mingw.org, but it has the same problem. Unfortunately, I cannot seem to be
able to obtain any backtrace when running this inside another gdb.

I also tried other gdb v7.12 binary builds, and some have the same problem,
for instance the gdb in the latest Linaro toolchain for Arm, or the 'gdb' that
can be installed in MSYS2. However, the build from Eli Zaretskii (ezwinports)
works fine.
--
You are receiving this mail because:
You are on the CC list for the bug.
orgads at gmail dot com
2017-03-07 13:02:42 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21078

Orgad Shaneh <orgads at gmail dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |orgads at gmail dot com

--- Comment #1 from Orgad Shaneh <orgads at gmail dot com> ---
Looks like a C++ exception is thrown by error(), but it is not catched in
catch_errors().

Trace:

1 msvcrt!abort
2 uw_init_context_1
3 _Unwind_RaiseException
4 __cxa_throw
5 throw_exception_cxx common-exceptions.c 303
6 throw_exception common-exceptions.c 317
7 throw_it common-exceptions.c 373
8 throw_verror common-exceptions.c 379
9 verror utils.c 525
10 error errors.c 43
11 undef_cmd_error cli-decode.c 1475
12 lookup_cmd cli-decode.c 1517
13 execute_command top.c 630
14 command_handler event-top.c 641
15 command_line_handler event-top.c 833
16 gdb_rl_callback_handler event-top.c 213
17 rl_callback_read_char callback.c 220
18 gdb_rl_callback_read_char_wrapper_noexcept event-top.c 175
19 gdb_rl_callback_read_char_wrapper event-top.c 192
20 stdin_event_handler event-top.c 568
21 handle_file_event event-loop.c 733
22 gdb_wait_for_event event-loop.c 884
23 gdb_do_one_event event-loop.c 347
24 gdb_do_one_event common-exceptions.h 225
25 start_event_loop event-loop.c 371
26 captured_command_loop main.c 324
27 catch_errors exceptions.c 236
28 captured_main main.c 1149
29 gdb_main main.c 1159
30 main gdb.c 32
--
You are receiving this mail because:
You are on the CC list for the bug.
orgads at gmail dot com
2017-03-07 15:05:24 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21078

--- Comment #2 from Orgad Shaneh <orgads at gmail dot com> ---
Actually the exception should be catched in gdb_rl_callback_handler.
--
You are receiving this mail because:
You are on the CC list for the bug.
orgads at gmail dot com
2017-03-07 17:18:16 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21078

--- Comment #3 from Orgad Shaneh <orgads at gmail dot com> ---
Linking without -static-libstdc++ and -static-libgcc fixes this. There's a
pending patch in bug 21187.
--
You are receiving this mail because:
You are on the CC list for the bug.
brobecker at gnat dot com
2017-04-12 14:04:46 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21078

Joel Brobecker <brobecker at gnat dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |brobecker at gnat dot com

--- Comment #4 from Joel Brobecker <brobecker at gnat dot com> ---
I just built using the current master, using GCC 6.3.1, and it worked fine for
me:

(top-gdb) help foobar
Undefined command: "foobar". Try "help".
--
You are receiving this mail because:
You are on the CC list for the bug.
david at engster dot org
2017-06-13 08:18:34 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21078

--- Comment #5 from David Engster <david at engster dot org> ---
I just tested again with gdb 8.0 and gcc 6.3.0 from MSYS2 32bit
(i686-w64-mingw32-gcc), and I still see the same problem. I have no idea why it
works for you.

I can however also confirm that the patch from Orgad in bug 21187 and using
"--disable-staticlib" fixes this issue, so it is definitely an issue with
static linking.
--
You are receiving this mail because:
You are on the CC list for the bug.
jon.turney at dronecode dot org.uk
2017-10-12 17:23:25 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21078

Jon Turney <jon.turney at dronecode dot org.uk> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |jon.turney at dronecode dot org.uk

--- Comment #6 from Jon Turney <jon.turney at dronecode dot org.uk> ---
This problem is also seen on x86 Cygwin, and same workaround applies.

It would be nice if we understood what was going wrong in the unwinder to cause
this problem, though...
--
You are receiving this mail because:
You are on the CC list for the bug.
asmwarrior at gmail dot com
2017-10-13 06:31:15 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21078

asmwarrior <asmwarrior at gmail dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |asmwarrior at gmail dot com

--- Comment #7 from asmwarrior <asmwarrior at gmail dot com> ---
I don't see this issue, I build GDB git master under msys + mingw-w64
mingw-build 5.4 gcc 32 bit version, if you would like to test, I have the
binary here: http://forums.codeblocks.org/index.php/topic,22185.0.html, you
need to install the official python 2.7 distribution, because my gdb was build
against this python.
--
You are receiving this mail because:
You are on the CC list for the bug.
jon.turney at dronecode dot org.uk
2017-10-13 12:24:49 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21078

--- Comment #8 from Jon Turney <jon.turney at dronecode dot org.uk> ---
(In reply to asmwarrior from comment #7)
Post by asmwarrior at gmail dot com
I don't see this issue, I build GDB git master under msys + mingw-w64
mingw-build 5.4 gcc 32 bit version, if you would like to test, I have the
binary here: http://forums.codeblocks.org/index.php/topic,22185.0.html, you
need to install the official python 2.7 distribution, because my gdb was
build against this python.
Since it seems to be something to do with unwinding across DLL boundaries, I'm
going to wildly guess that building without --with-system-readline also
prevents
this problem.
--
You are receiving this mail because:
You are on the CC list for the bug.
jon at beniston dot com
2018-08-20 08:01:03 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21078

jon at beniston dot com changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |jon at beniston dot com

--- Comment #9 from jon at beniston dot com ---
I've also just come across this on 32-bit Cygwin.

Strangely, gdb 8.0 is fine, when compiled with gcc 6.4.0 and 7.3.0.
However, gdb 8.1 and 8.1.1 both have the problem, when compiled with gcc 6.4.0
or 7.3.0.

Removing -static-libstdc++ -static-libgcc LDFLAGS fixes it as above.
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...