SVFG Read and Write - SVF-tools/SVF GitHub Wiki
The aim of SVFG read and write is to implement functions that will write a SVFG to a file and then read the SVFG back into memory from a file.
The two functions (writeToFile and readFile) are located at SVFG.cpp / SVFG.h
The current implementation is located in lukekoko's fork, under the branch SVFG-rw.
Pull request: PR
The outputted SVFG will be in the follow file format. First the SVFG nodes are written.
\_\_Nodes\_\_
SVFGNodeID: <id> >= <node type> >= MVER: {MRVERID: <id> MemRegion: pts{<pts> } MRVERSION: <version> MSSADef: <version>, pts{<pts> }} >= ICFGNodeID: <id>
After the SVFG nodes are written, the SVFG edges are written.
\_\_Edges\_\_
srcSVFGNodeID: <id> => dstSVFGNodeID: <id> >= <edge type> | MVER: {MRVERID: <id> MemRegion: pts{<pts> } MRVERSION: <version> MSSADef: <version>, pts{<pts> }}
To test we are using the diff test cases in the Test-Suite. The following lines in CMakeLists.txt are the testcases for SVFG. SVFG testcases. We are also testing on crux-bc files Crux bc testcases.
The current implementation is failing on the crux-bc dc.bc file. (Link to CI/CD failing test).
- Clone the Test-Suite into the root of SVF
- Run ./build.sh debug
- cd into Debug-build
- Run ctest
The following configuration is for running a SVFG write and read using VSCode's debugging.
{
    "name": "svfg write to file",
    "type": "cppdbg",
    "request": "launch",
    "program": "${workspaceFolder}/Debug-build/bin/wpa",
    "args": ["-fspta", "--write-svfg=svf.txt", "../../Test-Suite/test_cases_bc/crux-bc/dc.bc"],
    "stopAtEntry": false,
    "cwd": "${workspaceFolder}/Debug-build/bin",
    "environment": [],
    "externalConsole": false,
    "MIMode": "gdb",
    "setupCommands": [
        {
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
        }
    ]
},
{
    "name": "svfg read file",
    "type": "cppdbg",
    "request": "launch",
    "program": "${workspaceFolder}/Debug-build/bin/wpa",
    "args": ["-fspta", "--read-svfg=svf.txt", "../../Test-Suite/test_cases_bc/crux-bc/dc.bc"],
    "stopAtEntry": false,
    "cwd": "${workspaceFolder}/Debug-build/bin",
    "environment": [],
    "externalConsole": false,
    "MIMode": "gdb",
    "setupCommands": [
        {
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
        }
    ]
},