Re: Will therefore GDB utilize C++? Not.

John Gilmore
2012-04-06T23:32:38Z

> And yet, that's exactly what we are doing:
> - unit elaboration;
> - gdbarch/language dispatching
> - exception handling
> - use of unions to emulate polymorphism;

Writing modular programs is a good idea even if we don't do it in C++.
I have heard it claimed that many techniques of modular programming
were even invented before C++ existed - though that may be doubted.

If people have the energy to rewrite large chunks of GDB, why argue
about it? Go off and do it. It's free software -- you don't even
have to start from scratch like GNU did. The world can always use a
new debugger. You can make a politically correct debugger (pcdb?)
with an identical interface but a C++ implementation under the hood.
If it's better than GDB in the long run, maintainers will migrate to
it, GDB will fall into disrepair, and GNU will adopt it.

It's always easier to see how a completely paper design is cleaner
than a piece of running code whose warts are in front of you. And it
means you can respond to critics by saying, "See - you can't find any
problems in our nonexistent code, you are just making generalized
statements about the implementation language, which we should all
ignore as irrelevant." By the time you actually get the new design
working, it too will have compromises, bugs, and won't match its
documentation. Then again, if you had put that prodigious energy into
updating the original piece of running code, perhaps it would have
fewer bugs, fewer compromises, and updated documentation.

John

PS: Which particular unions in gdb are you complaining about ("used to
emulate polymorphism")? I grepped the sources, and see a bunch used
in BFD, in SIM, and in GDB's expression parser. It seems to me that
they are all used to unify storage and access to disparate types of
elements in a list or array -- not to make or fake polymorphism. This
is what unions were designed for. Did I miss some corner where unions
are cowering under the lash of abuse?

PPS: What is "unit elaboration" and what does that have to do with
GDB? All I can find from a quick web search is that it has something
to do with Ada. Perhaps other languages don't do it -- or have
another name for it. "Linking"? Are you sure we shouldn't rewrite
bits of GDB in Ada instead of C++?