svf-lib 1.0.1167 → 1.0.1168
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
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
#include "Util/ExtAPI.h"
|
|
35
35
|
#include "SVF-FE/BasicTypes.h"
|
|
36
36
|
#include "SVF-FE/ICFGBuilder.h"
|
|
37
|
-
#include "Util/cJSON.h"
|
|
38
37
|
|
|
39
38
|
namespace SVF
|
|
40
39
|
{
|
|
@@ -241,7 +240,6 @@ protected:
|
|
|
241
240
|
|
|
242
241
|
/// Handle external call
|
|
243
242
|
//@{
|
|
244
|
-
virtual u32_t getArgPos(std::string s);
|
|
245
243
|
virtual NodeID parseNode(std::string s, CallSite cs, const Instruction *inst);
|
|
246
244
|
virtual void handleExtCall(CallSite cs, const SVFFunction *F);
|
|
247
245
|
void addComplexConsForExt(Value *D, Value *S, const Value* sz);
|
|
@@ -99,7 +99,6 @@ Here we use regular expressions "(AN)(R|RN)^*" to represent parameters, for exam
|
|
|
99
99
|
}
|
|
100
100
|
*/
|
|
101
101
|
|
|
102
|
-
|
|
103
102
|
class ExtAPI
|
|
104
103
|
{
|
|
105
104
|
public:
|
|
@@ -109,8 +108,7 @@ public:
|
|
|
109
108
|
EXT_COPY, // Handle copy edge
|
|
110
109
|
EXT_LOAD, // Handle load edge
|
|
111
110
|
EXT_STORE, // Handle store edge
|
|
112
|
-
|
|
113
|
-
EXT_LOADSTORE, // Handle load and store edges, and add a dummy node
|
|
111
|
+
EXT_GEP, // Handle gep edge
|
|
114
112
|
EXT_COPY_N, // Copy the character c (an unsigned char) to the first n characters of the string pointed to, by the argument str
|
|
115
113
|
EXT_COPY_MN, // Copies n characters from memory area src to memory area dest.
|
|
116
114
|
EXT_FUNPTR, // Handle function void *dlsym(void *handle, const char *symbol)
|
|
@@ -171,8 +169,7 @@ private:
|
|
|
171
169
|
{"copy", EXT_COPY},
|
|
172
170
|
{"load", EXT_LOAD},
|
|
173
171
|
{"store", EXT_STORE},
|
|
174
|
-
{"
|
|
175
|
-
{"load_store", EXT_LOADSTORE},
|
|
172
|
+
{"gep", EXT_GEP},
|
|
176
173
|
{"copy_n", EXT_COPY_N},
|
|
177
174
|
{"copy_mn", EXT_COPY_MN},
|
|
178
175
|
{"complex", EXT_COMPLEX},
|
|
@@ -226,6 +223,41 @@ private:
|
|
|
226
223
|
ExtAPI() = default;
|
|
227
224
|
|
|
228
225
|
public:
|
|
226
|
+
|
|
227
|
+
class Operation
|
|
228
|
+
{
|
|
229
|
+
public:
|
|
230
|
+
|
|
231
|
+
public:
|
|
232
|
+
Operation() {};
|
|
233
|
+
|
|
234
|
+
Operation(std::string op, std::vector<std::string> args) : operation(op), args(args) {};
|
|
235
|
+
|
|
236
|
+
std::string getOperation()
|
|
237
|
+
{
|
|
238
|
+
return operation;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
std::vector<std::string> getArgs()
|
|
242
|
+
{
|
|
243
|
+
return args;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
void setOperation(std::string op)
|
|
247
|
+
{
|
|
248
|
+
operation = op;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
void setArgs(std::vector<std::string> ags)
|
|
252
|
+
{
|
|
253
|
+
args = ags;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
private:
|
|
257
|
+
std::string operation;
|
|
258
|
+
std::vector<std::string> args;
|
|
259
|
+
};
|
|
260
|
+
|
|
229
261
|
static ExtAPI *getExtAPI(const std::string & = "");
|
|
230
262
|
|
|
231
263
|
static void destory();
|
|
@@ -233,6 +265,15 @@ public:
|
|
|
233
265
|
// Add an entry with the specified fields to the ExtAPI, which will be reflected immediately by further ExtAPI queries
|
|
234
266
|
void add_entry(const char* funName, extType type, bool overwrite_app_function);
|
|
235
267
|
|
|
268
|
+
// Get numeric index of the argument in external function
|
|
269
|
+
u32_t getArgPos(std::string s);
|
|
270
|
+
|
|
271
|
+
// return value >= 0 is an argument node
|
|
272
|
+
// return value = -1 is an inst node
|
|
273
|
+
// return value = -2 is a Dummy node
|
|
274
|
+
// return value = -2 is an illegal operand format
|
|
275
|
+
int getNodeIDType(std::string s);
|
|
276
|
+
|
|
236
277
|
// Get the corresponding name in ext_t, e.g. "EXT_ADDR" in {"addr", EXT_ADDR},
|
|
237
278
|
extf_t get_opName(const std::string& s);
|
|
238
279
|
// opposite for extType
|
|
@@ -247,6 +288,9 @@ public:
|
|
|
247
288
|
// Get specifications of external functions in ExtAPI.json file
|
|
248
289
|
cJSON *get_FunJson(const std::string &funName);
|
|
249
290
|
|
|
291
|
+
// Get all operations of an extern function
|
|
292
|
+
std::vector<std::vector<ExtAPI::Operation *>> getAllOperations(std::string funName);
|
|
293
|
+
|
|
250
294
|
// Get property of the operation, e.g. "EFT_A1R_A0R"
|
|
251
295
|
extType get_type(const SVF::SVFFunction *callee);
|
|
252
296
|
extType get_type(const std::string& funName);
|