Re: identify unused functions?



On Tue, Apr 1, 2008 at 12:06 AM, Brian J. Tarricone <bjt23 cornell edu> wrote:
G Hasse wrote:
 > There is NO way to clerify all unused functions in a program.
 > You could call functions by their addresses and those addresses
 > could be calculated in runtime. So you don't know...

 This is especially important in a gtk program where most (if not all)
 signal callbacks will be passed to g_signal_connect() as a function
 pointer, and will never be called directly.

However, if the functions are in a (private) library, then you can
find unused functions by subtracting the output of "objdump -R
$libdir/libfoo.so" (get dynamic relocations) from the list of defined
functions (see Stefan's nm --defined-only trick).  The difference is a
list of functions that aren't used by the library itself.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]