svf-lib 1.0.2088 → 1.0.2089

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.
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?");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.2088",
3
+ "version": "1.0.2089",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {