|
Static Value-Flow Analysis
|
Classes | |
| struct | DemangledName |
| class | CXXABI |
| class | ItaniumABI |
| class | MSVCABI |
Functions | |
| CXXABI * | getCXXABI () |
| CXXABI * | getCXXABI (const Module *M) |
| CXXABI * | getCXXABI (const Value *val) |
| struct DemangledName | demangle (const std::string &name) |
| Set< std::string > | getClsNamesInBrackets (const std::string &name) |
| std::string | getBeforeBrackets (const std::string &name) |
| std::string | getClassNameFromVtblObj (const std::string &vtblName) |
| const ConstantStruct * | getVtblStruct (const GlobalValue *vtbl) |
| bool | isValVtbl (const Value *val) |
| A carefully crafted input such as FakeVTable _ZTV1A = {{nullptr, nullptr}}; can forge a vtable; detection is approximate and heuristic. | |
| bool | isVirtualCallSite (const CallBase *cs) |
| bool | isConstructor (const Function *F) |
| bool | isDestructor (const Function *F) |
| bool | isCPPThunkFunction (const Function *F) |
| const Function * | getThunkTarget (const Function *F) |
| const Argument * | getConstructorThisPtr (const Function *fun) |
| const Value * | getVCallThisPtr (const CallBase *cs) |
| const Value * | getVCallVtblPtr (const CallBase *cs) |
| s32_t | getVCallIdx (const CallBase *cs) |
| bool | classTyHasVTable (const StructType *ty) |
| std::string | getClassNameFromType (const StructType *ty) |
| Set< std::string > | getClassNameOfThisPtr (const CallBase *cs) |
| std::string | getFunNameOfVCallSite (const CallBase *cs) |
| bool | VCallInCtorOrDtor (const CallBase *cs) |
| bool | isSameThisPtrInConstructor (const Argument *thisPtr1, const Value *thisPtr2) |
| Set< std::string > | extractClsNamesFromFunc (const Function *foo) |
| extract class name from the c++ function name, e.g., constructor/destructors | |
| Set< std::string > | extractClsNamesFromTemplate (const std::string &oname) |
| extract class names from template functions | |
| bool | isClsNameSource (const Value *val) |
| bool | matchesLabel (const std::string &foo, const std::string &label) |
| whether foo matches the mangler label | |
| bool | isTemplateFunc (const Function *foo) |
| whether foo is a cpp template function | |
| bool | isDynCast (const Function *foo) |
| whether foo is a cpp dyncast function | |
| std::string | extractClsNameFromDynCast (const CallBase *callBase) |
| extract class name from cpp dyncast function | |
| const Type * | cppClsNameToType (const std::string &className) |
| bool SVF::cppUtil::classTyHasVTable | ( | const StructType * | ty | ) |
Definition at line 602 of file CppUtil.cpp.
| const Type * SVF::cppUtil::cppClsNameToType | ( | const std::string & | className | ) |
Definition at line 967 of file CppUtil.cpp.
| struct cppUtil::DemangledName SVF::cppUtil::demangle | ( | const std::string & | name | ) |
Definition at line 195 of file CppUtil.cpp.
| std::string SVF::cppUtil::extractClsNameFromDynCast | ( | const CallBase * | callBase | ) |
extract class name from cpp dyncast function
extract class name from cpp dyncast function
| callBase |
Definition at line 951 of file CppUtil.cpp.
extract class name from the c++ function name, e.g., constructor/destructors
extract class name from the c++ function name, e.g., constructor/destructors
| foo |
Definition at line 739 of file CppUtil.cpp.
| Set< std::string > SVF::cppUtil::extractClsNamesFromTemplate | ( | const std::string & | oname | ) |
extract class names from template functions
extract class names from template functions
| oname |
Definition at line 853 of file CppUtil.cpp.
| std::string SVF::cppUtil::getBeforeBrackets | ( | const std::string & | name | ) |
get class name before brackets e.g., for namespace::A<...::...>::f', we get namespace::A'
Definition at line 127 of file CppUtil.cpp.
| std::string SVF::cppUtil::getClassNameFromType | ( | const StructType * | ty | ) |
Definition at line 616 of file CppUtil.cpp.
| std::string SVF::cppUtil::getClassNameFromVtblObj | ( | const std::string & | vtblName | ) |
Definition at line 256 of file CppUtil.cpp.
Definition at line 634 of file CppUtil.cpp.
| Set< std::string > SVF::cppUtil::getClsNamesInBrackets | ( | const std::string & | name | ) |
Definition at line 202 of file CppUtil.cpp.
Definition at line 486 of file CppUtil.cpp.
| CXXABI * SVF::cppUtil::getCXXABI | ( | ) |
Definition at line 1015 of file CppUtil.cpp.
Definition at line 979 of file CppUtil.cpp.
Definition at line 995 of file CppUtil.cpp.
| std::string SVF::cppUtil::getFunNameOfVCallSite | ( | const CallBase * | cs | ) |
Definition at line 668 of file CppUtil.cpp.
Definition at line 347 of file CppUtil.cpp.
Definition at line 679 of file CppUtil.cpp.
Definition at line 369 of file CppUtil.cpp.
Definition at line 570 of file CppUtil.cpp.
| const ConstantStruct * SVF::cppUtil::getVtblStruct | ( | const GlobalValue * | vtbl | ) |
Definition at line 261 of file CppUtil.cpp.
| bool SVF::cppUtil::isClsNameSource | ( | const Value * | val | ) |
class sources can be heap allocation or functions where we can extract the class name (constructors/destructors or template functions)
class sources are functions where we can extract the class name (constructors/destructors or template functions)
| val |
Definition at line 893 of file CppUtil.cpp.
| bool SVF::cppUtil::isConstructor | ( | const Function * | F | ) |
TODO: on mac os function name is an empty string after demangling
Definition at line 522 of file CppUtil.cpp.
| bool SVF::cppUtil::isCPPThunkFunction | ( | const Function * | F | ) |
Definition at line 341 of file CppUtil.cpp.
| bool SVF::cppUtil::isDestructor | ( | const Function * | F | ) |
Definition at line 542 of file CppUtil.cpp.
| bool SVF::cppUtil::isDynCast | ( | const Function * | foo | ) |
whether foo is a cpp dyncast function
whether foo is a cpp dyncast function
| foo |
Definition at line 941 of file CppUtil.cpp.
Given an inheritance relation B is a child of A We assume B::B(thisPtr1){ A::A(thisPtr2) } such that thisPtr1 == thisPtr2
=== Typed pointer mode === this.addr = alloca class.B1* store class.B1* this, class.B1** this.addr this1 = load class.B1*, class.B1** this.addr %0 = bitcast class.B1* this1 to class.A* call void @A::A()(class.A* %0)
=== Opaque pointer mode ===
Case 1: Primary base class (offset 0) at O1+ call ptr @Base::Base(ptr this) → thisPtr2 == thisPtr1, return true
Case 2: Primary base class (offset 0) at O0 this.addr = alloca ptr store ptr this, ptr this.addr this1 = load ptr, ptr this.addr call void @Base::Base(ptr this1) → thisPtr2 is LoadInst from alloca storing thisPtr1, return true
Case 3: Non-primary base class (multiple inheritance, offset > 0) %0 = getelementptr inbounds i8, ptr this1, i64 4 call void @Base2::Base2(ptr %0) → i8 GEP from this, return true
Case 4: Member field initialization (NOT base class) mem = getelementptr inbounds struct.Derived, ptr this1, i32 0, i32 1 call void @Member::Member(ptr mem) → struct GEP from this, return false
Definition at line 442 of file CppUtil.cpp.
| bool SVF::cppUtil::isTemplateFunc | ( | const Function * | foo | ) |
whether foo is a cpp template function
whether foo is a cpp template function TODO: we only consider limited label for now (see the very beginning of CppUtil.cpp)
| foo |
Definition at line 926 of file CppUtil.cpp.
| bool SVF::cppUtil::isValVtbl | ( | const Value * | val | ) |
A carefully crafted input such as FakeVTable _ZTV1A = {{nullptr, nullptr}}; can forge a vtable; detection is approximate and heuristic.
Definition at line 295 of file CppUtil.cpp.
| bool SVF::cppUtil::isVirtualCallSite | ( | const CallBase * | cs | ) |
Definition at line 310 of file CppUtil.cpp.
| bool SVF::cppUtil::matchesLabel | ( | const std::string & | foo, |
| const std::string & | label ) |
whether foo matches the mangler label
whether fooName matches the mangler label
| foo | |
| label |
Definition at line 915 of file CppUtil.cpp.
| bool SVF::cppUtil::VCallInCtorOrDtor | ( | const CallBase * | cs | ) |
Definition at line 586 of file CppUtil.cpp.