svf-tools 1.0.500 → 1.0.503
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.
- package/SVF-doxygen/html/html/ExtAPI_8cpp.html +79 -17
- package/SVF-doxygen/html/html/ExtAPI_8cpp_source.html +24 -22
- package/SVF-doxygen/html/html/ExtAPI_8h_source.html +19 -18
- package/SVF-doxygen/html/html/SVFIRBuilder_8cpp_source.html +2 -1
- package/SVF-doxygen/html/html/SVFModule_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SVFUtil_8h_source.html +9 -9
- package/SVF-doxygen/html/html/SymbolTableBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1ExtAPI-members.html +24 -23
- package/SVF-doxygen/html/html/classSVF_1_1ExtAPI.html +98 -66
- package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder.html +9 -8
- package/SVF-doxygen/html/html/classSVF_1_1SVFModule.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableBuilder.html +1 -1
- package/SVF-doxygen/html/html/functions_e.html +4 -1
- package/SVF-doxygen/html/html/functions_func_e.html +5 -2
- package/SVF-doxygen/html/html/functions_func_g.html +2 -2
- package/SVF-doxygen/html/html/functions_g.html +2 -2
- package/SVF-doxygen/html/html/functions_i.html +3 -3
- package/SVF-doxygen/html/html/functions_l.html +3 -3
- package/SVF-doxygen/html/html/functions_o.html +12 -12
- package/SVF-doxygen/html/html/functions_p.html +10 -8
- package/SVF-doxygen/html/html/functions_r.html +4 -2
- package/SVF-doxygen/html/html/functions_s.html +7 -7
- package/SVF-doxygen/html/html/functions_t.html +4 -4
- package/SVF-doxygen/html/html/functions_v.html +3 -3
- package/SVF-doxygen/html/html/functions_w.html +10 -6
- package/SVF-doxygen/html/html/globals_func_g.html +2 -2
- package/SVF-doxygen/html/html/globals_func_p.html +3 -0
- package/SVF-doxygen/html/html/globals_g.html +2 -2
- package/SVF-doxygen/html/html/globals_p.html +6 -3
- package/SVF-doxygen/html/html/globals_r.html +3 -3
- package/SVF-doxygen/html/html/globals_s.html +12 -12
- package/SVF-doxygen/html/html/search/all_10.js +7 -6
- package/SVF-doxygen/html/html/search/all_12.js +2 -2
- package/SVF-doxygen/html/html/search/all_13.js +9 -9
- package/SVF-doxygen/html/html/search/all_14.js +3 -3
- package/SVF-doxygen/html/html/search/all_15.js +1 -1
- package/SVF-doxygen/html/html/search/all_16.js +1 -1
- package/SVF-doxygen/html/html/search/all_17.js +1 -1
- package/SVF-doxygen/html/html/search/all_5.js +1 -1
- package/SVF-doxygen/html/html/search/all_7.js +4 -4
- package/SVF-doxygen/html/html/search/all_9.js +1 -1
- package/SVF-doxygen/html/html/search/all_c.js +1 -1
- package/SVF-doxygen/html/html/search/all_d.js +2 -2
- package/SVF-doxygen/html/html/search/all_e.js +1 -1
- package/SVF-doxygen/html/html/search/all_f.js +2 -2
- package/SVF-doxygen/html/html/search/functions_4.js +1 -0
- package/SVF-doxygen/html/html/search/functions_6.js +4 -4
- package/SVF-doxygen/html/html/search/functions_f.js +2 -1
- package/SVF-doxygen/html/html/search/variables_15.js +1 -1
- package/SVF-doxygen/html/html/search/variables_d.js +1 -1
- package/SVF-doxygen/html/html/search/variables_e.js +1 -1
- package/include/Util/ExtAPI.h +4 -2
- package/lib/SVF-FE/SVFIRBuilder.cpp +4 -4
- package/lib/SVF-FE/SymbolTableBuilder.cpp +1 -1
- package/lib/Util/ExtAPI.cpp +119 -98
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ var searchData=
|
|
|
12
12
|
['parse_5fobject',['parse_object',['../cJSON_8cpp.html#a1472ac5d1becd7d9a5e558b4c053b06a',1,'cJSON.cpp']]],
|
|
13
13
|
['parse_5fstring',['parse_string',['../cJSON_8cpp.html#adf47b520af96d1bbefa2390016fbdb51',1,'cJSON.cpp']]],
|
|
14
14
|
['parse_5fvalue',['parse_value',['../cJSON_8cpp.html#afd5c0b7089e4de2fc9b2af599d4b596f',1,'cJSON.cpp']]],
|
|
15
|
+
['parsejson',['parseJson',['../ExtAPI_8cpp.html#a3957468a4d85cef02d8be1f82bcdfc69',1,'ExtAPI.cpp']]],
|
|
15
16
|
['parsenode',['parseNode',['../classSVF_1_1SVFIRBuilder.html#a1ad4f6ac06c1f3523661e7b2a0be09b5',1,'SVF::SVFIRBuilder']]],
|
|
16
17
|
['parseproductionsstring',['parseProductionsString',['../classSVF_1_1GrammarBuilder.html#a5a34166b4b1ce1dcc985f4619f4a2bbc',1,'SVF::GrammarBuilder']]],
|
|
17
18
|
['parseselfcyclehandleoption',['parseSelfCycleHandleOption',['../classSVF_1_1SVFGOPT.html#ac3b14bf191cadb832e3a34affd7e569d',1,'SVF::SVFGOPT']]],
|
|
@@ -43,7 +44,7 @@ var searchData=
|
|
|
43
44
|
['plainmap',['plainMap',['../classSVF_1_1FlowSensitive.html#a5a8688102f3675cf414b01dc2ae51c6b',1,'SVF::FlowSensitive']]],
|
|
44
45
|
['pmx',['PMX',['../cuddInt_8c.html#a6e6108316d27c8e3b393f65362e5e37b',1,'cuddInt.c']]],
|
|
45
46
|
['pointeranalysis',['PointerAnalysis',['../classSVF_1_1PointerAnalysis.html#a14e2a209cb594f91a24ef09b12f82f3f',1,'SVF::PointerAnalysis']]],
|
|
46
|
-
['pointsto',['
|
|
47
|
+
['pointsto',['pointsTo',['../classSVF_1_1CondPointsToSet.html#a63f09ca69e00b317de29af6a6a12daac',1,'SVF::CondPointsToSet::pointsTo(void)'],['../classSVF_1_1CondPointsToSet.html#ada240bc77570174a1d17ac097583fa78',1,'SVF::CondPointsToSet::pointsTo(void) const'],['../classSVF_1_1CondPointsToSet.html#a03311162626acf16ad05b7b93248a92b',1,'SVF::CondPointsToSet::pointsTo(Cond cond) const'],['../classSVF_1_1CondPointsToSet.html#a8775ef2c073af6c8055c3f5b0035288f',1,'SVF::CondPointsToSet::pointsTo(Cond cond)'],['../classSVF_1_1PointsTo.html#a05aa807f21f311eb50ff11dde98b8d22',1,'SVF::PointsTo::PointsTo(void)'],['../classSVF_1_1PointsTo.html#acef2d3e41263aef641c3411e28ad445c',1,'SVF::PointsTo::PointsTo(const PointsTo &pt)'],['../classSVF_1_1PointsTo.html#a5ecef616428a70e8e7726406dfb43544',1,'SVF::PointsTo::PointsTo(PointsTo &&pt)']]],
|
|
47
48
|
['pointstoiterator',['PointsToIterator',['../classSVF_1_1PointsTo_1_1PointsToIterator.html#a3974dee7680da3a43b58932766e77a16',1,'SVF::PointsTo::PointsToIterator::PointsToIterator(void)=delete'],['../classSVF_1_1PointsTo_1_1PointsToIterator.html#a19f371ccb5b1c84fb4adfd5b0c8a3eec',1,'SVF::PointsTo::PointsToIterator::PointsToIterator(const PointsToIterator &pt)'],['../classSVF_1_1PointsTo_1_1PointsToIterator.html#abe128c47fb16093756195f789e5f68d5',1,'SVF::PointsTo::PointsToIterator::PointsToIterator(PointsToIterator &&pt)'],['../classSVF_1_1PointsTo_1_1PointsToIterator.html#ad9efcd9fb0c8201b9166a1560d06a71b',1,'SVF::PointsTo::PointsToIterator::PointsToIterator(const PointsTo *pt, bool end=false)']]],
|
|
48
49
|
['pop',['pop',['../classSVF_1_1CFLFIFOWorkList.html#a8ccf884ed6bc0d172f3c2999717f9cff',1,'SVF::CFLFIFOWorkList::pop()'],['../classSVF_1_1List.html#a6e85bd3d8b23ccc7752a72e2a5b171ab',1,'SVF::List::pop()'],['../classSVF_1_1FIFOWorkList.html#a8fa72918fce7e9c0b2dc34b683a797c6',1,'SVF::FIFOWorkList::pop()'],['../classSVF_1_1FILOWorkList.html#a3fd9acb6d09fd142bfd402fdf8cac93b',1,'SVF::FILOWorkList::pop()']]],
|
|
49
50
|
['popen',['popen',['../util_8h.html#a7a377e01cff8d8243569ddc8bfef959b',1,'util.h']]],
|
|
@@ -7,7 +7,7 @@ var searchData=
|
|
|
7
7
|
['uniqueunions',['uniqueUnions',['../classSVF_1_1PersistentPointsToCache.html#aacebdd87b1dd45250391d035b032f9d4',1,'SVF::PersistentPointsToCache']]],
|
|
8
8
|
['univ',['univ',['../structDdManager.html#ab21d56989b9a13502aeb84228de45df0',1,'DdManager']]],
|
|
9
9
|
['unlocksites',['unlocksites',['../classSVF_1_1LockAnalysis.html#aec459af1d1624df55ffc95cd75655780',1,'SVF::LockAnalysis']]],
|
|
10
|
-
['updatecallgraphtime',['
|
|
10
|
+
['updatecallgraphtime',['updateCallGraphTime',['../classSVF_1_1FlowSensitive.html#afc140b6c8e78dc2d962f64fdf53b1e07',1,'SVF::FlowSensitive::updateCallGraphTime()'],['../classSVF_1_1PTAStat.html#a8aedfeb35f76e6d33135637156468894',1,'SVF::PTAStat::UpdateCallGraphTime()']]],
|
|
11
11
|
['updatetime',['updateTime',['../classSVF_1_1FlowSensitive.html#af5a94d14096ae2bbc47b3b3b9f723226',1,'SVF::FlowSensitive']]],
|
|
12
12
|
['usedregs',['usedRegs',['../classSVF_1_1MemSSA.html#acf840b71b67cabe831f01f2d358f27fa',1,'SVF::MemSSA']]],
|
|
13
13
|
['usepcg',['UsePCG',['../classSVF_1_1Options.html#af2f66307e1d51947676f622c98ef0762',1,'SVF::Options']]],
|
|
@@ -38,7 +38,7 @@ var searchData=
|
|
|
38
38
|
['maxpointstosetsize',['MaxPointsToSetSize',['../classSVF_1_1PTAStat.html#af2b45aab2eee96a1cabba3025e4375a2',1,'SVF::PTAStat::MaxPointsToSetSize()'],['../classSVF_1_1AndersenBase.html#abd73e930450b7c605f478672bdf9bdae',1,'SVF::AndersenBase::MaxPointsToSetSize()']]],
|
|
39
39
|
['maxreorderings',['maxReorderings',['../structDdManager.html#a61170edf6d08bb1c4bacab68823a825d',1,'DdManager']]],
|
|
40
40
|
['maxsccsize',['maxSCCSize',['../classSVF_1_1FlowSensitive.html#aa3d4703756a6297ab5c0756172024fe4',1,'SVF::FlowSensitive']]],
|
|
41
|
-
['maxsize',['
|
|
41
|
+
['maxsize',['maxsize',['../structDdHashTable.html#aba376a6d310dcead9f74cfc459f4a248',1,'DdHashTable::maxsize()'],['../structDdLevelQueue.html#acb7146e9f3dd73a052340c0e4010e6b6',1,'DdLevelQueue::maxsize()'],['../structDdManager.html#aa4d0701dc4e6f11b30085ae30c09fab6',1,'DdManager::maxSize()']]],
|
|
42
42
|
['maxsizez',['maxSizeZ',['../structDdManager.html#a4a0b8f95d02bc99557fb55140e9b0963',1,'DdManager']]],
|
|
43
43
|
['maxslots',['maxslots',['../structDdLocalCache.html#af4379636b29a9bfe4a55708ac637545a',1,'DdLocalCache']]],
|
|
44
44
|
['maxstepinwrapper',['MaxStepInWrapper',['../classSVF_1_1Options.html#a0b82f16ee0c7e6566a6ae20662525e84',1,'SVF::Options']]],
|
|
@@ -48,7 +48,7 @@ var searchData=
|
|
|
48
48
|
['numgtintregions',['NumGtIntRegions',['../classSVF_1_1NodeIDAllocator_1_1Clusterer.html#ad7cb36a1f0f67864fb8290e9dfd7b639',1,'SVF::NodeIDAllocator::Clusterer']]],
|
|
49
49
|
['numnodes',['numNodes',['../classSVF_1_1NodeIDAllocator.html#a8e76e0da58f0a5bdbd8118ac419cfa62',1,'SVF::NodeIDAllocator']]],
|
|
50
50
|
['numnontrivialregionobjects',['NumNonTrivialRegionObjects',['../classSVF_1_1NodeIDAllocator_1_1Clusterer.html#a1bf9461c717e8dabaee6a57f3d76d61f',1,'SVF::NodeIDAllocator::Clusterer']]],
|
|
51
|
-
['numobjects',['
|
|
51
|
+
['numobjects',['NumObjects',['../classSVF_1_1NodeIDAllocator_1_1Clusterer.html#afa74c5ccd22bebe0b76db33066d8b498',1,'SVF::NodeIDAllocator::Clusterer::NumObjects()'],['../classSVF_1_1NodeIDAllocator.html#a190c729a3f3f622f82cee4917946b50f',1,'SVF::NodeIDAllocator::numObjects()']]],
|
|
52
52
|
['numofactualin',['numOfActualIn',['../classSVF_1_1SVFGStat.html#a5365744d2ec3594e2255d274f7256569',1,'SVF::SVFGStat']]],
|
|
53
53
|
['numofactualout',['numOfActualOut',['../classSVF_1_1SVFGStat.html#a122555f5c4b9746cc2b7f38c7cd6b505',1,'SVF::SVFGStat']]],
|
|
54
54
|
['numofactualparam',['numOfActualParam',['../classSVF_1_1SVFGStat.html#a0494c59483520b57acdca95952c93d76',1,'SVF::SVFGStat']]],
|
package/include/Util/ExtAPI.h
CHANGED
|
@@ -224,8 +224,10 @@ private:
|
|
|
224
224
|
// Store specifications of external functions in ExtAPI.json file
|
|
225
225
|
static cJSON *root;
|
|
226
226
|
|
|
227
|
+
ExtAPI() = default;
|
|
228
|
+
|
|
227
229
|
public:
|
|
228
|
-
static ExtAPI *getExtAPI();
|
|
230
|
+
static ExtAPI *getExtAPI(const std::string & = "");
|
|
229
231
|
|
|
230
232
|
static void destory();
|
|
231
233
|
|
|
@@ -240,7 +242,7 @@ public:
|
|
|
240
242
|
std::vector<std::string> get_opArgs(const cJSON *value);
|
|
241
243
|
|
|
242
244
|
// Get specifications of external functions in ExtAPI.json file
|
|
243
|
-
cJSON *get_FunJson(const std::string funName);
|
|
245
|
+
cJSON *get_FunJson(const std::string &funName);
|
|
244
246
|
|
|
245
247
|
// Get property of the operation, e.g. "EFT_A1R_A0R"
|
|
246
248
|
extType get_type(const SVF::SVFFunction *callee);
|
|
@@ -262,12 +262,12 @@ bool SVFIRBuilder::computeGepOffset(const User *V, LocationSet& ls)
|
|
|
262
262
|
|
|
263
263
|
// if Options::ModelConsts is disabled. We will treat whole array as one,
|
|
264
264
|
// but we can distinguish different field of an array of struct, e.g. s[1].f1 is differet from s[0].f2
|
|
265
|
-
if(SVFUtil::
|
|
265
|
+
if(const ArrayType* arrTy = SVFUtil::dyn_cast<ArrayType>(gepTy))
|
|
266
266
|
{
|
|
267
|
-
if(!op)
|
|
267
|
+
if(!op || (arrTy->getArrayNumElements() <= (u32_t)op->getSExtValue()))
|
|
268
268
|
continue;
|
|
269
269
|
s32_t idx = op->getSExtValue();
|
|
270
|
-
u32_t offset = SymbolTableInfo::SymbolInfo()->getFlattenedElemIdx(
|
|
270
|
+
u32_t offset = SymbolTableInfo::SymbolInfo()->getFlattenedElemIdx(arrTy, idx);
|
|
271
271
|
ls.setFldIdx(ls.accumulateConstantFieldIdx() + offset);
|
|
272
272
|
}
|
|
273
273
|
else if (const StructType *ST = SVFUtil::dyn_cast<StructType>(gepTy))
|
|
@@ -513,7 +513,7 @@ void SVFIRBuilder::InitialGlobal(const GlobalVariable *gvar, Constant *C,
|
|
|
513
513
|
}
|
|
514
514
|
else
|
|
515
515
|
{
|
|
516
|
-
assert(SVFUtil::isa<ConstantAggregateZero>(data) && "Single value type data should have been handled!");
|
|
516
|
+
assert((SVFUtil::isa<ConstantAggregateZero>(data) || SVFUtil::isa<UndefValue>(data)) && "Single value type data should have been handled!");
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
519
|
}
|
|
@@ -492,7 +492,7 @@ void SymbolTableBuilder::handleGlobalInitializerCE(const Constant *C)
|
|
|
492
492
|
}
|
|
493
493
|
else
|
|
494
494
|
{
|
|
495
|
-
assert(SVFUtil::isa<ConstantAggregateZero>(data) && "Single value type data should have been handled!");
|
|
495
|
+
assert((SVFUtil::isa<ConstantAggregateZero>(data) || SVFUtil::isa<UndefValue>(data)) && "Single value type data should have been handled!");
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
498
|
}
|
package/lib/Util/ExtAPI.cpp
CHANGED
|
@@ -18,59 +18,8 @@ using namespace SVF;
|
|
|
18
18
|
ExtAPI *ExtAPI::extOp = nullptr;
|
|
19
19
|
cJSON *ExtAPI::root = nullptr;
|
|
20
20
|
|
|
21
|
-
ExtAPI *ExtAPI::getExtAPI()
|
|
22
|
-
{
|
|
23
|
-
if (extOp == nullptr)
|
|
24
|
-
{
|
|
25
|
-
extOp = new ExtAPI();
|
|
26
|
-
}
|
|
27
|
-
return extOp;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
void ExtAPI::destory()
|
|
31
|
-
{
|
|
32
|
-
if (extOp != nullptr)
|
|
33
|
-
{
|
|
34
|
-
delete extOp;
|
|
35
|
-
extOp = nullptr;
|
|
36
|
-
}
|
|
37
|
-
if (root != nullptr)
|
|
38
|
-
{
|
|
39
|
-
cJSON_Delete(root);
|
|
40
|
-
root = nullptr;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Get the corresponding name in ext_t, e.g. "EXT_ADDR" in {"addr", EXT_ADDR},
|
|
45
|
-
ExtAPI::extf_t ExtAPI::get_opName(std::string s)
|
|
46
|
-
{
|
|
47
|
-
std::map<std::string, extf_t>::iterator pos = op_pair.find(s);
|
|
48
|
-
if (pos != op_pair.end())
|
|
49
|
-
{
|
|
50
|
-
return pos->second;
|
|
51
|
-
}
|
|
52
|
-
else
|
|
53
|
-
{
|
|
54
|
-
return EXT_OTHER;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Get external function name, e.g "memcpy"
|
|
59
|
-
std::string ExtAPI::get_name(const SVFFunction *F)
|
|
60
|
-
{
|
|
61
|
-
assert(F);
|
|
62
|
-
std::string funName = F->getName();
|
|
63
|
-
if (F->isIntrinsic())
|
|
64
|
-
{
|
|
65
|
-
unsigned start = funName.find('.');
|
|
66
|
-
unsigned end = funName.substr(start + 1).find('.');
|
|
67
|
-
funName = "llvm." + funName.substr(start + 1, end);
|
|
68
|
-
}
|
|
69
|
-
return funName;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
21
|
// Get environment variables $SVF_DIR and "npm root" through popen() method
|
|
73
|
-
std::string GetStdoutFromCommand(std::string command)
|
|
22
|
+
static std::string GetStdoutFromCommand(const std::string &command)
|
|
74
23
|
{
|
|
75
24
|
char buffer[128];
|
|
76
25
|
std::string result = "";
|
|
@@ -94,13 +43,14 @@ std::string GetStdoutFromCommand(std::string command)
|
|
|
94
43
|
}
|
|
95
44
|
|
|
96
45
|
// Get ExtAPI.json file
|
|
97
|
-
|
|
46
|
+
static std::string getJsonFile(const std::string &path)
|
|
98
47
|
{
|
|
99
48
|
std::string jsonFilePath = GetStdoutFromCommand(path);
|
|
100
49
|
if (path.compare("npm root") == 0)
|
|
101
50
|
{
|
|
102
51
|
int os_flag = 1;
|
|
103
|
-
// SVF installed via npm needs to determine the type of operating system,
|
|
52
|
+
// SVF installed via npm needs to determine the type of operating system,
|
|
53
|
+
// otherwise the ExtAPI.json path may not be found
|
|
104
54
|
// Linux os
|
|
105
55
|
#ifdef linux
|
|
106
56
|
os_flag = 0;
|
|
@@ -113,65 +63,136 @@ FILE *getJsonFile(std::string path)
|
|
|
113
63
|
}
|
|
114
64
|
}
|
|
115
65
|
jsonFilePath.append(EXTAPI_JSON_PATH);
|
|
116
|
-
|
|
117
|
-
file = fopen(jsonFilePath.c_str(), "r");
|
|
118
|
-
return file;
|
|
66
|
+
return jsonFilePath;
|
|
119
67
|
}
|
|
120
68
|
|
|
121
|
-
|
|
122
|
-
cJSON *ExtAPI::get_FunJson(const std::string funName)
|
|
69
|
+
static cJSON *parseJson(const std::string &path, off_t fileSize)
|
|
123
70
|
{
|
|
71
|
+
FILE *file = fopen(path.c_str(), "r");
|
|
72
|
+
if (!file)
|
|
73
|
+
{
|
|
74
|
+
return nullptr;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// allocate memory size matched with file size
|
|
78
|
+
char *jsonStr = (char *)calloc(fileSize + 1, sizeof(char));
|
|
79
|
+
|
|
80
|
+
// read json string from file
|
|
81
|
+
u32_t size = fread(jsonStr, sizeof(char), fileSize, file);
|
|
82
|
+
if (size == 0)
|
|
83
|
+
{
|
|
84
|
+
SVFUtil::errs() << SVFUtil::errMsg("\t Wrong ExtAPI.json path!! ") << "The current ExtAPI.json path is: " << path << "\n";
|
|
85
|
+
assert(false && "Read ExtAPI.json file fails!");
|
|
86
|
+
return nullptr;
|
|
87
|
+
}
|
|
88
|
+
fclose(file);
|
|
89
|
+
|
|
90
|
+
// convert json string to json pointer variable
|
|
91
|
+
cJSON *root = cJSON_Parse(jsonStr);
|
|
124
92
|
if (!root)
|
|
125
93
|
{
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
94
|
+
free(jsonStr);
|
|
95
|
+
return nullptr;
|
|
96
|
+
}
|
|
97
|
+
free(jsonStr);
|
|
98
|
+
return root;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
ExtAPI *ExtAPI::getExtAPI(const std::string &path)
|
|
102
|
+
{
|
|
103
|
+
if (extOp == nullptr)
|
|
104
|
+
{
|
|
105
|
+
extOp = new ExtAPI;
|
|
106
|
+
}
|
|
107
|
+
if (root == nullptr)
|
|
108
|
+
{
|
|
109
|
+
struct stat statbuf;
|
|
110
|
+
|
|
111
|
+
// Four ways to get ExtAPI.json path
|
|
112
|
+
// 1. Explicit path provided
|
|
113
|
+
// 2. default path (get ExtAPI.json path from Util/config.h)
|
|
114
|
+
// 3. from $SVF_DIR
|
|
115
|
+
// 4. from "npm root"(If SVF is installed via npm)
|
|
116
|
+
|
|
117
|
+
std::string jsonFilePath = path;
|
|
118
|
+
if (!jsonFilePath.empty() && !stat(jsonFilePath.c_str(), &statbuf))
|
|
136
119
|
{
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
{
|
|
140
|
-
file = getJsonFile("npm root");
|
|
141
|
-
if (file == nullptr)
|
|
142
|
-
{
|
|
143
|
-
assert(false && "Open ExtAPI.json file fails!");
|
|
144
|
-
return nullptr;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
120
|
+
root = parseJson(jsonFilePath, statbuf.st_size);
|
|
121
|
+
return extOp;
|
|
147
122
|
}
|
|
148
|
-
// get file size
|
|
149
|
-
struct stat statbuf;
|
|
150
|
-
stat(jsonFilePath.c_str(), &statbuf);
|
|
151
|
-
u32_t fileSize = statbuf.st_size;
|
|
152
123
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
124
|
+
jsonFilePath = PROJECT_PATH + std::string(EXTAPI_JSON_PATH);
|
|
125
|
+
if (!stat(jsonFilePath.c_str(), &statbuf))
|
|
126
|
+
{
|
|
127
|
+
root = parseJson(jsonFilePath, statbuf.st_size);
|
|
128
|
+
return extOp;
|
|
129
|
+
}
|
|
156
130
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if (size == 0)
|
|
131
|
+
jsonFilePath = getJsonFile("$SVF_DIR");
|
|
132
|
+
if (!stat(jsonFilePath.c_str(), &statbuf))
|
|
160
133
|
{
|
|
161
|
-
|
|
162
|
-
return
|
|
134
|
+
root = parseJson(jsonFilePath, statbuf.st_size);
|
|
135
|
+
return extOp;
|
|
163
136
|
}
|
|
164
|
-
fclose(file);
|
|
165
137
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if (!root)
|
|
138
|
+
jsonFilePath = getJsonFile("npm root");
|
|
139
|
+
if (!stat(jsonFilePath.c_str(), &statbuf))
|
|
169
140
|
{
|
|
170
|
-
|
|
171
|
-
return
|
|
141
|
+
root = parseJson(jsonFilePath, statbuf.st_size);
|
|
142
|
+
return extOp;
|
|
172
143
|
}
|
|
173
|
-
|
|
144
|
+
|
|
145
|
+
assert(false && "Open ExtAPI.json file fails!");
|
|
146
|
+
}
|
|
147
|
+
return extOp;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
void ExtAPI::destory()
|
|
151
|
+
{
|
|
152
|
+
if (extOp != nullptr)
|
|
153
|
+
{
|
|
154
|
+
delete extOp;
|
|
155
|
+
extOp = nullptr;
|
|
156
|
+
}
|
|
157
|
+
if (root != nullptr)
|
|
158
|
+
{
|
|
159
|
+
cJSON_Delete(root);
|
|
160
|
+
root = nullptr;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Get the corresponding name in ext_t, e.g. "EXT_ADDR" in {"addr", EXT_ADDR},
|
|
165
|
+
ExtAPI::extf_t ExtAPI::get_opName(std::string s)
|
|
166
|
+
{
|
|
167
|
+
std::map<std::string, extf_t>::iterator pos = op_pair.find(s);
|
|
168
|
+
if (pos != op_pair.end())
|
|
169
|
+
{
|
|
170
|
+
return pos->second;
|
|
171
|
+
}
|
|
172
|
+
else
|
|
173
|
+
{
|
|
174
|
+
return EXT_OTHER;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Get external function name, e.g "memcpy"
|
|
179
|
+
std::string ExtAPI::get_name(const SVFFunction *F)
|
|
180
|
+
{
|
|
181
|
+
assert(F);
|
|
182
|
+
std::string funName = F->getName();
|
|
183
|
+
if (F->isIntrinsic())
|
|
184
|
+
{
|
|
185
|
+
unsigned start = funName.find('.');
|
|
186
|
+
unsigned end = funName.substr(start + 1).find('.');
|
|
187
|
+
funName = "llvm." + funName.substr(start + 1, end);
|
|
174
188
|
}
|
|
189
|
+
return funName;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Get specifications of external functions in ExtAPI.json file
|
|
193
|
+
cJSON *ExtAPI::get_FunJson(const std::string &funName)
|
|
194
|
+
{
|
|
195
|
+
assert(root && "JSON not loaded");
|
|
175
196
|
return cJSON_GetObjectItemCaseSensitive(root, funName.c_str());
|
|
176
197
|
}
|
|
177
198
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.503",
|
|
4
4
|
"description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|