Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tools for generating a control flow graph from source code [closed]

I need a tool to generate a control flow graph from java source code. Are there such tools available? Is there a possibility to also generate source code if I have a control flow graph?

like image 339
Jenny Smith Avatar asked May 09 '26 19:05

Jenny Smith


2 Answers

See my company's (Semantic Designs) Java Front End. It will compute control flow graphs for methods from source code.

The Java Front End is built on top of DMS Software Reengineering Toolkit, which provides generic machinery for manipulating (parsing, analyzing [e.g., extracting control flow graphs]), transformating, and generating) code.

If one has a particular control flow graph, DMS provides the machinery to enable you to build a graph walker, and from that you could reasonably build Java ASTs that can then be used to produce Java source code. Obviously your control flow graph would have to use vocabulary that translates into Java concepts easily (e.g., no Prolog "unify this" operators), or you will have much harder time generating corresponding Java code. If you generated the graph from Java code, this would clearly be the case.

like image 117
Ira Baxter Avatar answered May 11 '26 16:05

Ira Baxter


Sparx Systems' EA has a tool which hooks into a debugger and generates UML sequence diagrams:

From the Sparx marketing spiel:

The debuggers built into Enterprise Architect are specifically designed to enable a developer or tester to capture stack trace information as they ‘walk through’ the executing code, performing runtime inspection of suspended threads. They can then use the final stack trace history to generate Sequence diagrams within Enterprise Architect, converting the actual code execution and calls into visual diagrams.

I'm pretty sure that this is a one way transformation only - no round tripping.

like image 33
chickeninabiscuit Avatar answered May 11 '26 15:05

chickeninabiscuit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!