svf-lib 1.0.2086 → 1.0.2088
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SVF-linux/Release-build/bin/ae +0 -0
- package/SVF-linux/Release-build/bin/cfl +0 -0
- package/SVF-linux/Release-build/bin/dvf +0 -0
- package/SVF-linux/Release-build/bin/llvm2svf +0 -0
- package/SVF-linux/Release-build/bin/mta +0 -0
- package/SVF-linux/Release-build/bin/saber +0 -0
- package/SVF-linux/Release-build/bin/svf-ex +0 -0
- package/SVF-linux/Release-build/bin/wpa +0 -0
- package/SVF-linux/Release-build/include/Graphs/ICFG.h +9 -0
- package/SVF-linux/Release-build/include/MSSA/MemRegion.h +2 -2
- package/SVF-linux/Release-build/include/MTA/MHP.h +1 -2
- package/SVF-linux/Release-build/include/SVF-LLVM/ICFGBuilder.h +16 -6
- package/SVF-linux/Release-build/include/SVF-LLVM/LLVMUtil.h +11 -0
- package/SVF-linux/Release-build/include/SVF-LLVM/SVFIRBuilder.h +2 -2
- package/SVF-linux/Release-build/include/SVFIR/SVFIR.h +1 -1
- package/SVF-linux/Release-build/include/SVFIR/SVFStatements.h +1 -1
- package/SVF-linux/Release-build/include/SVFIR/SVFValue.h +21 -16
- package/SVF-linux/Release-build/include/Util/SVFUtil.h +19 -17
- package/SVF-linux/Release-build/lib/libSvfCore.a +0 -0
- package/SVF-linux/Release-build/lib/libSvfLLVM.a +0 -0
- package/SVF-osx/Release-build/bin/ae +0 -0
- package/SVF-osx/Release-build/bin/cfl +0 -0
- package/SVF-osx/Release-build/bin/dvf +0 -0
- package/SVF-osx/Release-build/bin/llvm2svf +0 -0
- package/SVF-osx/Release-build/bin/mta +0 -0
- package/SVF-osx/Release-build/bin/saber +0 -0
- package/SVF-osx/Release-build/bin/svf-ex +0 -0
- package/SVF-osx/Release-build/bin/wpa +0 -0
- package/SVF-osx/Release-build/include/AE/Svfexe/AEDetector.h +1 -13
- package/SVF-osx/Release-build/include/Graphs/ICFGNode.h +33 -0
- package/SVF-osx/Release-build/include/Graphs/VFGNode.h +0 -6
- package/SVF-osx/Release-build/include/MTA/LockAnalysis.h +1 -1
- package/SVF-osx/Release-build/include/MTA/TCT.h +1 -10
- package/SVF-osx/Release-build/include/SABER/SaberCondAllocator.h +5 -5
- package/SVF-osx/Release-build/include/Util/SVFBugReport.h +2 -2
- package/SVF-osx/Release-build/include/Util/SVFUtil.h +6 -1
- package/SVF-osx/Release-build/lib/libSvfCore.a +0 -0
- package/SVF-osx/Release-build/lib/libSvfLLVM.a +0 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -198,12 +198,21 @@ public:
|
|
|
198
198
|
//@{
|
|
199
199
|
ICFGNode* getICFGNode(const SVFInstruction* inst);
|
|
200
200
|
|
|
201
|
+
/// Whether has the ICFGNode
|
|
202
|
+
bool hasICFGNode(const SVFInstruction* inst);
|
|
203
|
+
|
|
201
204
|
CallICFGNode* getCallICFGNode(const SVFInstruction* inst);
|
|
202
205
|
|
|
206
|
+
CallICFGNode* addCallICFGNode(const SVFInstruction* inst);
|
|
207
|
+
|
|
203
208
|
RetICFGNode* getRetICFGNode(const SVFInstruction* inst);
|
|
204
209
|
|
|
210
|
+
RetICFGNode* addRetICFGNode(const SVFInstruction* inst);
|
|
211
|
+
|
|
205
212
|
IntraICFGNode* getIntraICFGNode(const SVFInstruction* inst);
|
|
206
213
|
|
|
214
|
+
IntraICFGNode* addIntraICFGNode(const SVFInstruction* inst);
|
|
215
|
+
|
|
207
216
|
FunEntryICFGNode* getFunEntryICFGNode(const SVFFunction* fun);
|
|
208
217
|
|
|
209
218
|
FunExitICFGNode* getFunExitICFGNode(const SVFFunction* fun);
|
|
@@ -470,9 +470,9 @@ public:
|
|
|
470
470
|
}
|
|
471
471
|
//@}
|
|
472
472
|
/// Whether this instruction has SVFIR Edge
|
|
473
|
-
bool hasSVFStmtList(const
|
|
473
|
+
bool hasSVFStmtList(const ICFGNode* icfgNode);
|
|
474
474
|
/// Given an instruction, get all its the PAGEdge (statement) in sequence
|
|
475
|
-
SVFStmtList& getPAGEdgesFromInst(const
|
|
475
|
+
SVFStmtList& getPAGEdgesFromInst(const ICFGNode* node);
|
|
476
476
|
|
|
477
477
|
/// getModRefInfo APIs
|
|
478
478
|
//@{
|
|
@@ -341,8 +341,7 @@ public:
|
|
|
341
341
|
NodeID parentTid = tct->getParentThread(tid);
|
|
342
342
|
const CxtThread& parentct = tct->getTCTNode(parentTid)->getCxtThread();
|
|
343
343
|
const SVFFunction* parentRoutine = tct->getStartRoutineOfCxtThread(parentct);
|
|
344
|
-
|
|
345
|
-
return tct->getICFGNode(inst);
|
|
344
|
+
return parentRoutine->getExitBB()->back();
|
|
346
345
|
}
|
|
347
346
|
|
|
348
347
|
/// Get loop for join site
|
|
@@ -62,23 +62,30 @@ private:
|
|
|
62
62
|
///@{
|
|
63
63
|
void processFunEntry(const Function* fun, WorkList& worklist);
|
|
64
64
|
|
|
65
|
+
void processNoPrecessorBasicBlocks(const Function* fun, WorkList& worklist);
|
|
66
|
+
|
|
65
67
|
void processFunBody(WorkList& worklist);
|
|
66
68
|
|
|
67
69
|
void processFunExit(const Function* fun);
|
|
68
70
|
//@}
|
|
69
71
|
|
|
72
|
+
void checkICFGNodesVisited(const Function* fun);
|
|
73
|
+
|
|
70
74
|
void connectGlobalToProgEntry(SVFModule* svfModule);
|
|
71
75
|
|
|
72
76
|
/// Add/Get an inter block ICFGNode
|
|
73
|
-
InterICFGNode*
|
|
77
|
+
InterICFGNode* addInterBlockICFGNode(const SVFInstruction* inst);
|
|
74
78
|
|
|
75
79
|
/// Add/Get a basic block ICFGNode
|
|
76
|
-
inline ICFGNode*
|
|
80
|
+
inline ICFGNode* addBlockICFGNode(const SVFInstruction* inst)
|
|
77
81
|
{
|
|
82
|
+
ICFGNode* node;
|
|
78
83
|
if(SVFUtil::isNonInstricCallSite(inst))
|
|
79
|
-
|
|
84
|
+
node = addInterBlockICFGNode(inst);
|
|
80
85
|
else
|
|
81
|
-
|
|
86
|
+
node = addIntraBlockICFGNode(inst);
|
|
87
|
+
const_cast<SVFBasicBlock*>(inst->getParent())->addICFGNode(node);
|
|
88
|
+
return node;
|
|
82
89
|
}
|
|
83
90
|
|
|
84
91
|
/// Create edges between ICFG nodes across functions
|
|
@@ -96,10 +103,13 @@ private:
|
|
|
96
103
|
}
|
|
97
104
|
|
|
98
105
|
/// Add and get IntraBlock ICFGNode
|
|
99
|
-
IntraICFGNode*
|
|
106
|
+
IntraICFGNode* addIntraBlockICFGNode(const SVFInstruction* inst)
|
|
100
107
|
{
|
|
101
|
-
return icfg->
|
|
108
|
+
return icfg->addIntraICFGNode(inst);
|
|
102
109
|
}
|
|
110
|
+
|
|
111
|
+
private:
|
|
112
|
+
BBSet visited;
|
|
103
113
|
};
|
|
104
114
|
|
|
105
115
|
} // End namespace SVF
|
|
@@ -303,6 +303,17 @@ void getNextInsts(const Instruction* curInst,
|
|
|
303
303
|
void getPrevInsts(const Instruction* curInst,
|
|
304
304
|
std::vector<const Instruction*>& instList);
|
|
305
305
|
|
|
306
|
+
/// Basic block does not have predecessors
|
|
307
|
+
/// map-1.cpp.bc
|
|
308
|
+
/// try.cont: ; No predecessors!
|
|
309
|
+
/// call void @llvm.trap()
|
|
310
|
+
/// unreachable
|
|
311
|
+
inline bool isNoPrecessorBasicBlock(const BasicBlock* bb)
|
|
312
|
+
{
|
|
313
|
+
return bb != &bb->getParent()->getEntryBlock() &&
|
|
314
|
+
pred_empty(bb);
|
|
315
|
+
}
|
|
316
|
+
|
|
306
317
|
/// Get num of BB's predecessors
|
|
307
318
|
u32_t getBBPredecessorNum(const BasicBlock* BB);
|
|
308
319
|
|
|
@@ -450,9 +450,9 @@ protected:
|
|
|
450
450
|
/// Add Store edge
|
|
451
451
|
inline void addStoreEdge(NodeID src, NodeID dst)
|
|
452
452
|
{
|
|
453
|
-
|
|
453
|
+
ICFGNode* node;
|
|
454
454
|
if (const SVFInstruction* inst = SVFUtil::dyn_cast<SVFInstruction>(curVal))
|
|
455
|
-
node = pag->getICFG()->
|
|
455
|
+
node = pag->getICFG()->getICFGNode(inst);
|
|
456
456
|
else
|
|
457
457
|
node = nullptr;
|
|
458
458
|
if (StoreStmt* edge = pag->addStoreStmt(src, dst, node))
|
|
@@ -658,7 +658,7 @@ private:
|
|
|
658
658
|
/// Add Load edge
|
|
659
659
|
LoadStmt* addLoadStmt(NodeID src, NodeID dst);
|
|
660
660
|
/// Add Store edge
|
|
661
|
-
StoreStmt* addStoreStmt(NodeID src, NodeID dst, const
|
|
661
|
+
StoreStmt* addStoreStmt(NodeID src, NodeID dst, const ICFGNode* val);
|
|
662
662
|
/// Add Call edge
|
|
663
663
|
CallPE* addCallPE(NodeID src, NodeID dst, const CallICFGNode* cs,
|
|
664
664
|
const FunEntryICFGNode* entry);
|
|
@@ -524,6 +524,8 @@ public:
|
|
|
524
524
|
}
|
|
525
525
|
};
|
|
526
526
|
|
|
527
|
+
class ICFGNode;
|
|
528
|
+
|
|
527
529
|
class SVFBasicBlock : public SVFValue
|
|
528
530
|
{
|
|
529
531
|
friend class LLVMModuleSet;
|
|
@@ -531,21 +533,26 @@ class SVFBasicBlock : public SVFValue
|
|
|
531
533
|
friend class SVFIRReader;
|
|
532
534
|
friend class SVFIRBuilder;
|
|
533
535
|
friend class SVFFunction;
|
|
536
|
+
friend class ICFGBuilder;
|
|
537
|
+
friend class ICFG;
|
|
534
538
|
|
|
535
539
|
public:
|
|
536
|
-
typedef std::vector<const
|
|
540
|
+
typedef std::vector<const ICFGNode*>::const_iterator const_iterator;
|
|
537
541
|
|
|
538
542
|
private:
|
|
539
|
-
std::vector<const
|
|
543
|
+
std::vector<const ICFGNode*> allICFGNodes; ///< all ICFGNodes in this BasicBlock
|
|
540
544
|
std::vector<const SVFBasicBlock*> succBBs; ///< all successor BasicBlocks of this BasicBlock
|
|
541
545
|
std::vector<const SVFBasicBlock*> predBBs; ///< all predecessor BasicBlocks of this BasicBlock
|
|
542
546
|
const SVFFunction* fun; /// Function where this BasicBlock is
|
|
543
547
|
|
|
544
548
|
protected:
|
|
545
549
|
///@{ attributes to be set only through Module builders e.g., LLVMModule
|
|
546
|
-
|
|
550
|
+
|
|
551
|
+
inline void addICFGNode(const ICFGNode* icfgNode)
|
|
547
552
|
{
|
|
548
|
-
|
|
553
|
+
assert(std::find(getICFGNodeList().begin(), getICFGNodeList().end(),
|
|
554
|
+
icfgNode) == getICFGNodeList().end() && "duplicated icfgnode");
|
|
555
|
+
allICFGNodes.push_back(icfgNode);
|
|
549
556
|
}
|
|
550
557
|
|
|
551
558
|
inline void addSuccBasicBlock(const SVFBasicBlock* succ)
|
|
@@ -570,19 +577,19 @@ public:
|
|
|
570
577
|
return node->getKind() == SVFBB;
|
|
571
578
|
}
|
|
572
579
|
|
|
573
|
-
inline const std::vector<const
|
|
580
|
+
inline const std::vector<const ICFGNode*>& getICFGNodeList() const
|
|
574
581
|
{
|
|
575
|
-
return
|
|
582
|
+
return allICFGNodes;
|
|
576
583
|
}
|
|
577
584
|
|
|
578
585
|
inline const_iterator begin() const
|
|
579
586
|
{
|
|
580
|
-
return
|
|
587
|
+
return allICFGNodes.begin();
|
|
581
588
|
}
|
|
582
589
|
|
|
583
590
|
inline const_iterator end() const
|
|
584
591
|
{
|
|
585
|
-
return
|
|
592
|
+
return allICFGNodes.end();
|
|
586
593
|
}
|
|
587
594
|
|
|
588
595
|
inline const SVFFunction* getParent() const
|
|
@@ -595,20 +602,18 @@ public:
|
|
|
595
602
|
return fun;
|
|
596
603
|
}
|
|
597
604
|
|
|
598
|
-
inline const
|
|
605
|
+
inline const ICFGNode* front() const
|
|
599
606
|
{
|
|
600
|
-
|
|
607
|
+
assert(!allICFGNodes.empty() && "bb empty?");
|
|
608
|
+
return allICFGNodes.front();
|
|
601
609
|
}
|
|
602
610
|
|
|
603
|
-
inline const
|
|
611
|
+
inline const ICFGNode* back() const
|
|
604
612
|
{
|
|
605
|
-
|
|
613
|
+
assert(!allICFGNodes.empty() && "bb empty?");
|
|
614
|
+
return allICFGNodes.back();
|
|
606
615
|
}
|
|
607
616
|
|
|
608
|
-
/// Returns the terminator instruction if the block is well formed or null
|
|
609
|
-
/// if the block is not well formed.
|
|
610
|
-
const SVFInstruction* getTerminator() const;
|
|
611
|
-
|
|
612
617
|
inline const std::vector<const SVFBasicBlock*>& getSuccessors() const
|
|
613
618
|
{
|
|
614
619
|
return succBBs;
|
|
@@ -168,6 +168,8 @@ void dumpPointsToList(const PointsToList& ptl);
|
|
|
168
168
|
|
|
169
169
|
/// Return true if it is an llvm intrinsic instruction
|
|
170
170
|
bool isIntrinsicInst(const SVFInstruction* inst);
|
|
171
|
+
bool isIntrinsicInst(const ICFGNode* inst);
|
|
172
|
+
|
|
171
173
|
//@}
|
|
172
174
|
|
|
173
175
|
/// Whether an instruction is a call or invoke instruction
|
|
@@ -184,6 +186,10 @@ inline bool isCallSite(const SVFValue* val)
|
|
|
184
186
|
return false;
|
|
185
187
|
}
|
|
186
188
|
|
|
189
|
+
bool isCallSite(const ICFGNode* inst);
|
|
190
|
+
|
|
191
|
+
bool isRetInstNode(const ICFGNode* node);
|
|
192
|
+
|
|
187
193
|
/// Whether an instruction is a callsite in the application code, excluding llvm intrinsic calls
|
|
188
194
|
inline bool isNonInstricCallSite(const SVFInstruction* inst)
|
|
189
195
|
{
|
|
@@ -192,6 +198,14 @@ inline bool isNonInstricCallSite(const SVFInstruction* inst)
|
|
|
192
198
|
return isCallSite(inst);
|
|
193
199
|
}
|
|
194
200
|
|
|
201
|
+
/// Whether an instruction is a callsite in the application code, excluding llvm intrinsic calls
|
|
202
|
+
inline bool isNonInstricCallSite(const ICFGNode* inst)
|
|
203
|
+
{
|
|
204
|
+
if(isIntrinsicInst(inst))
|
|
205
|
+
return false;
|
|
206
|
+
return isCallSite(inst);
|
|
207
|
+
}
|
|
208
|
+
|
|
195
209
|
/// Return LLVM callsite given an instruction
|
|
196
210
|
inline CallSite getSVFCallSite(const SVFInstruction* inst)
|
|
197
211
|
{
|
|
@@ -250,6 +264,8 @@ inline const SVFFunction* getCallee(const SVFInstruction *inst)
|
|
|
250
264
|
CallSite cs(inst);
|
|
251
265
|
return getCallee(cs);
|
|
252
266
|
}
|
|
267
|
+
|
|
268
|
+
const SVFFunction* getCallee(const ICFGNode *inst);
|
|
253
269
|
//@}
|
|
254
270
|
|
|
255
271
|
/// Given a map mapping points-to sets to a count, adds from into to.
|
|
@@ -402,27 +418,20 @@ inline bool isArgOfUncalledFunction(const SVFValue* svfval)
|
|
|
402
418
|
|
|
403
419
|
/// Return thread fork function
|
|
404
420
|
//@{
|
|
405
|
-
inline const SVFValue* getForkedFun(const CallSite cs)
|
|
406
|
-
{
|
|
407
|
-
return ThreadAPI::getThreadAPI()->getForkedFun(cs.getInstruction());
|
|
408
|
-
}
|
|
409
421
|
inline const SVFValue* getForkedFun(const SVFInstruction *inst)
|
|
410
422
|
{
|
|
411
423
|
return ThreadAPI::getThreadAPI()->getForkedFun(inst);
|
|
412
424
|
}
|
|
413
425
|
//@}
|
|
414
426
|
|
|
415
|
-
/// This function servers a allocation wrapper detector
|
|
416
|
-
inline bool isAnAllocationWraper(const SVFInstruction*)
|
|
417
|
-
{
|
|
418
|
-
return false;
|
|
419
|
-
}
|
|
420
427
|
|
|
421
428
|
inline bool isExtCall(const CallSite cs)
|
|
422
429
|
{
|
|
423
430
|
return isExtCall(getCallee(cs));
|
|
424
431
|
}
|
|
425
432
|
|
|
433
|
+
bool isExtCall(const ICFGNode* node);
|
|
434
|
+
|
|
426
435
|
inline bool isExtCall(const SVFInstruction *inst)
|
|
427
436
|
{
|
|
428
437
|
return isExtCall(getCallee(inst));
|
|
@@ -451,10 +460,7 @@ inline bool isHeapAllocExtCallViaRet(const SVFInstruction *inst)
|
|
|
451
460
|
return isPtrTy && isHeapAllocExtFunViaRet(getCallee(inst));
|
|
452
461
|
}
|
|
453
462
|
|
|
454
|
-
|
|
455
|
-
{
|
|
456
|
-
return isHeapAllocExtCallViaRet(cs) || isHeapAllocExtCallViaArg(cs);
|
|
457
|
-
}
|
|
463
|
+
bool isHeapAllocExtCall(const ICFGNode* cs);
|
|
458
464
|
|
|
459
465
|
inline bool isHeapAllocExtCall(const SVFInstruction *inst)
|
|
460
466
|
{
|
|
@@ -477,10 +483,6 @@ inline bool isReallocExtCall(const CallSite cs)
|
|
|
477
483
|
|
|
478
484
|
/// Return true if this is a thread creation call
|
|
479
485
|
///@{
|
|
480
|
-
inline bool isThreadForkCall(const CallSite cs)
|
|
481
|
-
{
|
|
482
|
-
return ThreadAPI::getThreadAPI()->isTDFork(cs.getInstruction());
|
|
483
|
-
}
|
|
484
486
|
inline bool isThreadForkCall(const SVFInstruction *inst)
|
|
485
487
|
{
|
|
486
488
|
return ThreadAPI::getThreadAPI()->isTDFork(inst);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -218,21 +218,9 @@ public:
|
|
|
218
218
|
*/
|
|
219
219
|
void addBugToReporter(const AEException& e, const ICFGNode* node)
|
|
220
220
|
{
|
|
221
|
-
const SVFInstruction* inst = nullptr;
|
|
222
|
-
|
|
223
|
-
// Determine the instruction associated with the ICFG node
|
|
224
|
-
if (const CallICFGNode* call = SVFUtil::dyn_cast<CallICFGNode>(node))
|
|
225
|
-
{
|
|
226
|
-
inst = call->getCallSite(); // If the node is a call node, get the call site instruction
|
|
227
|
-
}
|
|
228
|
-
else
|
|
229
|
-
{
|
|
230
|
-
inst = node->getSVFStmts().back()->getInst(); // Otherwise, get the last instruction of the node's
|
|
231
|
-
// statements
|
|
232
|
-
}
|
|
233
221
|
|
|
234
222
|
GenericBug::EventStack eventStack;
|
|
235
|
-
SVFBugEvent sourceInstEvent(SVFBugEvent::EventType::SourceInst,
|
|
223
|
+
SVFBugEvent sourceInstEvent(SVFBugEvent::EventType::SourceInst, node);
|
|
236
224
|
eventStack.push_back(sourceInstEvent); // Add the source instruction event to the event stack
|
|
237
225
|
|
|
238
226
|
if (eventStack.empty())
|
|
@@ -132,6 +132,8 @@ public:
|
|
|
132
132
|
|
|
133
133
|
virtual const std::string toString() const;
|
|
134
134
|
|
|
135
|
+
virtual const std::string getSourceLoc() const = 0;
|
|
136
|
+
|
|
135
137
|
void dump() const;
|
|
136
138
|
|
|
137
139
|
protected:
|
|
@@ -172,6 +174,11 @@ public:
|
|
|
172
174
|
//@}
|
|
173
175
|
|
|
174
176
|
virtual const std::string toString() const;
|
|
177
|
+
|
|
178
|
+
virtual const std::string getSourceLoc() const
|
|
179
|
+
{
|
|
180
|
+
return "Global ICFGNode";
|
|
181
|
+
}
|
|
175
182
|
};
|
|
176
183
|
|
|
177
184
|
/*!
|
|
@@ -218,6 +225,11 @@ public:
|
|
|
218
225
|
//@}
|
|
219
226
|
|
|
220
227
|
const std::string toString() const;
|
|
228
|
+
|
|
229
|
+
virtual const std::string getSourceLoc() const
|
|
230
|
+
{
|
|
231
|
+
return inst->getSourceLoc();
|
|
232
|
+
}
|
|
221
233
|
};
|
|
222
234
|
|
|
223
235
|
class InterICFGNode : public ICFGNode
|
|
@@ -252,6 +264,7 @@ public:
|
|
|
252
264
|
|| node->getNodeKind() == FunRetBlock;
|
|
253
265
|
}
|
|
254
266
|
//@}
|
|
267
|
+
virtual const std::string getSourceLoc() const = 0;
|
|
255
268
|
};
|
|
256
269
|
|
|
257
270
|
|
|
@@ -316,6 +329,11 @@ public:
|
|
|
316
329
|
//@}
|
|
317
330
|
|
|
318
331
|
const virtual std::string toString() const;
|
|
332
|
+
|
|
333
|
+
virtual const std::string getSourceLoc() const
|
|
334
|
+
{
|
|
335
|
+
return "function entry: " + fun->getSourceLoc();
|
|
336
|
+
}
|
|
319
337
|
};
|
|
320
338
|
|
|
321
339
|
/*!
|
|
@@ -377,6 +395,11 @@ public:
|
|
|
377
395
|
//@}
|
|
378
396
|
|
|
379
397
|
virtual const std::string toString() const;
|
|
398
|
+
|
|
399
|
+
virtual const std::string getSourceLoc() const
|
|
400
|
+
{
|
|
401
|
+
return "function ret: " + fun->getSourceLoc();
|
|
402
|
+
}
|
|
380
403
|
};
|
|
381
404
|
|
|
382
405
|
/*!
|
|
@@ -478,6 +501,11 @@ public:
|
|
|
478
501
|
//@}
|
|
479
502
|
|
|
480
503
|
virtual const std::string toString() const;
|
|
504
|
+
|
|
505
|
+
virtual const std::string getSourceLoc() const
|
|
506
|
+
{
|
|
507
|
+
return "CallICFGNode: " + cs->getSourceLoc();
|
|
508
|
+
}
|
|
481
509
|
};
|
|
482
510
|
|
|
483
511
|
|
|
@@ -554,6 +582,11 @@ public:
|
|
|
554
582
|
//@}
|
|
555
583
|
|
|
556
584
|
virtual const std::string toString() const;
|
|
585
|
+
|
|
586
|
+
virtual const std::string getSourceLoc() const
|
|
587
|
+
{
|
|
588
|
+
return "RetICFGNode: " + cs->getSourceLoc();
|
|
589
|
+
}
|
|
557
590
|
};
|
|
558
591
|
|
|
559
592
|
} // End namespace SVF
|
|
@@ -181,12 +181,6 @@ public:
|
|
|
181
181
|
|| node->getNodeKind() == Store
|
|
182
182
|
|| node->getNodeKind() == Load;
|
|
183
183
|
}
|
|
184
|
-
|
|
185
|
-
inline const SVFInstruction* getInst() const
|
|
186
|
-
{
|
|
187
|
-
/// should return a valid instruction unless it is a global PAGEdge
|
|
188
|
-
return pagEdge->getInst();
|
|
189
|
-
}
|
|
190
184
|
//@}
|
|
191
185
|
|
|
192
186
|
const SVFValue* getValue() const override;
|
|
@@ -339,7 +339,7 @@ private:
|
|
|
339
339
|
void handleIntra(const CxtStmt& cts);
|
|
340
340
|
|
|
341
341
|
/// Handle call relations
|
|
342
|
-
void handleCallRelation(CxtLockProc& clp, const CallGraphEdge* cgEdge,
|
|
342
|
+
void handleCallRelation(CxtLockProc& clp, const CallGraphEdge* cgEdge, const CallICFGNode* call);
|
|
343
343
|
|
|
344
344
|
/// Return true it a lock matches an unlock
|
|
345
345
|
bool isAliasedLocks(const CxtLock& cl1, const CxtLock& cl2)
|
|
@@ -167,15 +167,6 @@ public:
|
|
|
167
167
|
{
|
|
168
168
|
destroy();
|
|
169
169
|
}
|
|
170
|
-
/// Get CallICFGNode given inst
|
|
171
|
-
CallICFGNode* getCallICFGNode(const SVFInstruction* inst)
|
|
172
|
-
{
|
|
173
|
-
return pta->getICFG()->getCallICFGNode(inst);
|
|
174
|
-
}
|
|
175
|
-
const ICFGNode* getICFGNode(const SVFInstruction* inst)
|
|
176
|
-
{
|
|
177
|
-
return pta->getICFG()->getICFGNode(inst);
|
|
178
|
-
}
|
|
179
170
|
|
|
180
171
|
/// Get SVFFModule
|
|
181
172
|
SVFModule* getSVFModule() const
|
|
@@ -497,7 +488,7 @@ private:
|
|
|
497
488
|
//@}
|
|
498
489
|
|
|
499
490
|
/// Handle call relations
|
|
500
|
-
void handleCallRelation(CxtThreadProc& ctp, const CallGraphEdge* cgEdge,
|
|
491
|
+
void handleCallRelation(CxtThreadProc& ctp, const CallGraphEdge* cgEdge, const CallICFGNode* call);
|
|
501
492
|
|
|
502
493
|
/// Get or create a tct node based on CxtThread
|
|
503
494
|
//@{
|
|
@@ -49,7 +49,7 @@ class SaberCondAllocator
|
|
|
49
49
|
public:
|
|
50
50
|
|
|
51
51
|
typedef Z3Expr Condition; /// z3 condition
|
|
52
|
-
typedef Map<u32_t, const
|
|
52
|
+
typedef Map<u32_t, const ICFGNode*> IndexToTermInstMap; /// id to instruction map for z3
|
|
53
53
|
typedef Map<u32_t,Condition> CondPosMap; ///< map a branch to its Condition
|
|
54
54
|
typedef Map<const SVFBasicBlock*, CondPosMap > BBCondMap; /// map bb to a Condition
|
|
55
55
|
typedef Set<const SVFBasicBlock*> BasicBlockSet;
|
|
@@ -118,21 +118,21 @@ public:
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
/// Allocate a new condition
|
|
121
|
-
Condition newCond(const
|
|
121
|
+
Condition newCond(const ICFGNode* inst);
|
|
122
122
|
|
|
123
123
|
/// Perform path allocation
|
|
124
124
|
void allocate(const SVFModule* module);
|
|
125
125
|
|
|
126
126
|
/// Get/Set instruction based on Z3 expression id
|
|
127
127
|
//{@
|
|
128
|
-
inline const
|
|
128
|
+
inline const ICFGNode* getCondInst(u32_t id) const
|
|
129
129
|
{
|
|
130
130
|
IndexToTermInstMap::const_iterator it = idToTermInstMap.find(id);
|
|
131
131
|
assert(it != idToTermInstMap.end() && "this should be a fresh condition");
|
|
132
132
|
return it->second;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
inline void setCondInst(const Condition &condition, const
|
|
135
|
+
inline void setCondInst(const Condition &condition, const ICFGNode* inst)
|
|
136
136
|
{
|
|
137
137
|
assert(idToTermInstMap.find(condition.id()) == idToTermInstMap.end() && "this should be a fresh condition");
|
|
138
138
|
idToTermInstMap[condition.id()] = inst;
|
|
@@ -235,7 +235,7 @@ public:
|
|
|
235
235
|
|
|
236
236
|
|
|
237
237
|
/// mark neg Z3 expression
|
|
238
|
-
inline void setNegCondInst(const Condition &condition, const
|
|
238
|
+
inline void setNegCondInst(const Condition &condition, const ICFGNode* inst)
|
|
239
239
|
{
|
|
240
240
|
setCondInst(condition, inst);
|
|
241
241
|
negConds.set(condition.id());
|
|
@@ -62,10 +62,10 @@ public:
|
|
|
62
62
|
|
|
63
63
|
protected:
|
|
64
64
|
u32_t typeAndInfoFlag;
|
|
65
|
-
const
|
|
65
|
+
const ICFGNode *eventInst;
|
|
66
66
|
|
|
67
67
|
public:
|
|
68
|
-
SVFBugEvent(u32_t typeAndInfoFlag, const
|
|
68
|
+
SVFBugEvent(u32_t typeAndInfoFlag, const ICFGNode *eventInst): typeAndInfoFlag(typeAndInfoFlag), eventInst(eventInst) { };
|
|
69
69
|
virtual ~SVFBugEvent() = default;
|
|
70
70
|
|
|
71
71
|
inline u32_t getEventType() const
|
|
@@ -206,7 +206,12 @@ inline bool isNonInstricCallSite(const ICFGNode* inst)
|
|
|
206
206
|
return isCallSite(inst);
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
/// Return callsite given an instruction
|
|
212
|
+
CallSite getSVFCallSite(const ICFGNode* inst);
|
|
213
|
+
|
|
214
|
+
/// Return callsite given an instruction
|
|
210
215
|
inline CallSite getSVFCallSite(const SVFInstruction* inst)
|
|
211
216
|
{
|
|
212
217
|
assert(isCallSite(inst) && "not a callsite?");
|
|
Binary file
|
|
Binary file
|