This is the mail archive of the
mailing list for the Archer project.
Re: C++ draft
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: archer at sourceware dot org
- Date: Tue, 28 Jun 2011 16:21:22 +0800
- Subject: Re: C++ draft
- References: <email@example.com>
On Tue, Jun 28, 2011 at 5:08 AM, Tom Tromey <firstname.lastname@example.org> wrote:
> I've been working on another proposal to move gdb to C++. ?I'd
> appreciate help with it. ?Here is what I have so far.
> Do you find it reasonably convincing? ?If not, why not? ?What can be
> improved? ?Are there other good initial targets for conversion? ?Are
> there lurking problems of which I am unaware?
I don't have special preference over C or C++.
> My proposal is:
> 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.
> 2. Then, change GDB to compile with a C++ compiler (-Wc++-compat is
> ? not complete). ?This would be the second patch series.
> 3. Require C++.
> 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++ exception. ?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.
> ? I think our second target will be sorting out Python reference
> ? counting, so we can avoid the many problems we have had there.
In your concrete plan, IIUC, your plan is about converting GDB to C++
*partially*, instead of re-write GDB *completely*. Is that correct?
For example, I don't anything in your plan about converting *-tdep.c
stuff into C++. Is it in your plan or we plan to leave them as they
Do we plan to move gdbserver to C++? I think no, because some
baremental boards have too few memory to hold a C++ application. So
we are in a state that both C and C++ co-exist in GDB for some time.
I don't think C and C++ co-existance is a problem, or, your plan is
about "make good use of C++ to replace some bad and error-prone stuffs
in GDB, and keep the rest of GDB as it is". Is it right?
Just want to know clearly what GDB will be after your plan is performed.
Yao Qi <qiyaoltc AT gmail DOT com>