code analysis tool

This is a discussion on code analysis tool within the Programming Languages forums in category; Looking for a tool that will help me understand a large body of C code which must be ported to a new OS/platform. In the past what I would do is an editor with dynamic grep and start walking thru each file, adding my own comments and creating my own reports, xrefs and flow diagrams. No doubt there is a tool or tool combo that does all of this now - perhaps something open source? Ideally it would list a report on each C file showing calls to, calls from and all internal vars too, and stick that info into ...

Go Back   Application Development Forum > Programming Languages

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-25-2008, 11:46 PM
tns1
Guest
 
Default code analysis tool

Looking for a tool that will help me understand a large body of C code
which must be ported to a new OS/platform. In the past what I would do
is an editor with dynamic grep and start walking thru each file, adding
my own comments and creating my own reports, xrefs and flow diagrams. No
doubt there is a tool or tool combo that does all of this now - perhaps
something open source?

Ideally it would list a report on each C file showing calls to, calls
from and all internal vars too, and stick that info into the header (or
a report) for me.

And while I'm asking, is there an open source file editor comparable to
brief/slick edit/codewright?
Reply With Quote
  #2  
Old 08-26-2008, 07:37 PM
Jon Harrop
Guest
 
Default Re: code analysis tool

tns1 wrote:
> Looking for a tool that will help me understand a large body of C code
> which must be ported to a new OS/platform. In the past what I would do
> is an editor with dynamic grep and start walking thru each file, adding
> my own comments and creating my own reports, xrefs and flow diagrams. No
> doubt there is a tool or tool combo that does all of this now - perhaps
> something open source?
>
> Ideally it would list a report on each C file showing calls to, calls
> from and all internal vars too, and stick that info into the header (or
> a report) for me.


Check out LLVM and CLang.

--
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com/products/?u
Reply With Quote
  #3  
Old 08-28-2008, 12:45 AM
tns1
Guest
 
Default Re: code analysis tool

tns1 wrote:
> Looking for a tool that will help me understand a large body of C code
> which must be ported to a new OS/platform. In the past what I would do
> is an editor with dynamic grep and start walking thru each file, adding
> my own comments and creating my own reports, xrefs and flow diagrams. No
> doubt there is a tool or tool combo that does all of this now - perhaps
> something open source?
>
> Ideally it would list a report on each C file showing calls to, calls
> from and all internal vars too, and stick that info into the header (or
> a report) for me.
>
> And while I'm asking, is there an open source file editor comparable to
> brief/slick edit/codewright?


How about something simple to start - a cross reference report organized
by function or by file. I looked at LXR and Doxygen and although they
can probably do this, the examples didn't look promising. Rather than
abstracted documentation, I'd prefer raw info from the compiler
presented in a simple text file like:

....
totaler()
Called from: file1.c:main(), file2.c:calculate()
Calls to: file2.c:average()
Local vars: samples[], loopcount, beg, end
Global vars: gFormat, gPrecision
....
function2()
Called from: file1.c:main(), file3.c:estimate()
Calls to: none
Local vars: loopcount, beg, end
Global vars: none
....

It looks like many of the modern IDEs such as MS visual studio have
improved search or 'code browsing' features. These are great, but can
any of these 'auto browse' so as to produce a report?

Toolchains such as gcc can produce mapfiles/symbol dumps, and the -cref
flag does produce something I can manually work with if I have to. Can I
get a xref output from visual studio? Maybe it looks better.


Reply With Quote
  #4  
Old 09-03-2008, 06:48 PM
tns1
Guest
 
Default Re: code analysis tool

tns1 wrote:
> Looking for a tool that will help me understand a large body of C code
> which must be ported to a new OS/platform. In the past what I would do
> is an editor with dynamic grep and start walking thru each file, adding
> my own comments and creating my own reports, xrefs and flow diagrams. No
> doubt there is a tool or tool combo that does all of this now - perhaps
> something open source?
>
> Ideally it would list a report on each C file showing calls to, calls
> from and all internal vars too, and stick that info into the header (or
> a report) for me.
>
> And while I'm asking, is there an open source file editor comparable to
> brief/slick edit/codewright?


I tried doxygen and although it isn't what I was originally looking for,
it does a great job of generating hyperlinked html docs. Using the
wizard it only took a few minutes to produce over 50MB of well-organized
docs complete with function call graphs.
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 05:05 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.