svf-lib 1.0.2507 → 1.0.2509

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.
@@ -300,6 +300,8 @@ public:
300
300
 
301
301
  void printAbstractState() const;
302
302
 
303
+ std::string toString() const;
304
+
303
305
  u32_t hash() const;
304
306
 
305
307
  // lhs == rhs for varToValMap
@@ -109,11 +109,11 @@ public:
109
109
  detectors.push_back(std::move(detector));
110
110
  }
111
111
 
112
- /// Retrieve the abstract state from the trace for a given ICFG node; asserts if no trace exists
113
- AbstractState& getAbstractState(const ICFGNode* node);
114
-
115
- /// Check if an abstract state exists in the trace for a given ICFG node
116
- bool hasAbstractState(const ICFGNode* node);
112
+ /// Retrieve SVFVar given its ID; asserts if no such variable exists
113
+ inline const SVFVar* getSVFVar(NodeID varId) const
114
+ {
115
+ return svfir->getSVFVar(varId);
116
+ }
117
117
 
118
118
  /// Retrieve abstract value for a top-level variable at a given ICFG node
119
119
  const AbstractValue& getAbstractValue(const ICFGNode* node, const ValVar* var);
@@ -124,6 +124,24 @@ public:
124
124
  /// Retrieve abstract value for any SVF variable at a given ICFG node
125
125
  const AbstractValue& getAbstractValue(const ICFGNode* node, const SVFVar* var);
126
126
 
127
+ /// Set abstract value for a top-level variable at a given ICFG node
128
+ void updateAbstractValue(const ICFGNode* node, const ValVar* var, const AbstractValue& val);
129
+
130
+ /// Set abstract value for an address-taken variable at a given ICFG node
131
+ void updateAbstractValue(const ICFGNode* node, const ObjVar* var, const AbstractValue& val);
132
+
133
+ /// Set abstract value for any SVF variable at a given ICFG node
134
+ void updateAbstractValue(const ICFGNode* node, const SVFVar* var, const AbstractValue& val);
135
+
136
+ /// Propagate an ObjVar's abstract value from defSite to all its use-site ICFGNodes via SVFG
137
+ void propagateObjVarAbsVal(const ObjVar* var, const ICFGNode* defSite);
138
+
139
+ /// Retrieve the abstract state from the trace for a given ICFG node; asserts if no trace exists
140
+ AbstractState& getAbstractState(const ICFGNode* node);
141
+
142
+ /// Check if an abstract state exists in the trace for a given ICFG node
143
+ bool hasAbstractState(const ICFGNode* node);
144
+
127
145
  /// Retrieve abstract state filtered to specific top-level variables
128
146
  void getAbstractState(const ICFGNode* node, const Set<const ValVar*>& vars, AbstractState& result);
129
147
 
@@ -65,6 +65,12 @@ public:
65
65
  {
66
66
  return callGraphSCC;
67
67
  }
68
+ SVFG* getSVFG() const
69
+ {
70
+ return svfg;
71
+ }
72
+ /// Given an ObjVar and its def-site ICFGNode, find all use-site ICFGNodes
73
+ const Set<const ICFGNode*> getUseSitesOfObjVar(const ObjVar* obj, const ICFGNode* node) const;
68
74
 
69
75
  /// Build WTO for each function using call graph SCC
70
76
  void initWTO();
@@ -78,6 +84,7 @@ public:
78
84
  private:
79
85
  SVFIR* svfir;
80
86
  ICFG* icfg;
87
+ SVFG* svfg;
81
88
  AndersenWaveDiff* pta;
82
89
  CallGraph* callGraph;
83
90
  CallGraphSCC* callGraphSCC;
@@ -181,19 +181,19 @@ public:
181
181
 
182
182
  /// Given a ValVar and its SVFGNode, find the definition-site ICFGNode
183
183
  /// by following incoming direct VFGEdges (asserts unique definition)
184
- const ICFGNode* getDefSiteOfValVar(const ValVar* var, const SVFGNode* node) const;
184
+ const ICFGNode* getDefSiteOfValVar(const ValVar* var) const;
185
185
 
