I have asked this question on other Forums but to no avail. I am looking for software preferably supported on a Linux system that can take c code and generate data flow graphs or diagrams. I know how to generate control flow graphs or diagrams (CFG) from c code. I just do not know how to generate data flow diagrams from c code. That is a hard one. Any help appreciated. Thanks in advance. Also, please note I said generate the diagrams from code. I know of many software packages that can draw the diagrams once an analyst has inspected the code and given a rough outline of the DFG. That is easy. My code is just too complicated and too many lines to do this by inspection ands then draw with graphic or drawing tools. I need to generate the data flow graphs or diagrams. Any help appreciated. Respectfully
James Yunker wrote: > I am looking > for software preferably supported on a Linux system that can take c code > and generate data flow graphs or diagrams. Generating a correct and complete data flow graph probably amounts to solving turings halting problem. in other words, it is not possible except for special cases. There are some tools that should be able to generate data flow graphs from the running program, but as I won't have anything to do with "Naval Undersea Warfare" I will help you there.
Perhaps some UML tools have this as reengineering function. If you have some founded please report this in the forum.
As long as you need only C it's fairly simple to build a parser for it. I did it once (for lack of a better tool) an it is essentially just copying the C grammar into a yacc file. Once you have that you can extract any information the compiler has. (It's much harder to analyse C++ since there is no yacc grammar for it. The C++ grammar is not context free to the level, that yacc requires, I can't recall right now, which Chomsky level that would be.) Getting a complete data flow is tricky, though. While it's fairly simple to extract the call hierarchy and hence the data passed down it, there are also global variables and pointers. However, depending on your precise requirements you can still learn a great deal about your program.