forked from SVF-tools/SVF
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
064d65b
commit efa0055
Showing
17 changed files
with
223 additions
and
410 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
add_llvm_executable(ae ae.cpp) | ||
target_link_libraries(ae PUBLIC ${llvm_libs} ${NEO4J_CLIENT_LIBRARIES} SvfLLVM) | ||
target_link_libraries(ae PUBLIC ${llvm_libs} ${LGRAPH_CPP_CLIENT_LIBRARIES} SvfLLVM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
add_llvm_executable(cfl cfl.cpp) | ||
target_link_libraries(cfl PUBLIC ${llvm_libs} ${NEO4J_CLIENT_LIBRARIES} SvfLLVM ) | ||
target_link_libraries(cfl PUBLIC ${llvm_libs} ${LGRAPH_CPP_CLIENT_LIBRARIES} SvfLLVM ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
add_llvm_executable(dvf dda.cpp) | ||
target_link_libraries(dvf PUBLIC ${llvm_libs} ${NEO4J_CLIENT_LIBRARIES} SvfLLVM) | ||
target_link_libraries(dvf PUBLIC ${llvm_libs} ${LGRAPH_CPP_CLIENT_LIBRARIES} SvfLLVM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
add_llvm_executable(svf-ex svf-ex.cpp) | ||
target_link_libraries(svf-ex PUBLIC ${llvm_libs} ${NEO4J_CLIENT_LIBRARIES} SvfLLVM) | ||
target_link_libraries(svf-ex PUBLIC ${llvm_libs} ${LGRAPH_CPP_CLIENT_LIBRARIES} SvfLLVM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
add_llvm_executable(llvm2svf llvm2svf.cpp) | ||
target_link_libraries(llvm2svf PUBLIC ${llvm_libs} ${NEO4J_CLIENT_LIBRARIES} SvfLLVM) | ||
target_link_libraries(llvm2svf PUBLIC ${llvm_libs} ${LGRAPH_CPP_CLIENT_LIBRARIES} SvfLLVM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
add_llvm_executable(mta mta.cpp) | ||
target_link_libraries(mta PUBLIC ${llvm_libs} ${NEO4J_CLIENT_LIBRARIES} SvfLLVM) | ||
target_link_libraries(mta PUBLIC ${llvm_libs} ${LGRAPH_CPP_CLIENT_LIBRARIES} SvfLLVM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
add_llvm_executable(saber saber.cpp) | ||
target_link_libraries(saber PUBLIC ${llvm_libs} ${NEO4J_CLIENT_LIBRARIES} SvfLLVM) | ||
target_link_libraries(saber PUBLIC ${llvm_libs} ${LGRAPH_CPP_CLIENT_LIBRARIES} SvfLLVM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,61 @@ | ||
#ifndef INCLUDE_GRAPHDBCLIENT_H_ | ||
#define INCLUDE_GRAPHDBCLIENT_H_ | ||
#include <neo4j-client.h> | ||
#include "Util/SVFUtil.h" | ||
|
||
#include "lgraph/lgraph_rpc_client.h" | ||
#include <errno.h> | ||
#include <stdio.h> | ||
#include "Graphs/CallGraph.h" | ||
|
||
namespace SVF | ||
{ | ||
class GraphDBClient{ | ||
private: | ||
neo4j_connection_t* connection; | ||
|
||
GraphDBClient() | ||
{ | ||
const char* uri = "bolt://localhost:7687"; | ||
neo4j_config_t* config = neo4j_new_config(); | ||
if (neo4j_config_set_username(config, "admin") != 0 && | ||
neo4j_config_set_password(config, "73@TuGraph") != 0){ | ||
SVFUtil::outs() << "Failed to connect to GraphDB.\n"; | ||
} else { | ||
connection = neo4j_connect(uri, config, NEO4J_INSECURE); | ||
if (connection == nullptr) { | ||
SVFUtil::outs() << "Failed to connect to GraphDB.\n"; | ||
} else { | ||
SVFUtil::outs() << "Connected to GraphDB successfully.\n"; | ||
} | ||
} | ||
|
||
} | ||
|
||
~GraphDBClient() | ||
{ | ||
if (connection != nullptr) | ||
{ | ||
if (neo4j_close(connection) !=0){ | ||
SVFUtil::outs() << "Failed to close GraphDB.\n"; | ||
} else { | ||
SVFUtil::outs() << "GraphDB connection closed.\n"; | ||
connection = nullptr; | ||
} | ||
} | ||
} | ||
public: | ||
static GraphDBClient& getInstance() | ||
{ | ||
static GraphDBClient instance; | ||
return instance; | ||
} | ||
|
||
GraphDBClient(const GraphDBClient&) = delete; | ||
GraphDBClient& operator = (const GraphDBClient&) = delete; | ||
|
||
neo4j_connection_t* getConnection() | ||
{ | ||
return connection; | ||
} | ||
|
||
void loadSchema(neo4j_connection_t* connection, const std::string& filepath, const std::string& queryParam); | ||
}; | ||
|
||
} | ||
|
||
#endif | ||
class RpcClient; | ||
class CallGraphEdge; | ||
class CallGraphNode; | ||
class GraphDBClient | ||
{ | ||
private: | ||
lgraph::RpcClient* connection; | ||
|
||
GraphDBClient() | ||
{ | ||
const char* url = "127.0.0.1:9090"; | ||
connection = new lgraph::RpcClient(url, "admin", "73@TuGraph"); | ||
} | ||
|
||
~GraphDBClient() | ||
{ | ||
if (connection != nullptr) | ||
{ | ||
connection = nullptr; | ||
} | ||
} | ||
|
||
public: | ||
static GraphDBClient& getInstance() | ||
{ | ||
static GraphDBClient instance; | ||
return instance; | ||
} | ||
|
||
GraphDBClient(const GraphDBClient&) = delete; | ||
GraphDBClient& operator=(const GraphDBClient&) = delete; | ||
|
||
lgraph::RpcClient* getConnection() | ||
{ | ||
return connection; | ||
} | ||
|
||
bool loadSchema(lgraph::RpcClient* connection, const std::string& filepath, | ||
const std::string& dbname); | ||
bool addCallGraphNode2db(lgraph::RpcClient* connection, const CallGraphNode* node, | ||
const std::string& dbname); | ||
bool addCallGraphEdge2db(lgraph::RpcClient* connection, | ||
const CallGraphEdge* edge, const int& csid, | ||
const std::string& dbname); | ||
// pasre the directcallsIds/indirectcallsIds string to vector | ||
std::vector<int> stringToIds(const std::string& str); | ||
}; | ||
|
||
} // namespace SVF | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.