This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Move GDB to C++ ?


On Thu, 2008-07-10 at 11:46 -0700, Stan Shebs wrote:
> As many know, there is a project afoot to investigate the recoding of 
> GCC from C into C++. I believe the C++ idea was briefly touched on for 
> GDB at the summit, although I don't remember much discussion. Anyway, 
> this would be a good time to start thinking about it, and if people are 
> generally in favor of the idea, we can start small by tweaking the 
> sources to be C++-friendly, avoiding keywords and so forth; GCC has a 
> new warning flag -Wcxx-compat that can help.
> 
> For my part, I think we should do it. GDB has quite a bit of object-like 
> structure internally, and while in the past it was taking a bit of a 
> chance to rely on the availability and reliability of C++ compilers, 
> those concerns are now generally outdated; I'm not sure any of the 
> potential problem hosts are even supported any longer.

While I do not love C++, I can see no harm in this suggestion.
Even if the full transition never happens, gdb will be no worse.

On Thu, 2008-07-10 at 16:39 -0400, Andrew Cagney wrote:
> The one question I would pose though, is bashing up the current GDB
code 
> base until it compiles with C++ a reasonable approach?  Each time C++ 
> has been suggested previously, that has been the proposed path forward, 
> and each time it has not moved (I've even tried it my self).  Perhaps, 
> instead, we should approach this more on a component basis - stack, 
> expr, type, proc, debug-info, ..., and convert each chunk in turn.

I think this is perfectly reasonable too -- and the two suggestions
are perfectly compatible.  I also like Stan's suggestion about
branches.

On Thu, 2008-07-10 at 23:26 -0700, Joel Brobecker wrote:
> That would be my concern #1. I really think that it's a huge plus
> to be able to build GDB with a C compiler. C++ compiler are just
> not as common as C compilers, particularly on more exotic platforms.

We recently made the jump from K&R to requiring an ANSI compiler.
Are we really all that far from requiring GCC?

Joel:
> My other major concern is debugability - I want to make sure that
> if we agree on the transition, GDB will be as easy to debug as before.
> I am way out of my league on this, but isn't it the case that:
>   - there's still some progress to be made to help debugging C++
>     in general (I might be VERY wrong on that one)

You're not entirely wrong -- but that argument cuts both ways.
If gdb is written in C++, that will force us to "eat our own
dog food", as it were... and maybe debug support for C++ will
improve.

>   - that stabs is not good enough to provide full C++ debugging support
> ?

In that you are correct.  But it's not all-or-nothing.
We should enumerate what parts of C++ are un-supportable
in stabs.

Andrew Cagney:
> ...  I suspect that, when we're 
> talking about that sort of time scale for an incremental approach, it 
> too runs the risk of limited commitment levels, and GDB finding itself 
> in a C vs C++ no-where land.

Yep, but the first step that Stan proposes is innocuous.
GDB will be no worse for being able to be compiled with 
  -Wcxx-compat .




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]