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

Why can't I get topological sort over the control-flow graph (CFG)?

Final goal: Trying to generate CFG related information(such as topological sort) using LLVM. Status: I'm pretty new to LLVM and kind of lost - any kind of information or blogs to help me get started towards my final goal is great! My Question: After…
penguin
  • 53
  • 1
  • 5
1
vote
1 answer

in G++'s cfg output, what is "bb"?

I'm exploring some of the output from g++'s cfg facilities. I think I understand what "bb" does - it is a label for goto statements, right? What does bb stand for? Does g++ have any other ways of labeling places to go to?
Michael Stachowsky
  • 717
  • 1
  • 5
  • 21
1
vote
1 answer

Roslyn : get instructions from a basicblock

Control flow graph generated in roslyn contains blocks (basicblock) as nodes, each basicblock contains one or more instructions. for the basicblocks that contains more than one instruction, i try to get all the instructions and their types this is…
Hamza
  • 440
  • 7
  • 20
1
vote
1 answer

How to get a control flow graph of a program?

I want to get a control flow graph of a code/program (be it any programming language and given its grammar). I have tried using lark library in python to parse a basic C sample program [I provided the grammar for basic c syntax to lark]. As a…
1
vote
1 answer

How to use "graph" option on gcc's -fdump-tree?

I'm trying to see if gcc can provide more information that I can use to create Control Flow Graph from a C source code and then use it to check which path is taken by an executed test case from Gcov .gcov output. So far my best candidate is using…
AceVez
  • 291
  • 1
  • 5
  • 19
1
vote
2 answers

Jump in the middle of basic block

A basic block is defined as a sequence of (non-jump) instructions ending with a jump (direct or indirect) instruction. The jump target address should be the start of another basic block. Consider I have the following assembly code : 106ac: …
1
vote
2 answers

Extracting Basic Blocks/CFG from LLVM/clang on the Backend

I've been beginning to work with LLVM and I'm interested to know if there is a programmatic way to extract the control flow graph and/or basic blocks from LLVM/clang in order to do some analysis on them. Is there a way to hook into the tool chain…
thegravian
  • 458
  • 3
  • 18
1
vote
1 answer

Convert Control Flow Graph To Directed Acyclic Grraph

Let's say I have a cyclic control flow graph A -> B -> C -> D -> G ^ | | v F <------ E Each node is associated with a cost. I additionally have a state variable that is modified each time I enter node D. The…
sheridp
  • 1,386
  • 1
  • 11
  • 24
1
vote
1 answer

How to create a control-flow graph with Soot?

For a while I have been struggling with creating a control-flow graph with Soot and I kinda got lost in its tutorials. Rather than using Soot as an Eclipse plugin, I have been trying to use Soot as a library or API. What I want to do is, I have a…
Ekin
  • 407
  • 1
  • 6
  • 17
1
vote
1 answer

How to track a method parameter?

I have been trying to find the exact term for "tracking a method's parameter" for Java programming language and I generally found "taint analysis", but still not sure if I am on the right path. What I want is, to keep track of a method's parameter…
Ekin
  • 407
  • 1
  • 6
  • 17
1
vote
0 answers

LLVM: how to check that there are no loops in bytecode after loop-unrolling

I have a number of C source code files, on which I would like to perform some type of static analysis. First, I need to get rid of any loop in the control flow graph, for which I use the following one-liners: ~$ clang -emit-llvm -c file.c -o…
Patrick Trentin
  • 7,126
  • 3
  • 23
  • 40
1
vote
0 answers

Drawing Control Flow Graphs using code

Draw the Flow Control Diagram for the following piece of code. insertion_procedure (int a[], int p [], int N) { int i,j,k; for (i=0; i<=N; i++) p[i] = i; for (i=2; i<=N; i++) { k = p[i]; j = 1; …
Tom
  • 19
  • 1
  • 8
1
vote
0 answers

getting live variables with clang's python binding

I'm writing an analysis tool for C language in Python and I am using clang python binding for this purpose. So far it has been great and I was able to get AST of the C files I have and process them. Now I need to find live variable at a certain…
afsafzal
  • 592
  • 5
  • 15
1
vote
1 answer

Finding the input dependencies of a functions outputs

I've been working on a python program with pycparser which is supposed to generate a JSON-file with dependencies of a given function and its outputs. For an example function: int Test(int testInput) { int b = testInput; return b; } Here I…
1
vote
1 answer

Finding all possible paths in a c/c++ program by LLVM

I am trying to find any possible path in my program by LLVM. Right now I can find paths from entry to exit BB of all functions in my code. However that's not what I need. What I need is extending CFG (maybe by inlining function calls?!) to have a…
Nhome
  • 303
  • 2
  • 3
  • 12