From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4686 invoked by alias); 19 Apr 2012 08:43:45 -0000 Received: (qmail 4625 invoked by uid 22791); 19 Apr 2012 08:43:43 -0000 X-SWARE-Spam-Status: No, hits=-4.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 19 Apr 2012 08:43:28 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1SKmxb-0007Ej-KU from Yao_Qi@mentor.com ; Thu, 19 Apr 2012 01:43:27 -0700 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 19 Apr 2012 01:42:43 -0700 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.1.289.1; Thu, 19 Apr 2012 01:43:26 -0700 Message-ID: <4F8FD047.6030702@codesourcery.com> Date: Thu, 19 Apr 2012 08:43:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: Tom Tromey CC: Jan Kratochvil , Subject: Re: Will therefore GDB utilize C++ or not? References: <20120330161403.GA17891@host2.jankratochvil.net> <87aa2rjkb8.fsf@fleche.redhat.com> In-Reply-To: <87aa2rjkb8.fsf@fleche.redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-04/txt/msg00150.txt.bz2 On 04/05/2012 04:47 AM, Tom Tromey wrote: > My concrete transition proposal is: > I went through discussions in this thread, and go back to read Tom's proposal again. Get some additional thoughts, maybe, we can start from something easy and less-controvesy, > 1. Modify GDB so it can be compiled with -Wc++-compat. > This would be the first patch series. There is already an archer > branch for this. > Modify GDB as well as GDBserver/IPA so they can be compiled with -Wc++-compat. > 2. Then, change GDB to compile with a C++ compiler (-Wc++-compat is > not complete). This would be the second patch series. > Change to use C++ compiler to compile GDB, GDBserver and IPA. If this is too aggressive, we can use C++ compiler to compile GDB and keep C compiler to compiler GDBserver and IPA. Sources in gdb/common/ will be compiled by C compiler and C++ compiler respectively. Is it possible? > 3. Require C++. Then, we can require C++ for GDB and keep GDBserver and IPA unchanged. > > 4. Change selected modules to use C++ rather than C. > I don't think a wholesale change makes sense, but some areas would > benefit. > > My first target would be to change the exception handling system to > use C++ exceptions. This would enable us to begin using RAII in > some areas, which would help robustness. > > My concrete plan here is: > > * Use the GCC cleanup-checking plugin I already wrote to detect > cleanup-aware functions. > > * Modify these functions, using a script, to add an RAII-using > object to manage the local cleanups. This is important so that > we run cleanups at the correct time during stack unwinding. > > * Change throw_exception to use 'throw' and all TRY_EXCEPT > instances to try...catch. > > * Finally, convert functions to static RAII usage when appropriate; > this will be an ongoing transition. Most of the objections are to these points. We can postpone them, and .... > > I think our second target will be sorting out Python reference > counting, so we can avoid the many problems we have had there. ... start this first, if this is quite isolated and not dependent on #4 above. Python reference counting will not be used in GDBserver, so we don't have to worry about GDB/GDBserver code sharing. -- Yao (齐尧)