Re: Tools for removing code

Top Page
Attachments:
Message as email
+ (text/plain)
+ signature.asc (application/pgp-signature)
+ (text/plain)
Delete this message
Reply to this message
Author: Ted Gould
Date:  
To: Main PLUG discussion list
Subject: Re: Tools for removing code
On Wed, 2006-10-04 at 17:57 -0700, Daniel P. Stasinski wrote:
> I just started working on a project that involves removing a ton of
> code out of another project and it's proving to be tedious. Is anyone
> familiar with techniques or specific Linux based tools for identifying
> unused functions in C apps?
>
> I believe there are gcc optimizations to remove the code at compile
> time, but for my own sanity I would rather remove them completely from
> the source.


I don't know of a tool to do specifically that. But, one tool that
could be used for that (and is a really cool tool) is egypt [1]. Egypt
outputs a graphviz dot file, which has a really simple syntax. I'm sure
you could parse it to find out which functions didn't have any callers.
I'm not sure how much optimization is done by GCC before the RTL level,
but I don't think functions are removed. You can probably use -O0 to
force it not to.

        --Ted


[1] http://www.gson.org/egypt/egypt.html

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss