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: Will therefore GDB utilize C++ or not?


>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> If you asked me not too long ago, I'd have been strongly in favor
Pedro> of C++.  However, that is no longer the case.  I'm now pending
Pedro> towards "no C++".

First, let me say, thanks for your considered opinion.

I'm sorry it has taken me so long to reply, but various personal events
have made it hard to do so in a more timely way.  Luckily (?) the thread
rages on, so I don't feel too awfully tardy.

Pedro> Indeed, gdbserver would need to remain pure C, and likewise any
Pedro> code shared between gdbserver and gdb should have to be kept
Pedro> as such.  This is important, because we want gdbserver to be usable
Pedro> in #1, resource constrained scenarios where the C++ dependency would
Pedro> be unacceptable.

I found this post to be sensible and I basically agreed with everything
you said -- I'm sort of dog-like and easily swayed by the last thing I
saw -- but on reflection I think the above paragraph is the crux of the
argument, and I am not sure I agree with it.

I think this relies on the idea that the C++ runtime dependency is
unavoidably very heavy.  And, in earlier discussions on the Archer list,
I agreed with this idea without giving it too much thought.

But, that seems to me to be an empirical question.  We could measure the
impact.

This would mean having some criteria for what is acceptable.  I think
that would probably be a good thing to have.  It seems weird that the
current status is that code goes into gdbserver without any sort of
measurement impact -- if resources are an issue, then they should be an
issue generally, not just due to the specter of C++.

Pedro> (On a sidenote: I get the impression from some that C++ would be mostly
Pedro> useful for the stronger static typing, but I can't help finding it in
Pedro> contrast with the simultaneous push of some of GDB functionality towards
Pedro> being implemented in python, with duck typing and all, which people
Pedro> are happy with.

The two programming environments are very different, though; and the
core-versus-extension difference is essential.  One thing I like about
scripting gdb in Python is that I can write quickly -- but also that I
can write lower-quality code without caring about it.

Pedro> One (uninvestigated) idea I had was to take a look at Linux's
Pedro> sparse tool for catching issues like the "offsets" case that led
Pedro> to this thread.)

For the offsets case it might have worked; but in many interesting cases
static analysis (and thus modification) of gdb is just crazily hard,
because gdb is written in such a weird way.  E.g., read the Coverity
reports sometime -- tons and tons of false reports due to cleanups.
Cleanups are hard to even check when you write a tool specifically for
checking them (I did this...).  They are also what will make it very
difficult for us to use the Python refcount checker (we probably just
won't).

Pedro> There's also the issue with in-process code, which is also
Pedro> desirable to remain as C code.  Latest developments push towards
Pedro> having debugger code run _within_ the inferior.  Witness
Pedro> gdbserver's current IPA (in-process agent; libinproctrace.so),
Pedro> which has a lot of coupling in its implementation (and a lot of
Pedro> code shared), and a bunch of code shared with gdbserver.  We
Pedro> can't predict which bits of GDB will we want to be able to reuse
Pedro> in GDBserver or an IPA, but I do believe that we will be
Pedro> considering it (reuse something more) the future.

It seems to me that we must have a licensing issue here.
Can it really be ok to map GPL'd code into any old process?

It seems mildly absurd to me to couple the implementation language
choice of a large, complicated, interactive host-side tool like gdb to
that of an in-process debug agent.

Tom


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