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
3
votes
1 answer

How to retrieve a Control Flow Graph for python code?

I would like to dump the Control Flow Graph of a given python code, similar to the option given by gcc compiler option: -fdump-tree-cfg for c code. I succeeded getting the AST (Abstract Syntax Trees) of a python code, but it seams quite complex and…
JammingThebBits
  • 732
  • 11
  • 31
3
votes
1 answer

How to draw a control flow graph for a nested for loop?

for(num2 = 0; num2 <= 3; num2++) { for(num1 = 0; num1 <= 2; num1++) { cout<< num2<< " " << num1<< endl; } } how to draw a control flow graph for the above code segment? Thanks in advance :)
2
votes
2 answers

How could I generate Java CFG(Control Flow Graph) using antlr?

I am trying to analyse Java code sturcture. So, I generated a Java parser and lexer by using ANTLRv3 and java grammar code... but I don't know how could I generate Context Flow Graph using the generated parser and lexer. I tried to learn how to do…
RushMan
  • 21
  • 1
  • 2
2
votes
0 answers

Time of Day affecting how Python Package is Loaded

Of course, I doubt the ToD has anything to do with whether the package gets loaded or not, but it sure feels that way. Please allow me to share a bit of background. As part of my leveraging of the following GeeksforGeeks…
user3761340
  • 603
  • 5
  • 19
2
votes
1 answer

How to group nodes in a directed graph so that no two nodes in a group have paths between them?

I have a large directed graph with cycles (a control-flow-graph from a large program). I want to group the nodes such that each group would contain nodes independent to each other. Two nodes A and B are independent to each other if there is no path…
Rahul Gopinath
  • 808
  • 10
  • 24
2
votes
1 answer

Constructing a complete control flow graph for Linux kernel

Are there any tools that can build the control flow graph for an entire Linux kernel binary? For example, consider Linux kernel compiled for x86 architecture (vmlinux file). Is it possible to determine all execution paths (regarding indirect call)…
2
votes
0 answers

How to generate a control flow graph for any piece of java program?

I want to generate a control flow graph directly from the java source code. I have tried to use soot to generate a control flow graph, but soot will check for syntax errors, as shown below. D:\isoot>java -cp…
sandman
  • 21
  • 1
2
votes
2 answers

How do i express Try/Catch in a control flow graph?

I'm trying to calculate some Cyclomatic Complexity, hence trying to draw a Control Flow Graph. Firstly i'm trying to make it for a fairly simple method. Firstly i tried drawing it for just the try part like this: Heres the method: [HttpPost] …
Anders Jensen
  • 330
  • 3
  • 20
2
votes
1 answer

Machine Code based Control Flow Graph in LLVM

LLVM generally gives Control Flow Graphs (CFGs) for its intermediate representation (IR) language. You can also get high-level source-code-based CFGs with little effort. I want to get CFGs at the level of Machine Code. Is there any way to get…
soham
  • 1,508
  • 6
  • 30
  • 47
2
votes
4 answers

Building complete control flow graph for Linux kernel binary

Are there any tools that can build the control flow graph for an entire Linux kernel binary? For example, consider Linux kernel compiled for x86 architecture (vmlinux file). Is it possible to determine all execution paths (disregarding indirect…
2
votes
1 answer

Best way to visualize CFG of a broken LLVM function

I need to visualize the CFG of an LLVM Function, which I have in a .ll file. There is the opt tool, which has the --view-cfg option. However, the problem is that the function is broken, the definition of a register does not dominate all its uses. I…
gexicide
  • 38,535
  • 21
  • 92
  • 152
2
votes
1 answer

Generating CFG for C# code

I am looking for a tool to draw Control Flow Graph for C# code.. Something like AVRORA but for C# Any ideas?
Betamoo
  • 14,964
  • 25
  • 75
  • 109
2
votes
1 answer

Find the common path among all possible paths in a directed graph

I'm trying to find the common nodes that are always visited by each and every possible path in a cyclic directed graph. My idea would be to compute all possible paths and then search for the common elements. However, a) that does not seem to be very…
mr-ma
  • 199
  • 13
2
votes
0 answers

Unexpected behaviour after calling __stack_chk_fail

In x86, GCC generates the following instructions when it wants to call __stack_chk_fail: ; start of the basic block 00000757 call sub_590 ; __stack_chk_fail@plt 0000075c add byte [ds:eax], al 0000075e add …
frogatto
  • 28,539
  • 11
  • 83
  • 129
2
votes
0 answers

Tool to compare control flow of disassembly and C

Is there a tool to compare the control flow of some disassembly and some C? Here's my situation: I started with the disassembly (x86_64) of a function. In some C code, I have attempted--with the help of the decompilation provided by Hopper.app--to…
Nate Chandler
  • 4,533
  • 1
  • 23
  • 32
1 2
3
9 10