186
- /// Given an ObjVar and its SVFGNode, find the definition-site ICFGNode
186
+ /// Given an ObjVar and its use-site ICFGNode, find the definition-site ICFGNode
187
187
  /// by following incoming IndirectSVFGEdges whose pts contains the ObjVar (asserts unique definition)
188
- const ICFGNode* getDefSiteOfObjVar(const ObjVar* obj, const SVFGNode* node) const;
188
+ const ICFGNode* getDefSiteOfObjVar(const ObjVar* obj, const ICFGNode* node) const;
189
189
 
190
- /// Given a ValVar and its SVFStmt, find all use-site ICFGNodes
191
- /// by following outgoing direct VFGEdges from its definition SVFGNode
192
- const Set<const ICFGNode*> getUseSitesOfValVar(const ValVar* var, const SVFGNode* vNode) const;
190
+ /// Given a ValVar, find all use-site ICFGNodes
191
+ /// by following outgoing direct VFGEdges from its unique definition SVFGNode
192
+ const Set<const ICFGNode*> getUseSitesOfValVar(const ValVar* var) const;
193
193
 
194
- /// Given an ObjVar and its SVFStmt, find all use-site ICFGNodes
194
+ /// Given an ObjVar and its def-site ICFGNode, find all use-site ICFGNodes
195
195
  /// by following outgoing IndirectSVFGEdges whose pts contains the ObjVar
196
- const Set<const ICFGNode*> getUseSitesOfObjVar(const ObjVar* obj, const SVFGNode* vNode) const;
196
+ const Set<const ICFGNode*> getUseSitesOfObjVar(const ObjVar* obj, const ICFGNode* node) const;
197
197
 
198
198
  /// Perform statistics
199
199
  void performStat();
@@ -240,6 +240,7 @@ public:
240
240
  static const Option<u32_t> LoopBound;
241
241
 
242
242
  // Abstract Execution
243
+ static const Option<bool> SparseAE;
243
244
  static const Option<u32_t> WidenDelay;
244
245
  /// recursion handling mode, Default: TOP
245
246
  static const OptionMap<u32_t> HandleRecur;
@@ -300,6 +300,8 @@ public:
300
300
 
301
301
  void printAbstractState() const;
302
302
 
303
+ std::string toString() const;
304
+
303
305
  u32_t hash() const;
304
306
 
305
307
  // lhs == rhs for varToValMap
@@ -109,11 +109,11 @@ public:
109
109
  detectors.push_back(std::move(detector));
110
110
  }
111
111
 
112
- /// Retrieve the abstract state from the trace for a given ICFG node; asserts if no trace exists
113
- AbstractState& getAbstractState(const ICFGNode* node);
114
-
115
- /// Check if an abstract state exists in the trace for a given ICFG node
116
- bool hasAbstractState(const ICFGNode* node);
112
+ /// Retrieve SVFVar given its ID; asserts if no such variable exists
113
+ inline const SVFVar* getSVFVar(NodeID varId) const
114
+ {
115
+ return svfir->getSVFVar(varId);
116
+ }
117
117
 
118
118
  /// Retrieve abstract value for a top-level variable at a given ICFG node
119
119
  const AbstractValue& getAbstractValue(const ICFGNode* node, const ValVar* var);
@@ -124,6 +124,24 @@ public:
124
124
  /// Retrieve abstract value for any SVF variable at a given ICFG node
125
125
  const AbstractValue& getAbstractValue(const ICFGNode* node, const SVFVar* var);
126
126
 
127
+ /// Set abstract value for a top-level variable at a given ICFG node
128
+ void updateAbstractValue(const ICFGNode* node, const ValVar* var, const AbstractValue& val);
129
+
130
+ /// Set abstract value for an address-taken variable at a given ICFG node
131
+ void updateAbstractValue(const ICFGNode* node, const ObjVar* var, const AbstractValue& val);
132
+
133
+ /// Set abstract value for any SVF variable at a given ICFG node
134
+ void updateAbstractValue(const ICFGNode* node, const SVFVar* var, const AbstractValue& val);
135
+
136
+ /// Propagate an ObjVar's abstract value from defSite to all its use-site ICFGNodes via SVFG
137
+ void propagateObjVarAbsVal(const ObjVar* var, const ICFGNode* defSite);
138
+
139
+ /// Retrieve the abstract state from the trace for a given ICFG node; asserts if no trace exists
140
+ AbstractState& getAbstractState(const ICFGNode* node);
141
+
142
+ /// Check if an abstract state exists in the trace for a given ICFG node
143
+ bool hasAbstractState(const ICFGNode* node);
144
+
127
145
  /// Retrieve abstract state filtered to specific top-level variables
