Questions tagged [control-flow-graph]

A control flow graph (CFG) in computer science is a representation, using graph notation, of all paths that might be traversed through a program during its execution.

A control flow graph (CFG) in computer science is a representation, using graph notation, of all paths that might be traversed through a program during its execution.
In a control flow graph each node in the graph represents a basic block, i.e. a straight-line piece of code without any jumps or jump targets; jump targets start a block, and jumps end a block. Directed edges are used to represent jumps in the control flow. There are, in most presentations, two specially designated blocks: the entry block, through which control enters into the flow graph, and the exit block, through which all control flow leaves.

Reference

138 questions
1
vote
1 answer

Cyclomatic complexity - draw control flow graph for this java statement

Can anyone help with this? while (x > level) x = x – 1; x = 0
Mariohysa
  • 37
  • 7
1
vote
0 answers

Flatten control flow graph to list of bytecode instructions

I am using the ObjectWeb ASM library found here to parse jar files and read the bytecode of methods. I have already written code to generate a control flow graph from the bytecode instruction lists. However, after I perform some operations on the…
Bradley Odell
  • 1,248
  • 2
  • 15
  • 28
1
vote
1 answer

How do you include subroutine calls in a control flow graph?

I get the idea of a control flow graph; it involves nodes that are basic blocks (sequences of operations that always occur), connected by edges that represent jumps. But how do you represent a subroutine call? If I have two functions like this: int…
Jason S
  • 184,598
  • 164
  • 608
  • 970
1
vote
2 answers

Determining the maximum stack depth

Imagine I have a stack-based toy language that comes with the operations Push, Pop, Jump and If. I have a program and its input is the toy language. For instance I get the sequence Push 1 Push 1 Pop Pop In that case the maximum stack would be 2. A…
Joa Ebert
  • 6,565
  • 7
  • 33
  • 47
1
vote
1 answer

Visualizing RTL control-flow graphs generated by GCC

I have got a lot of outputs using -fdump-rtl-all flag of gcc and I was wondering how I can visualize these cfg files.
user3684042
  • 651
  • 2
  • 6
  • 16
1
vote
1 answer

Get the control-flow graph in assembly

I am desperately looking for a way to get the control-flow graph in assembly. I have the source code written in C and the processor is x86. I have already looked at the gcc's documentation and it does provide cfg in only gimple and rtl format. Any…
user3684042
  • 651
  • 2
  • 6
  • 16
1
vote
2 answers

Control Flow Analysis of Android APK or Android Source Code

I want to do control and data flow analysis of android app for which I need to create CFG. I have tried soot to make it but all I get is jimple and other middle level intermediate language code. How make a CFG with soot and even if I get it someway,…
Kumar Roshan Mehta
  • 3,078
  • 2
  • 27
  • 50
1
vote
1 answer

Static analysis tools for closed-source iPhone apps

I am searching for a tool or a combination of tools that can be used for static analysis of closed-source iPhone apps. I am interested in building a control flow graph of these apps. So I am thinking of doing the following: Decrypt the app, if…
1
vote
1 answer

Control flow graph dominance

I am studying compilers for a personal project and to do that I was looking at some papers from a university in the UK. One of the questions I stumbled upon reads as follows: Draw a CFG which contains a definition followed by a use of a variable x,…
Sorin Cioban
  • 2,237
  • 6
  • 30
  • 36
1
vote
0 answers

Command Line Control Flow Graph

Is there some tool that will, from the command line, produce a human-readable control flow graph? Preferably text based rather than a picture. Nearly every CFG generator I've seen is an eclipse plugin which slows things down considerably. EDIT:…
Aleph Two
  • 11
  • 3
1
vote
1 answer

How to build a Control Flow Graph (CFG) from a JSON object (AST)

I want to build a control flow graph (CFG) from an AST given in JSON format. So this AST is automatically created in TouchDevelop against each script. And since TouchDevelop is not Object Oriented programming, can I still use the Visitor pattern?…
0
votes
1 answer

Number of edges and nodes in this control flow graph (CFG)?

I'm having difficulty with nodes and arcs of a control flow graph (CFG). Please, could someone help me by telling me how many edges and nodes are in this control flow graph (CFG) ? Arcs and nodes control flow graph
kekkok
  • 11
  • 1
0
votes
0 answers

Is it possible to get a different result for calculating Cyclomatic complexity using 2 different methods?

I am trying to calculate the Cyclomatic complexity for this code. double power(int x,int y){ int exp; double res; if (y>0) exp = y; else exp = -y; res=1; while (exp!=0){ res *= x; exp -= 1; } if (y<=0) if(x==0) abort; else return…
0
votes
0 answers

Is there a way to get the filepaths of a given route's middleware in Express? Or create CFG that does?

I am trying to create a function that would determine the dependents and dependencies of a given route's middleware in Express. The goal is to figure out how separated my routes are so that I can begin to think about the best place to begin a…
0
votes
1 answer

How exactly to construct "basic blocks" for a compiler (using JavaScript as an example)?

I am working on a compiler project and wondering about the meaning and implementation of "basic blocks" of a control-flow graph (CFG). They say that the basic block is for the linear sequence of steps which don't have any branching. But first, a few…
Lance
  • 75,200
  • 93
  • 289
  • 503