Yes, I've got a good listing file and it lists the whole symbol table. Maybe I'll copy the symbol table to a text file, sort it alphabetically and do a compare to the processor include file, delete matches and I'm left with program symbols. Then I can look for a second occurrence of each one. Thanks, Carey On Tue, Jan 29, 2013 at 6:58 PM, Tamas Rudnai wrote= : > Just another possible way: Compile it as normally you would do, generate = a > map and an asm output. Try to find the calls to the functions in the > generated asm (you will know the function addresses from the map file...) > > Tamas > > > On 29 January 2013 15:54, Tamas Rudnai wrote: > > > Yes, a simple string search sometimes not good enough, you probably wou= ld > > need a proper parser for that which can recognize what are string > literals, > > comments, function declarations, defines and other language elements. I > > assume there is no any profiler nor static analyser for PicBasic Pro? > > > > If not, you can write a state machine powered parser for yourself in Pe= rl > > / Python or Lex/Yacc and C/C++ for example. This might take some time b= ut > > then you have your tool forever. > > > > Or you can just try different things, like put counters to each > functions, > > initialize variables with a specific value, then run and try to trigger > > each functionalities, and then see these counters and variable values. > > There is a danger that not all functions been called even though all th= e > > functionalities been tested, so be extremely careful with this approach= .. > > > > Or the "barbarian way" is when a script walks through the code and keep= s > > renaming the functions and tries to compile -- if failed, marks the > > function used, otherwise as not used. This takes time but probably you > > leave it overnight and by the morning you get some results... If there > are > > too many to rename, do it by 4-5 each time and parse the compiler resul= ts > > which one was missing... Did I mention this is "barbarian" ;-) Oh and b= tw > > this is an iteration, so if you find any functions that can be commente= d > > out, then you need to start this analysis from the beginning -- maybe > > previously examined functions and variables were used only from this > > removed one... > > > > Tamas > > > > > > On 29 January 2013 12:51, Carey Fisher wrote: > > > >> I've been handed a rather large application written in PicBasic Pro wi= th > >> a goal of shrinking its size by 10-20% I need to find any dead code o= r > >> declared but unused variables. > >> Does anyone know of any good source code tools that will perform > >> functions like this? > >> (I tried using a word counting program to count the number of > >> occurrences of each unique word and then examine the code for the word= s > >> with only one occurrence. It sorta worked but, of course, it got all > >> the DEFINES etc from the processor's INCLUDE file.) > >> Thanks, > >> Carey > >> > >> -- > >> http://www.piclist.com PIC/SX FAQ & list archive > >> View/change your membership options at > >> http://mailman.mit.edu/mailman/listinfo/piclist > >> > > > > > > > > -- > > int main() { char *a,*s,*q; printf(s=3D"int main() { char *a,*s,*q; > > printf(s=3D%s%s%s, q=3D%s%s%s%s,s,q,q,a=3D%s%s%s%s,q,q,q,a,a,q); }", > > q=3D"\"",s,q,q,a=3D"\\",q,q,q,a,a,q); } > > > > > > -- > int main() { char *a,*s,*q; printf(s=3D"int main() { char *a,*s,*q; > printf(s=3D%s%s%s, q=3D%s%s%s%s,s,q,q,a=3D%s%s%s%s,q,q,q,a,a,q); }", > q=3D"\"",s,q,q,a=3D"\\",q,q,q,a,a,q); } > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 Carey Fisher Chief Technical Officer New Communications Solutions, LLC 678-999-3956 careyfisher@ncsradio.com --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .