C-Scope-like source code browser?

Hi guys,

A few months ago, I downloaded a free Windows-based trial version of an application that was similiar to C-scope. It took all my .c and .h files, all the functions and variables within, and the output was a nice-looking tree showing which functions called which functions.

Does anyone know such a tool? I forgot the name and the website. It's free too for a month.

Thanks, Mike

Reply to
Mike V.
Loading thread data ...

At the moment I am using Doxygen. Produces nice html output, but does not give a tree. But every function is listed with a "references" and "referenced by" section.

It's free, no limit. And available for windows, linux, ....

formatting link

Stef

Reply to
Stef

Hi Mike,

have a look at:

formatting link

There is a C function tree tool. I have been using it for some years now and it really helps to analyze program structure. It does not show variables though.

kind regards

Jan Homuth

Mike V. schrieb in im Newsbeitrag: snipped-for-privacy@posting.google.com...

Reply to
Jan Homuth

Why use an imitation when you can get the real thing? cscope is freely available these days:

formatting link

and it works on all reasonably close imitations of a POSIX platform (including DOS through DJGPP, and Win32 through Cygwin). It integrates into all important cross-platform editors (read: both vim and (X)emacs ;-), too.

It isn't graphical, and it doesn't so far do actual call trees, but for interactive work within a large-ish code base, I find it very useful indeed. OTOH, I'm currently its maintainer, so I just _might_ be a tiny little bit biassed ;-)

Competition exists in all sorts and sizes. From plain old ctags, to GLOBAL, to GUI systems like RedHat Source Navigator and various generic or compiler-specific IDEs. And that's just the free ones I've tried out over time.

As usual, each has its own strengths and weaknesses. As far as C source is concerned, the usual pitfalls are massively complicated declarations, and preprocessor nasties. It all depends the chosen approach towards parsing C code: preprocess first or not (will lose #if'ed out branches, but help the parser in case of typedefs)? Use a real parser (syntax errors hurt badly) or a stateful lexer-on-steroids (will sometimes parse wrongly)? Exploit "typical" codestyles to help with the analysis?

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Reply to
Hans-Bernhard Broeker

Used C-SCOPE browser, loved it. The installation was all right. Tried redhat source navigator before on windows, little bit slow. Never have it work on solaris. I love the C-SCOPE tools build in xemacs, so convinient.

Reply to
Tony Zhang

Of course it does! Download the newest version, it has a CALL_TREE (IIRC) option. You will need the AT&T dot (graph generation tool, free download) for it.

-- Mark Piffer MCU and DSP programming & software design

Reply to
Mark Piffer

I found doxygen very useful, it does both things: automatic documentation generation and a lot of cross-reference and code analysis, even call trees, and all that thrown out in HTML or tex and some other formats.

OTOH, I still miss a tool, that can answer me database like questions about source code, like "give me all variables that are shared between the call trees rooting at function1 and function2". I am the not-so-proud heir of 30000 lines of C, obviously written in a all-you-can-globalize restaurant, and could use a little tool help in reverse engineering now. I tried GLOBAL, a gnu tool (and the silliest name you can give a command line program) but I didn't get too far, anyone with some experience out there?

Mark

-- Mark Piffer MCU and DSP programming & software design

Reply to
Mark Piffer

Silly me! I downloaded doxygen 1.3.1 a few weeks ago and assumed I still had the latest. But no, now there is 1.3.2 with some new features, including CALL_GRAPH! Thanks for the info.

Stef

Reply to
Stef

I have used PPT for a number of years. It works great. Shows tree. Cross references; Lists all functions across files. Lists all files using a particular function. Its kinda old, but free. Runs under DOS. Was written in pascal that will only run on Pentium I below 230mhz. (DOS bug was created in all subsequent Pentiums)

formatting link
PPT120.ZIP ... 12-Apr-1994 ... 427K Download file PPT V1.2 - Programmer Productivity Tools A collection of utilities for programmers including multi-module searching of text & C identifiers, renaming of C variables, comprehensive function flow analysis, all linked to your favorite editor & viewer programs. Also disk usage analysis and global date/time stamp setting.

Reply to
Carlin Perkins

As a side note: that's not a DOS bug, but a usability limitation of the Borland Pascal runtime libraries, and a rather famous one, too: "The Borland delay() bug". There are tools out there to fix it in-situ.

OTOH, from what you write, there shouldn't be any need to go through any hassles curing PPT from its bug --- IMHO, writing a C source analysis tool in Pascal, of all languages, is almost sacrilegeous anyway ;-)

The free version of cxref does all you describe, too, and it's available in source code. It creates either HTML or LaTeX. While at it, it can spit out a whole legion of warnings about code style for you.

Generally speaking, we've seen lots of suggestion of tools like cxref and doxygen in this thread, whereas the original question was after a cscope work-alike. Which none of those really are, because they aren't interactive browsers, but rather static documentators.

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Reply to
Hans-Bernhard Broeker

[...]

GLOBAL may actually be able to do that, or at least serve as the basis for a tool capable of doing it: it already stores all its knowledge in an actual database file format (Berkeley DB). Now, that doesn't come anywhere close to a relational DBMS or SQL, but you do have query tools to answer specific queries about the structure of the code analysed.

cscope and cxref also build data bases, but they're considerably simpler in layout than that, and thus may not have enough power.

Starting with any of those, and adding some serious Perl hacking (or whatever you prefer as a high-power scripting language) on top of it, it should be possible to implement the kind of queries you're after.

What you really need would be a complete usage graph, like the one you can display in Source Navigator and similar GUI tools. That's considerably more than just a call graph: it has to include usage of variables by functions, of types by variables, of types by other types, and of #includes by other sources.

Once you have such a graph, you can apply graph theory methods to answer your queries. The one you gave would translate: what is the set of nodes of type "global variable" that is reachable along "refers to" type edges from both node "function1" and "function2"?

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Reply to
Hans-Bernhard Broeker

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.