35#include <sys/resource.h>
40#define KNRM "\x1B[1;0m"
41#define KRED "\x1B[1;31m"
42#define KGRN "\x1B[1;32m"
43#define KYEL "\x1B[1;33m"
44#define KBLU "\x1B[1;34m"
45#define KPUR "\x1B[1;35m"
46#define KCYA "\x1B[1;36m"
47#define KWHT "\x1B[1;37m"
110 outs() <<
"node " << node <<
" points-to: {";
126 for (PointsToList::const_iterator
ii =
ptl.begin(),
ie =
ptl.end();
140 outs() <<
"node " << node <<
" alias set: {";
153 O <<
" " << *
ii <<
" ";
161 o <<
" " <<
n <<
" ";
250 if (
const SVFCallInst* call = SVFUtil::dyn_cast<SVFCallInst>(inst))
252 const SVFFunction* func = call->getCalledFunction();
276 assert(
false &&
"SVFUtil::hclustMethodToString: unknown method");
331 return SVFUtil::isa<CallICFGNode>(inst);
336 if (
const CallICFGNode* call = SVFUtil::dyn_cast<CallICFGNode>(inst))
338 const SVFFunction* func = call->getCalledFunction();
366 if(!isCallSite(node))
return false;
372 if(!isCallSite(cs))
return false;
432 return SVFUtil::dyn_cast<ObjVar>((*
valVar->getInEdges().begin())->getSrcNode());
#define KNRM
Color for output format.
const std::string & getName() const
const SVFFunction * getFunction() const
Get function of this call node.
const SVFFunction * getCalledFunction() const
static const Option< bool > DisableWarn
virtual const SVFType * getType() const
CallGraph * getCallGraph()
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
bool isTDFork(const CallICFGNode *inst) const
Return true if this call create a new thread.
static ThreadAPI * getThreadAPI()
Return a static reference.
char * strtok(char *str, const char *delim)
char * strstr(const char *haystack, const char *needle)
bool isReallocExtCall(const CallICFGNode *cs)
std::string sucMsg(const std::string &msg)
Returns successful message by converting a string into green string output.
void increaseStackSize()
Increase the stack size limit.
const ObjVar * getObjVarOfValVar(const ValVar *valVar)
std::string bugMsg1(const std::string &msg)
std::string hclustMethodToString(hclust_fast_methods method)
Returns a string representation of a hclust method.
void stopAnalysisLimitTimer(bool limitTimerSet)
bool isHeapAllocExtFunViaRet(const SVFFunction *fun)
Return true if the call is a heap allocator/reallocator.
bool isExtCall(const SVFFunction *fun)
std::string pasMsg(const std::string &msg)
Print each pass/phase message by converting a string into blue string output.
OrderedSet< PointsTo, equalPointsTo > PointsToList
void dumpAliasSet(unsigned node, NodeBS To)
Dump alias set.
bool getMemoryUsageKB(u32_t *vmrss_kb, u32_t *vmsize_kb)
Get memory usage from system file. Return TRUE if succeed.
void reportMemoryUsageKB(const std::string &infor, OutStream &O=SVFUtil::outs())
Print memory usage in KB.
bool startAnalysisLimitTimer(unsigned timeLimit)
std::string errMsg(const std::string &msg)
Print error message by converting a string into red string output.
std::string bugMsg3(const std::string &msg)
bool isHeapAllocExtCallViaArg(const CallICFGNode *cs)
bool isHeapAllocExtCall(const ICFGNode *cs)
u32_t getHeapAllocHoldingArgPosition(const SVFFunction *fun)
Get the position of argument that holds an allocated heap object.
bool isCallSite(const SVFValue *val)
Whether an instruction is a call or invoke instruction.
bool isReallocExtFun(const SVFFunction *fun)
Return true if the call is a heap reallocator.
void writeWrnMsg(const std::string &msg)
Writes a message run through wrnMsg.
void dumpSparseSet(const NodeBS &To)
bool isHeapAllocExtFunViaArg(const SVFFunction *fun)
bool isIntrinsicInst(const SVFInstruction *inst)
Return true if it is an llvm intrinsic instruction.
void dumpPointsToSet(unsigned node, NodeBS To)
Dump points-to set.
std::string bugMsg2(const std::string &msg)
bool isProgExitCall(const CallICFGNode *cs)
std::string wrnMsg(const std::string &msg)
Returns warning message by converting a string into yellow string output.
bool isRetInstNode(const ICFGNode *node)
std::ostream & outs()
Overwrite llvm::outs()
bool matchArgs(const CallICFGNode *cs, const SVFFunction *callee)
void timeLimitReached(int signum)
Function to call when alarm for time limit hits.
const SVFFunction * getProgFunction(const std::string &funName)
Get program entry function from function name.
bool isHeapAllocExtCallViaRet(const CallICFGNode *cs)
interfaces to be used externally
void dumpSet(NodeBS To, OutStream &O=SVFUtil::outs())
Dump sparse bitvector set.
bool isProgExitFunction(const SVFFunction *fun)
Return true if this is a program exit function call.
const SVFFunction * getProgEntryFunction()
Get program entry function.
void dumpPointsToList(const PointsToList &ptl)
llvm::IRBuilder IRBuilder