svf-lib 1.0.2088 → 1.0.2090

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.
Files changed (31) hide show
  1. package/SVF-linux/Release-build/bin/ae +0 -0
  2. package/SVF-linux/Release-build/bin/cfl +0 -0
  3. package/SVF-linux/Release-build/bin/dvf +0 -0
  4. package/SVF-linux/Release-build/bin/llvm2svf +0 -0
  5. package/SVF-linux/Release-build/bin/mta +0 -0
  6. package/SVF-linux/Release-build/bin/saber +0 -0
  7. package/SVF-linux/Release-build/bin/svf-ex +0 -0
  8. package/SVF-linux/Release-build/bin/wpa +0 -0
  9. package/SVF-linux/Release-build/include/AE/Svfexe/AEDetector.h +1 -13
  10. package/SVF-linux/Release-build/include/Graphs/ICFGNode.h +33 -0
  11. package/SVF-linux/Release-build/include/Graphs/VFGNode.h +0 -6
  12. package/SVF-linux/Release-build/include/MTA/LockAnalysis.h +1 -1
  13. package/SVF-linux/Release-build/include/MTA/TCT.h +1 -10
  14. package/SVF-linux/Release-build/include/SABER/SaberCondAllocator.h +5 -5
  15. package/SVF-linux/Release-build/include/Util/SVFBugReport.h +2 -2
  16. package/SVF-linux/Release-build/include/Util/SVFUtil.h +6 -1
  17. package/SVF-linux/Release-build/lib/libSvfCore.a +0 -0
  18. package/SVF-linux/Release-build/lib/libSvfLLVM.a +0 -0
  19. package/SVF-osx/Release-build/bin/ae +0 -0
  20. package/SVF-osx/Release-build/bin/cfl +0 -0
  21. package/SVF-osx/Release-build/bin/dvf +0 -0
  22. package/SVF-osx/Release-build/bin/llvm2svf +0 -0
  23. package/SVF-osx/Release-build/bin/mta +0 -0
  24. package/SVF-osx/Release-build/bin/saber +0 -0
  25. package/SVF-osx/Release-build/bin/svf-ex +0 -0
  26. package/SVF-osx/Release-build/bin/wpa +0 -0
  27. package/SVF-osx/Release-build/include/Util/SVFUtil.h +15 -37
  28. package/SVF-osx/Release-build/include/Util/ThreadAPI.h +1 -55
  29. package/SVF-osx/Release-build/lib/libSvfCore.a +0 -0
  30. package/SVF-osx/Release-build/lib/libSvfLLVM.a +0 -0
  31. package/package.json +1 -1
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, inst);
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, CallSite call);
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, CallSite call);
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 SVFInstruction *> IndexToTermInstMap; /// id to instruction map for z3
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 SVFInstruction* inst);
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 SVFInstruction* getCondInst(u32_t id) 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 SVFInstruction* inst)
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 SVFInstruction* inst)
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 SVFInstruction *eventInst;
65
+ const ICFGNode *eventInst;
66
66
 
67
67
  public:
68
- SVFBugEvent(u32_t typeAndInfoFlag, const SVFInstruction *eventInst): typeAndInfoFlag(typeAndInfoFlag), eventInst(eventInst) { };
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
- /// Return LLVM callsite given an instruction
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
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -169,14 +169,8 @@ void dumpPointsToList(const PointsToList& ptl);
169
169
  /// Return true if it is an llvm intrinsic instruction
170
170
  bool isIntrinsicInst(const SVFInstruction* inst);
171
171
  bool isIntrinsicInst(const ICFGNode* inst);
172
-
173
172
  //@}
174
173
 
175
- /// Whether an instruction is a call or invoke instruction
176
- inline bool isCallSite(const SVFInstruction* inst)
177
- {
178
- return SVFUtil::isa<SVFCallInst>(inst);
179
- }
180
174
  /// Whether an instruction is a call or invoke instruction
181
175
  inline bool isCallSite(const SVFValue* val)
182
176
  {
@@ -207,31 +201,15 @@ inline bool isNonInstricCallSite(const ICFGNode* inst)
207
201
  }
208
202
 
209
203
 
210
-
211
204
  /// Return callsite given an instruction
212
205
  CallSite getSVFCallSite(const ICFGNode* inst);
213
206
 
214
- /// Return callsite given an instruction
215
- inline CallSite getSVFCallSite(const SVFInstruction* inst)
216
- {
217
- assert(isCallSite(inst) && "not a callsite?");
218
- CallSite cs(inst);
219
- return cs;
220
- }
221
207
 
222
208
  /// Match arguments for callsite at caller and callee
223
209
  /// if the arg size does not match then we do not need to connect this parameter
224
210
  /// unless the callee is a variadic function (the first parameter of variadic function is its parameter number)
225
- bool matchArgs(const CallSite cs, const SVFFunction* callee);
211
+ bool matchArgs(const CallICFGNode* cs, const SVFFunction* callee);
226
212
 
