|  | code analysis tool |  | |
| | | tns1 |  |
| Posted: Tue Aug 26, 2008 1:46 am Post subject: 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? |
| |
| | | Jon Harrop |  |
| Posted: Tue Aug 26, 2008 9:37 pm Post subject: Re: code analysis tool |  |
tns1 wrote:
| Quote: | 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 LINK |
| |
| | | tns1 |  |
| Posted: Thu Aug 28, 2008 2:45 am Post subject: Re: code analysis tool |  |
| |  | |
tns1 wrote:
| Quote: | 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. |
| |
| | | tns1 |  |
| Posted: Wed Sep 03, 2008 8:48 pm Post subject: Re: code analysis tool |  |
tns1 wrote:
| Quote: | 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. |
| |
|
|