6

With clang and graphviz I can generate the calling graph for some C/C++ code as explained in this answer.

Now I need a data flow diagram computed on a really large codebase ( it's C for the most part ), this codebase is a software where cmake is used as building tool.

So my problem is, given the name of a data structure, how I can possibly retrieve the names of the functions and the files using/implementing this structure ?

There is some sparse reference to some data flow mining algorithms inside Libtool from the clang project ( not even sure if it's something stable or in development ), but I found nothing on clang itself or scan-build.

How I can generate this piece of information ? I really need just that, given a name I would like to retrieve where is used in the code, pretty much all the static analysis tools that I have reviewed are focusing on functions and methods, I need to check a data structure usage in clang.

EDIT:

I'm also considering using doxygen for the documentation, so if the xml output of doxygen could be useful for some tool, I can use it.

Community
  • 1
  • 1
algl
  • 61
  • 1
  • 5
  • This might be a bit wacky, but have you considered loading the whole codebase into Eclipse, then using Eclipse's search functions to do it? – slugonamission Dec 08 '13 at 18:22
  • @slugonamission well, since I can't find nothing that works ... ; name what tools should I use with Eclipse, I know that CDT is the Eclipse suite for C and C++, but I don't know what is used for this kind of analysis . – algl Dec 08 '13 at 18:26
  • it's not really for dataflow, but your requirements just seem to be to check where a data structure is used. By using CDT + Eclipse, you can at least graphically find where a data structure is used (in one of the search menus somewhere), but not a full DFG. – slugonamission Dec 08 '13 at 18:27
  • See http://stackoverflow.com/a/41497191/120163 – Ira Baxter Jan 09 '17 at 02:03

1 Answers1

-1

You can query

  • all references to a symbol
  • global definitions
  • functions called by a function
  • functions calling a function
  • files including a file
  • and more.

with cscope.

denarced
  • 322
  • 3
  • 10
  • there is nothing that works visually ? Since this project is really big, a simple list of text from the terminal will soon get really complex to manage in an useful way; also there is no word on that page about external building tools, I need that kind of cooperation because of the size and the building process of my codebase. – algl Dec 08 '13 at 18:19
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – John Doyle Dec 08 '13 at 18:33
  • as @JohnDoyle, this question has been marked for deletion for being a link only. I recommend you re-post a more comprehensive answer. – Dave Alperovich Dec 08 '13 at 18:46
  • @algl I only know that cscope can take care of the hard part: parse the files and list the connections between things. I don't know about the graphical side. – denarced Dec 08 '13 at 20:42