I can see clearly now the bugs have gone

John Wiseman has a cool example of a debugger visualization plugin. Why be content with little expandable tree views of your datastructures when you could have arbitary visualization plugins? It’s hard to be excited about stuff like DevStudio’s autoexp.dat when you see what is possible elsewhere.

It’s harder to do this in C/C++ than lisp/smalltalk because you’re operating at the level of bytes and memory addresses rather than objects. A visualization plugin for a C++ debugger would have to be ultra-careful not to dereference bad pointers or it would bring the whole debugger down. Also, since objects in C++ don’t carry around much information about their type, you’d have to manually ensure that you update the plugin if someone adds a new data member to the type which the plugin shows. Perhaps you can get enough information from the debug info.

Hmm, so once again something which is easy in lisp or smalltalk becomes “possible, if you’re very careful” in C/C++.

1 reply on “I can see clearly now the bugs have gone”

You might check out the DMS Software Reengineering Toolkit if you want to process
C++ source code “as data”.
DMS has a full C++ front end that handles
templates and name/type resolution.
(OpenC++ does not), as well as
souce-to-source program transformations,
attribute evaluation, and is designed
to handle languages other than C++, too.

>>You wrote in your Blog:

But there’s no such black box to turn C++ source code into C++ data. The best I’ve seen is OpenC++, which is pretty damn good, but it’s a shame that it isn’t integrated with a compiler. Hey, that’d require that everyone agreed on a standard representation of C++ source as C++ data. The gcc compiler uses it’s own abstract syntax tree representation, which is different from the one used by OpenC++, so you can’t just plug them together.

This annoys me. I want to write tools which manipulate C++ source code. There is a hard, but solved, problem of turning C++ source code into C++ data. But there’s very few people out there who have produced a black boxes to do it. EDG sell a compiler front-end which does it, and OpenC++ exposes visitor-pattern access to it. Everyone else’s effort is tangled up in some-or-other compiler.

Comments are closed.