This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 00/11] C++/MinGW patches
- From: Pedro Alves <palves at redhat dot com>
- To: fracting at gmail dot com
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 17 Nov 2015 14:50:05 +0000
- Subject: Re: [PATCH 00/11] C++/MinGW patches
- Authentication-results: sourceware.org; auth=none
- References: <1446492970-21432-1-git-send-email-palves at redhat dot com> <5637C1FA dot 2060708 at redhat dot com> <CALd+sZThHQQFq4DSw9Dd0pXVfYmAq=RFj0GM1OtmSXv8OwL4sg at mail dot gmail dot com> <5637CB96 dot 4010106 at redhat dot com> <CALd+sZQ2tPkgiKAH2rxpLy_pr_j4cxTo2Jy95naFG6LuoJP2GQ at mail dot gmail dot com> <5638988C dot 5070601 at redhat dot com> <5638E6C5 dot 5040006 at redhat dot com> <CALd+sZQmrVgosOuz+qOnHZe6p4k8Oyuv2qNWbjXm9svyHTJ+3A at mail dot gmail dot com> <563937B4 dot 7080800 at redhat dot com> <CALd+sZSU6q0ff7FVWpX0uQjx0iWOmtbg28LGqMgvRnSgAMEf0w at mail dot gmail dot com>
On 11/09/2015 09:52 AM, Qian Hong wrote:
> Hi Pedro,
>
Hi Qian,
> Thanks for the info, I did some tests with your code.
>
> On Wed, Nov 4, 2015 at 6:39 AM, Pedro Alves <palves@redhat.com> wrote:
>> So it seems to me that something is wrong with C++ exceptions
>> support in the mingw toolchain you used. I suggest trying a simple
>> test like:
>>
>>
>> ... to check whether C++ exceptions work at all.
>
> The above test case works for me.
> I tried several thing:
> 1. build the above code with MINGW-w64 g++ from MSYS2, run on MSYS2.
> It works on both Windows and Wine.
> 2. build the above code with MinGW-w64 cross compiler from my Ubuntu,
> runs on Wine, works as expected.
> 3. build the above code with Linux native g++ (i386), runs on Linux,
> works as expected.
> 4. Added customer printf statement to the source code, retest on all
> configuration above, and I can confirm all executed code path are the
> same.
>
>
>> One issue to look out for is what flavor of C++ exceptions your mingw
>> toolchain uses. There are flavors using dwarf2, others using sjlj. Also, we
>> link gdb with -static-libstdc++ -static-libgcc, which may make a difference.
>
> I tried all 4 combination of with/without
> -static-libstdc++/-static-libgcc, the test case works for me on
> Windows with MinGW-w64 g++ from MSYS2.
>
> MSYS2 g++ has --disable-sjlj-exceptions --with-dwarf2, not sure if it
> does matter.
Could well be. The problem may be that a dwarf or seh exception
(not sure which is used nowadays, if sjlj exceptions are disabled)
is failing to cross some foreign frame (e.g., a system DLL).
A C++ gdb cross built with Fedora 20's mingw-w64 g++ (4.8.4) runs fine
on a Windows 7 machine I had handy here, and that doesn't seem to
have been built with --disable-sjlj-exceptions.
Since C mode still works fine after my patches, and I can't imagine that it's
this series that's creating the exceptions/C++ issue you're running into, I'm
going ahead with pushing the series in. We'll revisit later when we re-wire
THROW/CATCH to real C++ exceptions later on, if necessary.
Thanks,
Pedro Alves