Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ae convert CFBBG to ICFG #1384

Merged
merged 9 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add AE-ICFG
  • Loading branch information
bjjwwang committed Feb 20, 2024
commit e1d69218572695dffec56cfa5024b1b859da2778
3 changes: 3 additions & 0 deletions svf-llvm/tools/AE-ICFG/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
add_llvm_executable(ae2 ae_icfg.cpp)
target_link_libraries(ae2 PUBLIC ${llvm_libs} SvfLLVM)

75 changes: 75 additions & 0 deletions svf-llvm/tools/AE-ICFG/ae_icfg.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
//===- ae.cpp -- Abstract Execution -------------------------------------//
//
// SVF: Static Value-Flow Analysis
//
// Copyright (C) <2013-2017> <Yulei Sui>
//

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.

// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//===-----------------------------------------------------------------------===//

/*
// Abstract Execution
//
// Author: Jiawei Wang, Xiao Cheng, Jiawei Yang, Jiawei Ren, Yulei Sui
*/
#include "SVF-LLVM/SVFIRBuilder.h"
#include "WPA/WPAPass.h"
#include "Util/CommandLine.h"
#include "Util/Options.h"

#include "AE/Svfexe/AbstractExecutionICFG.h"
#include "AE/Core/RelExeState.h"
#include "AE/Core/RelationSolver.h"

using namespace SVF;
using namespace SVFUtil;


int main(int argc, char** argv)
{
int arg_num = 0;
int extraArgc = 3;
char **arg_value = new char *[argc + extraArgc];
for (; arg_num < argc; ++arg_num)
{
arg_value[arg_num] = argv[arg_num];
}
// add extra options
int orgArgNum = arg_num;
arg_value[arg_num++] = (char*) "-model-consts=true";
arg_value[arg_num++] = (char*) "-model-arrays=true";
arg_value[arg_num++] = (char*) "-pre-field-sensitive=false";
assert(arg_num == (orgArgNum + extraArgc) && "more extra arguments? Change the value of extraArgc");

std::vector<std::string> moduleNameVec;
moduleNameVec = OptionBase::parseOptions(
arg_num, arg_value, "Static Symbolic Execution", "[options] <input-bitcode...>"
);
delete[] arg_value;
SVFModule *svfModule = LLVMModuleSet::getLLVMModuleSet()->buildSVFModule(moduleNameVec);
SVFIRBuilder builder(svfModule);
SVFIR* pag = builder.build();
AndersenWaveDiff* ander = AndersenWaveDiff::createAndersenWaveDiff(pag);
PTACallGraph* callgraph = ander->getPTACallGraph();
builder.updateCallGraph(callgraph);
AbstractExecutionICFG ae;
ae.initExtAPI();
ae.runOnModule(pag);

LLVMModuleSet::releaseLLVMModuleSet();

return 0;
}
1 change: 1 addition & 0 deletions svf-llvm/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ add_subdirectory(MTA)
add_subdirectory(CFL)
add_subdirectory(LLVM2SVF)
add_subdirectory(AE)
add_subdirectory(AE-ICFG)

set_target_properties(
cfl dvf svf-ex llvm2svf mta saber wpa ae
Expand Down
Loading