-
Notifications
You must be signed in to change notification settings - Fork 141
CodeGraphs
Jiawei Wang edited this page Jul 29, 2025
·
10 revisions
- CodeGraph is the demo program sample to understand LLVM IR and their graph representations, i.e., ICFG and PAG
CodeGraph/
|-- CMakeLists.txt
|-- CodeGraph.cpp
`-- src
|-- swap.c
`-- example.c
* Before coding, please type cd $HOME/Software-Analysis-Studio and git pull in your terminal to make sure you always have the latest version of the code template.
cd /home/SVF-tools/Software-Analysis-Studio/CodeGraph
clang -S -c -O0 -fno-discard-value-names -emit-llvm src/swap.c -o swap.ll
opt -S -p=mem2reg swap.ll -o swap.ll
cd /home/SVF-tools/Software-Analysis-Studio/CodeGraph
sh compile.sh src/swap.c
The two .ll file (i.e., swap.ll) will be generated under the /home/SVF-tools/Software-Analysis-Studio/CodeGraph folder
3.1 launch.json
You need to set the "program" to be the executable file of CodeGraph, i.e., "${workspaceFolder}/bin/codegraph" in
launch.json in order to run and debug
You need to set the "args" to be the .ll file you have just generated, i.e., "${workspaceFolder}/CodeGraph/swap.ll" in
launch.json in order to run and debug
- The two dot files (i.e,
swap.ll.icfg.dotandswap.ll.pag.dot) will be generated under the/home/SVF-tools/Software-Analysis-Studio/CodeGraphfolder

- Open the dot file under, for example,
/home/SVF-tools/Software-Analysis-Studio/CodeGraph/swap.ll.icfg.dotwhich is the ICFG of the program and call out the command palette

- Enter
Graphvizand select `Interactive Preview (beside)

- You will see the ICFG on the right hand side
