-
Notifications
You must be signed in to change notification settings - Fork 472
Graph db final v5 #1764
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
base: master
Are you sure you want to change the base?
Graph db final v5 #1764
Conversation
- add ICFG edges & nodes to graoh db [tested] add options update callgraph & icfg insert method addSVFTypeNode2db[tested] add struInfo2db [tested] fix ICFGNode err [tested] update SVFFunctionType (add params_types_vec to the node) - add PAGNode & PAGEdge to db [tested] - fixed cross join gql [tested] update bbGraph Insertion [tested] update bb insertion [tested] update bbEdge insertion [tested]
- read SVFType from db - init PAGNode from db - read SVFBBGraph from db - read ICFG from db read ICFG edge from db [tested & checked] - read & write pag edge [tested] - fixed stat err
- rename graphdb related function name refactoring node/edge db insertStmt update ICFGNodes attrubuites
update
update
update update update test ci update ci update ci update ci update ci updtae ci update update graphDBClient and cmake configuration update clean db client clean code update
reslove confilt
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1764 +/- ##
==========================================
+ Coverage 64.00% 64.03% +0.02%
==========================================
Files 244 243 -1
Lines 24454 24541 +87
Branches 4611 4612 +1
==========================================
+ Hits 15653 15716 +63
- Misses 8801 8825 +24
🚀 New features to boost your workflow:
|
| /** | ||
| * set the call edge lanbel counter for the new statements, this is used when loading statements from DB | ||
| */ | ||
| inline void setCallEdgeLabelCounter(u64_t counter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the below counter methods? I thought this is done during each edge adding?
| static inline const Inst2LabelMap* getInst2LabelMap() | ||
| { | ||
| return &inst2LabelMap; | ||
| } | ||
|
|
||
| static inline const Var2LabelMap* getVar2LabelMap() | ||
| { | ||
| return &var2LabelMap; | ||
| } | ||
|
|
||
| static inline const u64_t* getCallEdgeLabelCounter() | ||
| { | ||
| return &callEdgeLabelCounter; | ||
| } | ||
|
|
||
| static inline const u64_t* getStoreEdgeLabelCounter() | ||
| { | ||
| return &storeEdgeLabelCounter; | ||
| } | ||
|
|
||
| static inline const u64_t* getMultiOpndLabelCounter() | ||
| { | ||
| return &multiOpndLabelCounter; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we return references rather than pointers? Also the counter methods look very odd to me.
| } | ||
|
|
||
| __attribute__((weak)) | ||
| const bool SVFValue::hasLLVMValue() const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a real implementation in the front-end, in case it won't always crash here.
| CallPE::CallPE(SVFVar* s, SVFVar* d, GEdgeFlag k, EdgeID eid, SVFVar* value, ICFGNode* icfgNode, const CallICFGNode* call, | ||
| const FunEntryICFGNode* entry): AssignStmt(s, d, k, eid, value, icfgNode), call(call), entry(entry) | ||
| { | ||
|
|
||
| } | ||
|
|
||
| RetPE::RetPE(SVFVar* s, SVFVar* d, const CallICFGNode* i, | ||
| const FunExitICFGNode* e, GEdgeKind k) | ||
| : AssignStmt(s, d, makeEdgeFlagWithCallInst(k, i)), call(i), exit(e) | ||
| { | ||
| } | ||
|
|
||
| RetPE::RetPE(SVFVar* s, SVFVar* d, GEdgeFlag k, EdgeID eid, SVFVar* value, ICFGNode* icfgNode, const CallICFGNode* call, | ||
| const FunExitICFGNode* exit): AssignStmt(s, d, k, eid, value, icfgNode), call(call), exit(exit) {} | ||
|
|
||
| MultiOpndStmt::MultiOpndStmt(SVFVar* r, const OPVars& opnds, GEdgeFlag k) | ||
| : SVFStmt(opnds.at(0), r, k), opVars(opnds) | ||
| { | ||
| } | ||
|
|
||
| CmpStmt::CmpStmt(SVFVar* s, const OPVars& opnds, u32_t pre) | ||
| : MultiOpndStmt(s, opnds, | ||
| makeEdgeFlagWithAddionalOpnd(SVFStmt::Cmp, opnds.at(1))), | ||
| predicate(pre) | ||
| { | ||
| assert(opnds.size() == 2 && "CmpStmt can only have two operands!"); | ||
| } | ||
|
|
||
| CmpStmt::CmpStmt(SVFVar* s, SVFVar* d, GEdgeFlag k, EdgeID eid, SVFVar* value, u32_t predicate, ICFGNode* icfgNode, const OPVars& opnds) | ||
| : MultiOpndStmt(s, d, k, eid, value, icfgNode, opnds), predicate(predicate) | ||
| { | ||
| assert(opnds.size() == 2 && "CmpStmt can only have two operands!"); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All new methods for GraphDB go to protected.
| } | ||
| } | ||
|
|
||
| SVFStmt::SVFStmt(SVFVar* s, SVFVar* d, GEdgeFlag k, EdgeID eid, SVFVar* value, ICFGNode* icfgNode, bool real) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this only for GraphDB, put it under protected if it is not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this protected constructor.
| && "this node should not be created before"); | ||
| GepValObjMap[curInst][std::make_pair(base, ap)] = i; | ||
| GepValVar *node = new GepValVar(baseVar, i, ap, type, icn); | ||
| node->setLLVMVarInstID(curInst); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to set the instruction here?
| if (success) | ||
| { | ||
| outs() << sucMsg("\t SUCCESS :") << funName << " check <src id:" << source->getId() | ||
| if ((getSrcCSID(source))->hasLLVMValue()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to have this hasLLVMValue()?
| } | ||
| } | ||
|
|
||
| void CallGraph::addIndirectCallGraphEdge(CallGraphEdge* cgEdge) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this method if it is the same as addEdge?
| u32_t argNo; | ||
|
|
||
| protected: | ||
| ArgValVar(NodeID i, const SVFType* type, u32_t argNo, PNODEK ty = ArgValNode) : ValVar(i, type, ty), argNo(argNo) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to revisit many of the protected constructors you added, in fact you could reuse the existing constructors by passing null for some arguments.
| friend class GraphDBClient; | ||
|
|
||
| protected: | ||
| IntraICFGNode(NodeID id, const SVFBasicBlock* b, const FunObjVar* f, bool isReturn): ICFGNode(id, IntraBlock),isRet(isReturn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this new constructor. Could we reuse the exisitng one? Why we need to pass funobjvar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to revisit the constructors you added for other classes.
No description provided.