svf-tools 1.0.1176 → 1.0.1177
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/package.json +1 -1
- package/svf-llvm/lib/CHGBuilder.cpp +3 -4
- package/svf-llvm/lib/CppUtil.cpp +82 -11
- package/SVF-doxygen/doxygen.config +0 -2548
- package/SVF-doxygen/wiki/PAG.png +0 -0
- package/SVF-doxygen/wiki/andersen.png +0 -0
- package/SVF-doxygen/wiki/callgraph.png +0 -0
- package/SVF-doxygen/wiki/consG.png +0 -0
- package/SVF-doxygen/wiki/cpu2000-flto +0 -432
- package/SVF-doxygen/wiki/cpu2006-flto +0 -417
- package/SVF-doxygen/wiki/cpu2017-wllvm.cfg +0 -999
- package/SVF-doxygen/wiki/database.png +0 -0
- package/SVF-doxygen/wiki/framework.png +0 -0
- package/SVF-doxygen/wiki/help.png +0 -0
- package/SVF-doxygen/wiki/icfg.png +0 -0
- package/SVF-doxygen/wiki/mssa-cha.png +0 -0
- package/SVF-doxygen/wiki/pagedge.png +0 -0
- package/SVF-doxygen/wiki/pagnode.png +0 -0
- package/SVF-doxygen/wiki/pt.png +0 -0
- package/SVF-doxygen/wiki/setupcmake.png +0 -0
- package/SVF-doxygen/wiki/setupconfiguration.png +0 -0
- package/SVF-doxygen/wiki/setupdashboard.png +0 -0
- package/SVF-doxygen/wiki/setupdebug.png +0 -0
- package/SVF-doxygen/wiki/setupenv.png +0 -0
- package/SVF-doxygen/wiki/startup.png +0 -0
- package/SVF-doxygen/wiki/svf-stat.pdf +0 -0
- package/SVF-doxygen/wiki/svfg-framework.png +0 -0
- package/SVF-doxygen/wiki/svfg.png +0 -0
- package/SVF-doxygen/wiki/svfg_opt.png +0 -0
- package/SVF-doxygen/wiki/svfgedge-cha.png +0 -0
- package/SVF-doxygen/wiki/svfgnode-cha.png +0 -0
- package/SVF-doxygen/wiki/svfpic/README.md +0 -6
- package/SVF-doxygen/wiki/svfpic/ass-1debug1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/ass-1debug2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/build.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/cmd.png +0 -0
- package/SVF-doxygen/wiki/svfpic/connect1.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/connect2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/connect3.png +0 -0
- package/SVF-doxygen/wiki/svfpic/connect4.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/connect5.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/connect6.png +0 -0
- package/SVF-doxygen/wiki/svfpic/connect7.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/continue.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug-new.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug-new2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug1.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/debug2.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/debug3.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug4.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug5.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/debug6.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/docker_sys_requirement.png +0 -0
- package/SVF-doxygen/wiki/svfpic/docker_sys_requirements.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild2.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild3.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild4.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild5.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuildimage.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockercmd.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockercmd2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockercontainer.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb1.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb10.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb2.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb3.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb4.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb5.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb6.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb7.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb8.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb9.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerfinshbuilt.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerimage.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockernameImage.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerpull.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerpull2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/download.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/extension1.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/extension2.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/graphviz.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hellodb.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hellodb2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hviz_0.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hviz_1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hviz_2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/installC:C++Ext.png +0 -0
- package/SVF-doxygen/wiki/svfpic/installCMakeExt.png +0 -0
- package/SVF-doxygen/wiki/svfpic/installRCext.png +0 -0
- package/SVF-doxygen/wiki/svfpic/installdockerext.png +0 -0
- package/SVF-doxygen/wiki/svfpic/launch1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/openfile.png +0 -0
- package/SVF-doxygen/wiki/svfpic/pathfolder.png +0 -0
- package/SVF-doxygen/wiki/svfpic/restart.png +0 -0
- package/SVF-doxygen/wiki/svfpic/rundocker.png +0 -0
- package/SVF-doxygen/wiki/svfpic/runinCLI.png +0 -0
- package/SVF-doxygen/wiki/svfpic/screen.png +0 -0
- package/SVF-doxygen/wiki/svfpic/settings1.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/settings2.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/settings3.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/shortlists.png +0 -0
- package/SVF-doxygen/wiki/svfpic/start.png +0 -0
- package/SVF-doxygen/wiki/svfpic/start1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/update0.png +0 -0
- package/SVF-doxygen/wiki/svfpic/verify_docker.png +0 -0
- package/SVF-doxygen/wiki/svfpic/vs_entry_window.png +0 -0
- package/SVF-doxygen/wiki/svfpic/wsl.png +0 -0
- package/SVF-doxygen/wiki/svfpic/wsl_1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/wsl_2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/wsl_3.png +0 -0
- package/SVF-doxygen/wiki/tools.png +0 -0
- package/SVF-doxygen/wiki/users.png +0 -0
- package/SVF-doxygen/wiki/vm1.png +0 -0
- package/SVF-doxygen/wiki/vm2.png +0 -0
- package/SVF-doxygen/wiki/vm3.png +0 -0
- package/SVF-doxygen/wiki/vm4.png +0 -0
- package/SVF-doxygen/wiki/vm5.png +0 -0
- package/SVF-doxygen/wiki/vscode_build_tasks.png +0 -0
- package/SVF-doxygen/wiki/vscode_cpp_extension.png +0 -0
- package/SVF-doxygen/wiki/vscode_debug_list.png +0 -0
- package/SVF-doxygen/wiki/vscode_dir_structure.png +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1177",
|
|
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": {
|
|
@@ -174,10 +174,9 @@ void CHGBuilder::connectInheritEdgeViaCall(const Function* caller, const CallBas
|
|
|
174
174
|
if (cs->arg_size() < 1 || (cs->arg_size() < 2 && cs->paramHasAttr(0, llvm::Attribute::StructRet)))
|
|
175
175
|
return;
|
|
176
176
|
const Value* csThisPtr = cppUtil::getVCallThisPtr(cs);
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (csThisPtr != nullptr && samePtrTrue)
|
|
177
|
+
const Argument* consThisPtr = getConstructorThisPtr(caller);
|
|
178
|
+
bool samePtr = isSameThisPtrInConstructor(consThisPtr, csThisPtr);
|
|
179
|
+
if (csThisPtr != nullptr && samePtr)
|
|
181
180
|
{
|
|
182
181
|
struct DemangledName basename = demangle(callee->getName().str());
|
|
183
182
|
if (!LLVMUtil::isCallSite(csThisPtr) &&
|
package/svf-llvm/lib/CppUtil.cpp
CHANGED
|
@@ -420,25 +420,92 @@ const Value* cppUtil::getVCallThisPtr(const CallBase* cs)
|
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
422
|
|
|
423
|
+
/// Check if V is derived from thisPtr
|
|
424
|
+
/// Handles O0 pattern: %this1 = load ptr, ptr %this.addr
|
|
425
|
+
static bool isDerivedFromThisPtr(const Argument* thisPtr, const Value* V)
|
|
426
|
+
{
|
|
427
|
+
V = V->stripPointerCasts();
|
|
428
|
+
if (V == thisPtr)
|
|
429
|
+
return true;
|
|
430
|
+
|
|
431
|
+
if (const LoadInst* load = SVFUtil::dyn_cast<LoadInst>(V))
|
|
432
|
+
{
|
|
433
|
+
if (const AllocaInst* alloca =
|
|
434
|
+
SVFUtil::dyn_cast<AllocaInst>(load->getPointerOperand()))
|
|
435
|
+
{
|
|
436
|
+
for (const User* U : alloca->users())
|
|
437
|
+
{
|
|
438
|
+
if (const StoreInst* store = SVFUtil::dyn_cast<StoreInst>(U))
|
|
439
|
+
{
|
|
440
|
+
if (store->getPointerOperand() == alloca &&
|
|
441
|
+
store->getValueOperand()->stripPointerCasts() == thisPtr)
|
|
442
|
+
return true;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return false;
|
|
448
|
+
}
|
|
449
|
+
|
|
423
450
|
/*!
|
|
424
|
-
* Given
|
|
451
|
+
* Given an inheritance relation B is a child of A
|
|
425
452
|
* We assume B::B(thisPtr1){ A::A(thisPtr2) } such that thisPtr1 == thisPtr2
|
|
426
|
-
* In the following code thisPtr1 is "%class.B1* %this" and thisPtr2 is
|
|
427
|
-
* "%class.A* %0".
|
|
428
453
|
*
|
|
454
|
+
* === Typed pointer mode ===
|
|
455
|
+
* %this.addr = alloca %class.B1*
|
|
456
|
+
* store %class.B1* %this, %class.B1** %this.addr
|
|
457
|
+
* %this1 = load %class.B1*, %class.B1** %this.addr
|
|
458
|
+
* %0 = bitcast %class.B1* %this1 to %class.A*
|
|
459
|
+
* call void @A::A()(%class.A* %0)
|
|
429
460
|
*
|
|
430
|
-
*
|
|
431
|
-
*
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
*
|
|
461
|
+
* === Opaque pointer mode ===
|
|
462
|
+
*
|
|
463
|
+
* Case 1: Primary base class (offset 0) at O1+
|
|
464
|
+
* call ptr @Base::Base(ptr %this)
|
|
465
|
+
* → thisPtr2 == thisPtr1, return true
|
|
466
|
+
*
|
|
467
|
+
* Case 2: Primary base class (offset 0) at O0
|
|
468
|
+
* %this.addr = alloca ptr
|
|
469
|
+
* store ptr %this, ptr %this.addr
|
|
470
|
+
* %this1 = load ptr, ptr %this.addr
|
|
471
|
+
* call void @Base::Base(ptr %this1)
|
|
472
|
+
* → thisPtr2 is LoadInst from alloca storing thisPtr1, return true
|
|
473
|
+
*
|
|
474
|
+
* Case 3: Non-primary base class (multiple inheritance, offset > 0)
|
|
475
|
+
* %0 = getelementptr inbounds i8, ptr %this1, i64 4
|
|
476
|
+
* call void @Base2::Base2(ptr %0)
|
|
477
|
+
* → i8 GEP from this, return true
|
|
478
|
+
*
|
|
479
|
+
* Case 4: Member field initialization (NOT base class)
|
|
480
|
+
* %mem = getelementptr inbounds %struct.Derived, ptr %this1, i32 0, i32 1
|
|
481
|
+
* call void @Member::Member(ptr %mem)
|
|
482
|
+
* → struct GEP from this, return false
|
|
436
483
|
*/
|
|
437
484
|
bool cppUtil::isSameThisPtrInConstructor(const Argument* thisPtr1,
|
|
438
485
|
const Value* thisPtr2)
|
|
439
486
|
{
|
|
440
487
|
if (thisPtr1 == thisPtr2)
|
|
441
488
|
return true;
|
|
489
|
+
|
|
490
|
+
const Value* stripped = thisPtr2->stripPointerCasts();
|
|
491
|
+
if (stripped == thisPtr1)
|
|
492
|
+
return true;
|
|
493
|
+
|
|
494
|
+
// === Opaque pointer: Load from this.addr (Case 2: primary base at O0) ===
|
|
495
|
+
if (isDerivedFromThisPtr(thisPtr1, stripped))
|
|
496
|
+
return true;
|
|
497
|
+
|
|
498
|
+
// === Opaque pointer: GEP check (Case 3 & 4) ===
|
|
499
|
+
if (const GetElementPtrInst* GEP = SVFUtil::dyn_cast<GetElementPtrInst>(stripped))
|
|
500
|
+
{
|
|
501
|
+
if (!isDerivedFromThisPtr(thisPtr1, GEP->getPointerOperand()))
|
|
502
|
+
return false;
|
|
503
|
+
// i8 GEP = non-primary base class (Case 3)
|
|
504
|
+
// struct GEP = member field (Case 4)
|
|
505
|
+
return GEP->getSourceElementType()->isIntegerTy(8);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// === Typed pointer (legacy): store -> load -> bitcast ===
|
|
442
509
|
for (const Value* thisU : thisPtr1->users())
|
|
443
510
|
{
|
|
444
511
|
if (const StoreInst* store = SVFUtil::dyn_cast<StoreInst>(thisU))
|
|
@@ -463,7 +530,11 @@ const Argument* cppUtil::getConstructorThisPtr(const Function* fun)
|
|
|
463
530
|
assert((isConstructor(fun) || isDestructor(fun)) &&
|
|
464
531
|
"not a constructor?");
|
|
465
532
|
assert(fun->arg_size() >= 1 && "argument size >= 1?");
|
|
466
|
-
const
|
|
533
|
+
const bool isStructRet = fun->hasParamAttribute(0, llvm::Attribute::StructRet);
|
|
534
|
+
assert((isStructRet ? fun->arg_size() >= 2 : true) &&
|
|
535
|
+
"argument size for struct ret constructor >= 2?");
|
|
536
|
+
const Argument* thisPtr = isStructRet ?
|
|
537
|
+
fun->getArg(1) : fun->getArg(0);
|
|
467
538
|
return thisPtr;
|
|
468
539
|
}
|
|
469
540
|
|
|
@@ -936,4 +1007,4 @@ const Type *cppUtil::cppClsNameToType(const std::string &className)
|
|
|
936
1007
|
StructType *classTy = StructType::getTypeByName(LLVMModuleSet::getLLVMModuleSet()->getContext(),
|
|
937
1008
|
clsName + className);
|
|
938
1009
|
return classTy ? classTy : LLVMModuleSet::getLLVMModuleSet()->getTypeInference()->ptrType();
|
|
939
|
-
}
|
|
1010
|
+
}
|