128
146
  void getAbstractState(const ICFGNode* node, const Set<const ValVar*>& vars, AbstractState& result);
129
147
 
@@ -65,6 +65,12 @@ public:
65
65
  {
66
66
  return callGraphSCC;
67
67
  }
68
+ SVFG* getSVFG() const
69
+ {
70
+ return svfg;
71
+ }
72
+ /// Given an ObjVar and its def-site ICFGNode, find all use-site ICFGNodes
73
+ const Set<const ICFGNode*> getUseSitesOfObjVar(const ObjVar* obj, const ICFGNode* node) const;
68
74
 
69
75
  /// Build WTO for each function using call graph SCC
70
76
  void initWTO();
@@ -78,6 +84,7 @@ public:
78
84
  private:
79
85
  SVFIR* svfir;
80
86
  ICFG* icfg;
87
+ SVFG* svfg;
81
88
  AndersenWaveDiff* pta;
82
89
  CallGraph* callGraph;
83
90
  CallGraphSCC* callGraphSCC;
@@ -181,19 +181,19 @@ public:
181
181
 
182
182
  /// Given a ValVar and its SVFGNode, find the definition-site ICFGNode
183
183
  /// by following incoming direct VFGEdges (asserts unique definition)
184
- const ICFGNode* getDefSiteOfValVar(const ValVar* var, const SVFGNode* node) const;
184
+ const ICFGNode* getDefSiteOfValVar(const ValVar* var) const;
185
185
 
186
- /// Given an ObjVar and its SVFGNode, find the definition-site ICFGNode
186
+ /// Given an ObjVar and its use-site ICFGNode, find the definition-site ICFGNode
187
187
  /// by following incoming IndirectSVFGEdges whose pts contains the ObjVar (asserts unique definition)
188
- const ICFGNode* getDefSiteOfObjVar(const ObjVar* obj, const SVFGNode* node) const;
188
+ const ICFGNode* getDefSiteOfObjVar(const ObjVar* obj, const ICFGNode* node) const;
189
189
 
190
- /// Given a ValVar and its SVFStmt, find all use-site ICFGNodes
191
- /// by following outgoing direct VFGEdges from its definition SVFGNode
192
- const Set<const ICFGNode*> getUseSitesOfValVar(const ValVar* var, const SVFGNode* vNode) const;
190
+ /// Given a ValVar, find all use-site ICFGNodes
191
+ /// by following outgoing direct VFGEdges from its unique definition SVFGNode
192
+ const Set<const ICFGNode*> getUseSitesOfValVar(const ValVar* var) const;
193
193
 
194
- /// Given an ObjVar and its SVFStmt, find all use-site ICFGNodes
194
+ /// Given an ObjVar and its def-site ICFGNode, find all use-site ICFGNodes
195
195
  /// by following outgoing IndirectSVFGEdges whose pts contains the ObjVar
196
- const Set<const ICFGNode*> getUseSitesOfObjVar(const ObjVar* obj, const SVFGNode* vNode) const;
196
+ const Set<const ICFGNode*> getUseSitesOfObjVar(const ObjVar* obj, const ICFGNode* node) const;
197
197
 
198
198
  /// Perform statistics
199
199
  void performStat();
@@ -240,6 +240,7 @@ public:
240
240
  static const Option<u32_t> LoopBound;
241
241
 
242
242
  // Abstract Execution
243
+ static const Option<bool> SparseAE;
243
244
  static const Option<u32_t> WidenDelay;
244
245
  /// recursion handling mode, Default: TOP
245
246
  static const OptionMap<u32_t> HandleRecur;
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.2507",
3
+ "version": "1.0.2509",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {