[clug] Code "rework/rewrite" tools.

Andrew Janke a.janke at gmail.com
Wed Jan 21 01:54:08 GMT 2009


> I've not worked with C++, so YMMV.

Aye, I am not the world's biggest fan of C++.. :)

   "If you can't do it in C, C++ isn't going to help you".

> I would've thought 'gdb' or your favourite debugger would be able to
> pick out every entry point (one library or all libraries) - in much the
> same way that strace/truss/svr4mon pick up syscall's.
>
> Failing that, you've implied that you have all the source code, so you
> can kludge the same effect with a macro that expands all 'function's to
> log what is used. (or m4, but I'm not expert on that).

Yup, I have used this approach in the past for C via my own hashed up
perl script code mungers that add printf's as the first line of each
function with its name.  From there you just run (coverage issues
aside) and the shove the output through grep, sort and uniq.

Still the problem with this approach in a C++ world is how to handle
function prototypes, Templates and other such malarkey.

> Is this app performance critical?

Not really.


> In project 'gecko', Andy Hume used tools to analyse large slabs of code
> for 'dead code removal'. Don't recall what he used (it was the billing
> system for AT&T long distance calls - 100 programs).

Interesting.  I went a digging but couldn't dig up much in terms of tools. :(

Thanks to all who have replied, looks like the "old way" might be the
way to go...  (ie: remove stuff and see what breaks).


a


More information about the linux mailing list