svf-lib 1.0.1058 → 1.0.1059

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
@@ -40,54 +40,66 @@
40
40
  #include <map>
41
41
 
42
42
  #define EXTAPI_JSON_PATH "/lib/Util/ExtAPI.json"
43
+ #define JSON_OPT_OVERWRITE "overwrite_app_function"
44
+ #define JSON_OPT_FUNCTIONTYPE "type"
43
45
 
44
46
  namespace SVF
45
47
  {
46
48
 
47
49
  /*
48
50
 
49
- Specifications in ExtAPI.json
50
-
51
- Specification language: The specification language of external function includes:
52
- 1. the name of the function,
53
- 2. the type of the function,
54
- 3. the operations of the function.
55
-
56
- Funtion type: Funtion type represents some property of the function.
57
- For example,
58
- ”EFT_ALLOC“, represents if this external function allocates a new object and assigns it to one of its arguments,
59
- For the selection of Function type and a more detailed explanation, please refer to enum extf_t in ExtAPI.h.
60
-
61
- Function operations: Function operations indicates the relationship between input and output,
62
- mainly the relationship between function parameters, or between parameters and return values after function is executed.
63
- For example,
64
- "copy": ["A2", "L"], indicates that after this external function is executed, the value of the 2th parameter is copied into the return value.
65
- For the selection of Function type and a more detailed explanation, please refer to enum extType in ExtAPI.h.
66
-
67
- For operands of function operation, e.g., "A2", "L", there are the following options:
68
- "A": represents an parameter;
69
- "N": represents a number;
70
- "R": represents a reference;
71
- "L": represents a return value;
72
- "V": represents a dummy node;
73
-
74
- Among them, parameter may have multiple forms, because there may be multiple parameters, and parameter may be a reference or complex structure,
75
-
76
- Here we use regular expressions "(AN)(R|RN)^*" to represent parameter, for example,
77
- "A0": represents the 1th parameter;
78
- "A2R": represents that the 3th parameter is a reference;
79
- "A1R2": represents the 3th substructure of 2th parameter "A1R", where "A1R" is a complex structure;
80
- "A2R3R": represents the 4th substructure of 3th parameter "A2R" is a reference, where "A2R" is a complex structure;
81
-
82
-
83
- Specification format:
84
- "functionName": {
85
- "type": "functional type",
86
- "function operation_1": [ operand_1, operand_2, ... , operand_n],
87
- "function operation_2": [ operand_1, operand_2, ... , operand_n],
88
- ...
89
- "function operation_n": [ operand_1, operand_2, ... , operand_n]
90
- }
51
+ ** Specifications in ExtAPI.json
52
+
53
+ *** [1] Overview of the Specification Language
54
+ The specification language of external functions is based on the JSON format. And every function defined by the Specification Language is an object that represents the specification rules. These Specification Language objects for functions contain four parts:
55
+ 1. the name of the function,
56
+ 2. the switch that controls whether the specification rules defined in the ExtAPI.json overwrite the functions defined in the user code,
57
+ 3. the type of the function,
58
+ 4. the operations conducted by the function.
59
+
60
+ *** [2] Overwriting the user-defined functions
61
+ The switch *overwrite_app_function* controls whether the specification rules defined in the ExtAPI.json overwrite the functions defined in the user code (e.g., CPP files). When the switch *overwrite_app_function* is set to a value of 1, SVF will use the specification rules in ExtAPI.json to conduct the analysis and ignore the user-defined functions in the input CPP/bc files.
62
+ overwrite_app_function = 0: Analyze the user-defined functions.
63
+ overwrite_app_function = 1: Use specifications in ExtAPI.json to overwrite the user-defined functions.
64
+
65
+ *** [3] Function types
66
+ Function type represents the properties of the function.
67
+ For example,
68
+ "EFT_ALLOC" represents if this external function allocates a new object and assigns it to one of its arguments,
69
+ For the selection of function type and a more detailed explanation, please refer to the definition of enum *extf_t* in ExtAPI.h.
70
+
71
+ *** [4] Function operations
72
+ Function operations indicate the relationships between input and output,
73
+ mainly between function parameters or between parameters and return values after the execution.
74
+ For example,
75
+ "copy": ["A2", "L"] indicates that after this external function is executed, the value of the 2nd parameter is copied into the return value.
76
+ For the selection of function type and a more detailed explanation, please refer to the definition of enum *extType* in ExtAPI.h.
77
+
78
+ For operands of function operation, e.g., "A2", "L", there are the following options:
79
+ "A": represents a parameter;
80
+ "N": represents a number;
81
+ "R": represents a reference;
82
+ "L": represents a return value;
83
+ "V": represents a dummy node;
84
+
85
+ Among them, a parameter may have multiple forms because there may be various parameters, and the parameter may be a reference or complex structure,
86
+
87
+ Here we use regular expressions "(AN)(R|RN)^*" to represent parameters, for example,
88
+ "A0": represents the 1st parameter;
89
+ "A2R": represents that the 3rd parameter is a reference;
90
+ "A1R2": represents the 3rd substructure of the 2nd parameter "A1R", where "A1R" is a complex structure;
91
+ "A2R3R": represents the 4th substructure of the 3rd parameter "A2R" is a reference, where "A2R" is a complex structure;
92
+
93
+
94
+ ** Specification format:
95
+ "functionName": {
96
+ "type": "functional type",
97
+ "overwrite_app_function:" 0/1,
98
+ "function operation_1": [ operand_1, operand_2, ... , operand_n],
99
+ "function operation_2": [ operand_1, operand_2, ... , operand_n],
100
+ ...
101
+ "function operation_n": [ operand_1, operand_2, ... , operand_n]
102
+ }
91
103
  */
92
104
 
93
105
 
@@ -233,6 +245,11 @@ public:
233
245
  // Get property of the operation, e.g. "EFT_A1R_A0R"
234
246
  extType get_type(const SVF::SVFFunction *callee);
235
247
 
248
+ // Get priority of he function, return value
249
+ // 0: Apply user-defined functions
250
+ // 1: Apply function specification in ExtAPI.json
251
+ u32_t isOverwrittenAppFunction(const SVF::SVFFunction *callee);
252
+
236
253
  // Does (F) have a static var X (unavailable to us) that its return points to?
237
254
  bool has_static(const SVFFunction *F);
238
255
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1058",
3
+ "version": "1.0.1059",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {