Static Value-Flow Analysis
|
Dwarf based CHG. More...
#include <DCHG.h>
Static Public Member Functions | |
static const DIType * | stripQualifiers (const DIType *) |
Returns the DIType beneath the qualifiers. Does not strip away "DW_TAG_members". | |
static const DIType * | stripArray (const DIType *) |
Returns the DIType beneath all qualifiers and arrays. | |
static bool | teq (const DIType *t1, const DIType *t2) |
static std::string | diTypeToStr (const DIType *) |
Returns a human-readable version of the DIType. | |
static bool | isAgg (const DIType *t) |
static bool | classof (const CommonCHGraph *chg) |
Protected Attributes | |
const SVFModule * | svfModule |
SVF Module this CHG is built from. | |
bool | extended = false |
Whether this CHG is an extended CHG (first-field). Set by buildCHG. | |
Map< const DIType *, DCHNode * > | diTypeToNodeMap |
Maps DITypes to their nodes. | |
Map< const SVFGlobalValue *, const DIType * > | vtblToTypeMap |
Maps VTables to the DIType associated with them. | |
Map< const DIType *, NodeBS > | chaMap |
Maps types to all children (i.e. CHA). | |
Map< const DIType *, NodeBS > | chaFFMap |
Maps types to all children but also considering first field. | |
Map< const DIType *, VTableSet > | vtblCHAMap |
Maps types to a set with their vtable and all their children's. | |
Map< const CallICFGNode *, VFunSet > | csCHAMap |
Maps callsites to a set of potential virtual functions based on CHA. | |
Map< const DIType *, const DIType * > | canonicalTypeMap |
Maps types to their canonical type (many-to-one). | |
Set< const DIType * > | canonicalTypes |
Set of all possible canonical types (i.e. values of canonicalTypeMap). | |
Map< const DIType *, std::vector< const DIType * > > | fieldTypes |
Maps types to their flattened fields' types. | |
Map< const DIType *, Set< const DIType * > > | containingAggs |
Maps aggregate types to all the aggregate types it transitively contains. | |
Protected Attributes inherited from SVF::CommonCHGraph | |
CHGKind | kind |
Protected Attributes inherited from SVF::GenericGraph< DCHNode, DCHEdge > | |
IDToNodeMapTy | IDToNodeMap |
node map | |
Private Member Functions | |
void | handleDIBasicType (const DIBasicType *basicType) |
Construction helper to process DIBasicTypes. | |
void | handleDICompositeType (const DICompositeType *compositeType) |
Construction helper to process DICompositeTypes. | |
void | handleDIDerivedType (const DIDerivedType *derivedType) |
Construction helper to process DIDerivedTypes. | |
void | handleDISubroutineType (const DISubroutineType *subroutineType) |
Construction helper to process DISubroutineTypes. | |
void | buildVTables (const SVFModule &module) |
Finds all defined virtual functions and attaches them to nodes. | |
const NodeBS & | cha (const DIType *type, bool firstField) |
Returns a set of all children of type (CHA). Also gradually builds chaMap. | |
void | handleTypedef (const DIType *typedefType) |
Attaches the typedef(s) to the base node. | |
void | flatten (const DICompositeType *type) |
Populates fieldTypes for type and all its elements. | |
void | gatherAggs (const DICompositeType *type) |
Populates containingAggs for type and all its elements. | |
DCHNode * | getOrCreateNode (const DIType *type) |
Creates a node from type, or returns it if it exists. | |
const DIType * | getCSStaticType (CallBase *cs) const |
Retrieves the metadata associated with a virtual callsite. | |
const DIType * | getCSStaticType (const CallICFGNode *cs) const |
bool | hasNode (const DIType *type) |
Checks if a node exists for type. | |
DCHNode * | getNode (const DIType *type) |
Returns the node for type (nullptr if it doesn't exist). | |
DCHEdge * | addEdge (const DIType *t1, const DIType *t2, DCHEdge::GEdgeKind et) |
Creates an edge between from t1 to t2. | |
DCHEdge * | hasEdge (const DIType *t1, const DIType *t2, DCHEdge::GEdgeKind et) |
Returns the edge between t1 and t2 if it exists, returns nullptr otherwise. | |
Private Attributes | |
NodeID | numTypes |
Number of types (nodes) in the graph. | |
Additional Inherited Members | |
Public Types inherited from SVF::CommonCHGraph | |
enum | CHGKind { Standard , DI } |
Public Types inherited from SVF::GenericGraph< DCHNode, DCHEdge > | |
typedef DCHNode | NodeType |
typedef DCHEdge | EdgeType |
typedef OrderedMap< NodeID, NodeType * > | IDToNodeMapTy |
NodeID to GenericNode map. | |
typedef IDToNodeMapTy::iterator | iterator |
Node Iterators. | |
typedef IDToNodeMapTy::const_iterator | const_iterator |
Public Attributes inherited from SVF::GenericGraph< DCHNode, DCHEdge > | |
u32_t | edgeNum |
total num of node | |
u32_t | nodeNum |
total num of edge | |
Creates an edge between from t1 to t2.
Definition at line 433 of file DCHG.cpp.
|
virtual |
Builds the CHG from DWARF debug information. extend determines whether to extend the CHG with first field edges.
Definition at line 469 of file DCHG.cpp.
Finds all defined virtual functions and attaches them to nodes.
Definition at line 166 of file DCHG.cpp.
Returns a set of all children of type (CHA). Also gradually builds chaMap.
Definition at line 223 of file DCHG.cpp.
|
inlinestatic |
|
inlineoverridevirtual |
Implements SVF::CommonCHGraph.
Definition at line 259 of file DCHG.h.
|
inlineoverridevirtual |
Implements SVF::CommonCHGraph.
Returns a human-readable version of the DIType.
Definition at line 967 of file DCHG.cpp.
|
inline |
Definition at line 245 of file DCHG.h.
|
private |
Populates fieldTypes for type and all its elements.
Definition at line 268 of file DCHG.cpp.
|
private |
Populates containingAggs for type and all its elements.
Definition at line 353 of file DCHG.cpp.
Returns all the aggregates contained (transitively) in base.
Definition at line 351 of file DCHG.h.
Returns the type representing all qualifier-variations of t. This should only matter in the case of DerivedTypes where qualifiers and have qualified base types cause a mess.
Definition at line 722 of file DCHG.cpp.
|
inlineprivate |
|
overridevirtual |
Implements SVF::CommonCHGraph.
Definition at line 547 of file DCHG.cpp.
|
overridevirtual |
Implements SVF::CommonCHGraph.
Definition at line 564 of file DCHG.cpp.
Returns the type of field number idx (flattened) in base.
Definition at line 298 of file DCHG.h.
Returns a vector of the types of all fields in base.
Returns the node for type (nullptr if it doesn't exist).
Definition at line 431 of file DCHG.h.
Creates a node from type, or returns it if it exists.
Definition at line 406 of file DCHG.cpp.
|
overridevirtual |
Implements SVF::CommonCHGraph.
Definition at line 592 of file DCHG.cpp.
|
private |
Construction helper to process DIBasicTypes.
|
private |
Construction helper to process DICompositeTypes.
Definition at line 27 of file DCHG.cpp.
|
private |
Construction helper to process DIDerivedTypes.
Definition at line 97 of file DCHG.cpp.
|
private |
Construction helper to process DISubroutineTypes.
Attaches the typedef(s) to the base node.
Definition at line 138 of file DCHG.cpp.
Returns true if a is a transitive base of b. firstField determines whether to consider first-field edges.
Returns true if f is a field of b (fields from getFieldTypes).
Definition at line 686 of file DCHG.cpp.
Definition at line 940 of file DCHG.cpp.
void DCHGraph::print | ( | void | ) |
Definition at line 1140 of file DCHG.cpp.
Returns the DIType beneath all qualifiers and arrays.
Definition at line 816 of file DCHG.cpp.
Returns the DIType beneath the qualifiers. Does not strip away "DW_TAG_members".
Definition at line 763 of file DCHG.cpp.
Returns true if t1 and t2 are equivalent, ignoring qualifiers. For equality... Tags always need to be equal. DIBasicType: shallow pointer equality. DIDerivedType: base types (teq). DICompositeType: shallow pointer equality. DISubroutineType: shallow pointer equality.
Definition at line 828 of file DCHG.cpp.
|
protected |
|
private |
|
protected |