From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3561 invoked by alias); 17 Nov 2015 14:50:13 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 3548 invoked by uid 89); 17 Nov 2015 14:50:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 17 Nov 2015 14:50:08 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 24AFD92462; Tue, 17 Nov 2015 14:50:07 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tAHEo5Ff013375; Tue, 17 Nov 2015 09:50:06 -0500 Message-ID: <564B3E9D.2020409@redhat.com> Date: Tue, 17 Nov 2015 14:50:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: fracting@gmail.com CC: gdb-patches@sourceware.org Subject: Re: [PATCH 00/11] C++/MinGW patches References: <1446492970-21432-1-git-send-email-palves@redhat.com> <5637C1FA.2060708@redhat.com> <5637CB96.4010106@redhat.com> <5638988C.5070601@redhat.com> <5638E6C5.5040006@redhat.com> <563937B4.7080800@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-11/txt/msg00342.txt.bz2 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 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