227
- /// Return LLVM callsite given a value
228
- inline CallSite getSVFCallSite(const SVFValue* value)
229
- {
230
- assert(isCallSite(value) && "not a callsite?");
231
- const SVFCallInst* svfInst = SVFUtil::cast<SVFCallInst>(value);
232
- CallSite cs(svfInst);
233
- return cs;
234
- }
235
213
 
236
214
  /// Split into two substrings around the first occurrence of a separator string.
237
215
  inline std::vector<std::string> split(const std::string& s, char separator)
@@ -423,7 +401,7 @@ inline bool isArgOfUncalledFunction(const SVFValue* svfval)
423
401
 
424
402
  /// Return thread fork function
425
403
  //@{
426
- inline const SVFValue* getForkedFun(const SVFInstruction *inst)
404
+ inline const SVFValue* getForkedFun(const ICFGNode *inst)
427
405
  {
428
406
  return ThreadAPI::getThreadAPI()->getForkedFun(inst);
429
407
  }
@@ -488,7 +466,7 @@ inline bool isReallocExtCall(const CallSite cs)
488
466
 
489
467
  /// Return true if this is a thread creation call
490
468
  ///@{
491
- inline bool isThreadForkCall(const SVFInstruction *inst)
469
+ inline bool isThreadForkCall(const ICFGNode *inst)
492
470
  {
493
471
  return ThreadAPI::getThreadAPI()->isTDFork(inst);
494
472
  }
@@ -496,49 +474,49 @@ inline bool isThreadForkCall(const SVFInstruction *inst)
496
474
 
497
475
  /// Return true if this is a thread join call
498
476
  ///@{
499
- inline bool isThreadJoinCall(const CallSite cs)
477
+ inline bool isThreadJoinCall(const ICFGNode* cs)
500
478
  {
501
- return ThreadAPI::getThreadAPI()->isTDJoin(cs.getInstruction());
479
+ return ThreadAPI::getThreadAPI()->isTDJoin(cs);
502
480
  }
503
481
  //@}
504
482
 
505
483
  /// Return true if this is a thread exit call
506
484
  ///@{
507
- inline bool isThreadExitCall(const CallSite cs)
485
+ inline bool isThreadExitCall(const ICFGNode* cs)
508
486
  {
509
- return ThreadAPI::getThreadAPI()->isTDExit(cs.getInstruction());
487
+ return ThreadAPI::getThreadAPI()->isTDExit(cs);
510
488
  }
511
489
  //@}
512
490
 
513
491
  /// Return true if this is a lock acquire call
514
492
  ///@{
515
- inline bool isLockAquireCall(const CallSite cs)
493
+ inline bool isLockAquireCall(const ICFGNode* cs)
516
494
  {
517
- return ThreadAPI::getThreadAPI()->isTDAcquire(cs.getInstruction());
495
+ return ThreadAPI::getThreadAPI()->isTDAcquire(cs);
518
496
  }
519
497
  //@}
520
498
 
521
499
  /// Return true if this is a lock acquire call
522
500
  ///@{
523
- inline bool isLockReleaseCall(const CallSite cs)
501
+ inline bool isLockReleaseCall(const ICFGNode* cs)
524
502
  {
525
- return ThreadAPI::getThreadAPI()->isTDRelease(cs.getInstruction());
503
+ return ThreadAPI::getThreadAPI()->isTDRelease(cs);
526
504
  }
527
505
  //@}
528
506
 
529
507
  /// Return true if this is a barrier wait call
530
508
  //@{
531
- inline bool isBarrierWaitCall(const CallSite cs)
509
+ inline bool isBarrierWaitCall(const ICFGNode* cs)
532
510
  {
533
- return ThreadAPI::getThreadAPI()->isTDBarWait(cs.getInstruction());
511
+ return ThreadAPI::getThreadAPI()->isTDBarWait(cs);
534
512
  }
535
513
  //@}
536
514
 
537
515
  /// Return sole argument of the thread routine
538
516
  //@{
539
- inline const SVFValue* getActualParmAtForkSite(const CallSite cs)
517
+ inline const SVFValue* getActualParmAtForkSite(const ICFGNode* cs)
540
518
  {
541
- return ThreadAPI::getThreadAPI()->getActualParmAtForkSite(cs.getInstruction());
519
+ return ThreadAPI::getThreadAPI()->getActualParmAtForkSite(cs);
542
520
  }
543
521
  //@}
544
522
 
@@ -37,6 +37,7 @@ namespace SVF
37
37
 
38
38
  class SVFModule;
39
39
  class ICFGNode;
40
+ class CallICFGNode;
40
41
 
41
42
  /*
42
43
  * ThreadAPI class contains interfaces for pthread programs
@@ -121,8 +122,6 @@ public:
121
122
  /// Return the callee/callsite/func
122
123
  //@{
123
124
  const SVFFunction* getCallee(const ICFGNode *inst) const;
124
- const SVFFunction* getCallee(const SVFInstruction *inst) const;
125
- const CallSite getSVFCallSite(const SVFInstruction *inst) const;
126
125
  const CallSite getSVFCallSite(const ICFGNode *inst) const;
127
126
  //@}
128
127
 
@@ -132,10 +131,6 @@ public:
132
131
  {
133
132
  return getType(getCallee(inst)) == TD_FORK;
134
133
  }
135
- inline bool isTDFork(const SVFInstruction* cs) const
136
- {
137
- return getType(getCallee(cs)) == TD_FORK;
138
- }
139
134
  //@}
140
135
 
141
136
  /// Return arguments/attributes of pthread_create / hare_parallel_for
@@ -148,13 +143,6 @@ public:
148
143
  CallSite cs = getSVFCallSite(inst);
149
144
  return cs.getArgument(0);
150
145
  }
151
- inline const SVFValue* getForkedThread(const SVFInstruction* inst) const
152
- {
153
- assert(isTDFork(inst) && "not a thread fork function!");
154
- CallSite cs = getSVFCallSite(inst);
155
- return cs.getArgument(0);
156
- }
157
-
158
146
  /// Return the third argument of the call,
159
147
  /// Note that, it could be function type or a void* pointer
160
148
  inline const SVFValue* getForkedFun(const ICFGNode *inst) const
@@ -163,12 +151,6 @@ public:
163
151
  CallSite cs = getSVFCallSite(inst);
164
152
  return cs.getArgument(2);
165
153
  }
166
- inline const SVFValue* getForkedFun(const SVFInstruction* inst) const
167
- {
168
- assert(isTDFork(inst) && "not a thread fork function!");
169
- CallSite cs = getSVFCallSite(inst);
170
- return cs.getArgument(2);
171
- }
172
154
 
173
155
  /// Return the forth argument of the call,
174
156
  /// Note that, it is the sole argument of start routine ( a void* pointer )
@@ -178,12 +160,6 @@ public:
178
160
  CallSite cs = getSVFCallSite(inst);
179
161
  return cs.getArgument(3);
180
162
  }
181
- inline const SVFValue* getActualParmAtForkSite(const SVFInstruction* inst) const
182
- {
183
- assert(isTDFork(inst) && "not a thread fork function!");
184
- CallSite cs = getSVFCallSite(inst);
185
- return cs.getArgument(3);
186
- }
187
163
  //@}
188
164
 
189
165
  /// Return true if this call wait for a worker thread
@@ -192,10 +168,6 @@ public:
192
168
  {
193
169
  return getType(getCallee(inst)) == TD_JOIN;
194
170
  }
195
- inline bool isTDJoin(const SVFInstruction* inst) const
196
- {
197
- return getType(getCallee(inst)) == TD_JOIN;
198
- }
199
171
  //@}
200
172
 
201
173
  /// Return arguments/attributes of pthread_join
@@ -211,12 +183,6 @@ public:
211
183
  CallSite cs = getSVFCallSite(inst);
212
184
  return cs.getArgument(1);
213
185
  }
214
- inline const SVFValue* getRetParmAtJoinedSite(const SVFInstruction* inst) const
215
- {
216
- assert(isTDJoin(inst) && "not a thread join function!");
217
- CallSite cs = getSVFCallSite(inst);
218
- return cs.getArgument(1);
219
- }
220
186
  //@}
221
187
 
222
188
 
@@ -226,11 +192,6 @@ public:
226
192
  {
227
193
  return getType(getCallee(inst)) == TD_EXIT;
228
194
  }
229
-
230
- inline bool isTDExit(const SVFInstruction* inst) const
231
- {
232
- return getType(getCallee(inst)) == TD_EXIT;
233
- }
234
195
  //@}
235
196
 
236
197
  /// Return true if this call acquire a lock
@@ -239,11 +200,6 @@ public:
239
200
  {
240
201
  return getType(getCallee(inst)) == TD_ACQUIRE;
241
202
  }
242
-
243
- inline bool isTDAcquire(const SVFInstruction* inst) const
244
- {
245
- return getType(getCallee(inst)) == TD_ACQUIRE;
246
- }
247
203
  //@}
248
204
 
249
205
  /// Return true if this call release a lock
@@ -252,11 +208,6 @@ public:
252
208
  {
253
209
  return getType(getCallee(inst)) == TD_RELEASE;
254
210
  }
255
-
256
- inline bool isTDRelease(const SVFInstruction* inst) const
257
- {
258
- return getType(getCallee(inst)) == TD_RELEASE;
259
- }
260
211
  //@}
261
212
 
262
213
  /// Return lock value
@@ -271,11 +222,6 @@ public:
271
222
  {
272
223
  return getType(getCallee(inst)) == TD_BAR_WAIT;
273
224
  }
274
-
275
- inline bool isTDBarWait(const SVFInstruction* inst) const
276
- {
277
- return getType(getCallee(inst)) == TD_BAR_WAIT;
278
- }
279
225
  //@}
280
226
 
281
227
  void performAPIStat(SVFModule* m);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.2088",
3
+ "version": "1.0.2090",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {