"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "projects/CodeThorn/src/EStateTransferFunctions.h" between
rose-0.11.35.0.tar.gz and rose-0.11.36.0.tar.gz

About: ROSE is a compiler infrastructure to build source-to-source program transformation and analysis tools for large-scale C (C89 and C98), C++ (C++98 and C++11), UPC, Fortran (77/95/2003), OpenMP, Java, Python and PHP applications.

EStateTransferFunctions.h  (rose-0.11.35.0):EStateTransferFunctions.h  (rose-0.11.36.0)
skipping to change at line 139 skipping to change at line 139
std::list<EState> transferReturnStmt(Edge edge, const EState* estate); std::list<EState> transferReturnStmt(Edge edge, const EState* estate);
std::list<EState> transferAsmStmt(Edge edge, const EState* estate); std::list<EState> transferAsmStmt(Edge edge, const EState* estate);
std::list<EState> transferIdentity(Edge edge, const EState* estate); std::list<EState> transferIdentity(Edge edge, const EState* estate);
std::list<EState> transferFailedAssert(Edge edge, const EState* estate); std::list<EState> transferFailedAssert(Edge edge, const EState* estate);
std::list<EState> transferCaseOptionStmt(SgCaseOptionStmt* stmt,Edge edge, c onst EState* estate); std::list<EState> transferCaseOptionStmt(SgCaseOptionStmt* stmt,Edge edge, c onst EState* estate);
std::list<EState> transferDefaultOptionStmt(SgDefaultOptionStmt* stmt,Edge e dge, const EState* estate); std::list<EState> transferDefaultOptionStmt(SgDefaultOptionStmt* stmt,Edge e dge, const EState* estate);
std::list<EState> transferVariableDeclaration(SgVariableDeclaration* decl,Ed ge edge, const EState* estate); std::list<EState> transferVariableDeclaration(SgVariableDeclaration* decl,Ed ge edge, const EState* estate);
std::list<EState> transferExprStmt(SgNode* nextNodeToAnalyze1, Edge edge, co nst EState* estate); std::list<EState> transferExprStmt(SgNode* nextNodeToAnalyze1, Edge edge, co nst EState* estate);
// wrapper function for evalAssignOp
std::list<EState> transferAssignOp(SgAssignOp* assignOp, Edge edge, const ES tate* estate); std::list<EState> transferAssignOp(SgAssignOp* assignOp, Edge edge, const ES tate* estate);
// used at stmt level and for StmtExpr
std::list<EState> transferIncDecOp(SgNode* nextNodeToAnalyze2, Edge edge, co nst EState* estate); std::list<EState> transferIncDecOp(SgNode* nextNodeToAnalyze2, Edge edge, co nst EState* estate);
std::list<EState> transferGnuExtensionStmtExpr(SgNode* nextNodeToAnalyze1, E dge edge, const EState* estate); std::list<EState> transferGnuExtensionStmtExpr(SgNode* nextNodeToAnalyze1, E dge edge, const EState* estate);
// not used yet
std::list<EState> transferIncDecOpEvalWrapper(SgNode* nextNodeToAnalyze2, Ed
ge edge, const EState* estate);
// special case, called from transferFunctionCall // special case, called from transferFunctionCall
std::list<EState> transferForkFunction(Edge edge, const EState* estate, SgFu nctionCallExp* funCall); std::list<EState> transferForkFunction(Edge edge, const EState* estate, SgFu nctionCallExp* funCall);
std::list<EState> transferForkFunctionWithExternalTargetFunction(Edge edge, const EState* estate, SgFunctionCallExp* funCall); std::list<EState> transferForkFunctionWithExternalTargetFunction(Edge edge, const EState* estate, SgFunctionCallExp* funCall);
std::list<EState> transferTrueFalseEdge(SgNode* nextNodeToAnalyze2, Edge edg e, const EState* estate); std::list<EState> transferTrueFalseEdge(SgNode* nextNodeToAnalyze2, Edge edg e, const EState* estate);
public: public:
static std::list<EState> elistify(); static std::list<EState> elistify();
static std::list<EState> elistify(EState res); static std::list<EState> elistify(EState res);
//! This function turn a single result into a one-elment list with //! This function turn a single result into a one-elment list with
skipping to change at line 172 skipping to change at line 177
MemoryUpdateList evalAssignOpMemUpdates(SgAssignOp* assignOp, Edge edge, co nst EState* estate); MemoryUpdateList evalAssignOpMemUpdates(SgAssignOp* assignOp, Edge edge, co nst EState* estate);
// functions for handling callstring contexts // functions for handling callstring contexts
CallString transferFunctionCallContext(CallString cs, Label lab); CallString transferFunctionCallContext(CallString cs, Label lab);
bool isFeasiblePathContext(CallString& cs,Label lab); bool isFeasiblePathContext(CallString& cs,Label lab);
void initializeGlobalVariablesNew(SgProject* root, EState& estate); void initializeGlobalVariablesNew(SgProject* root, EState& estate);
// modifies PState with written initializers // modifies PState with written initializers
EState analyzeVariableDeclaration(SgVariableDeclaration* decl,EState current EState, Label targetLabel); EState analyzeVariableDeclaration(SgVariableDeclaration* decl,EState current EState, Label targetLabel);
PState analyzeSgAggregateInitializer(VariableId initDeclVarId, SgAggregateIn itializer* aggregateInitializer,PState pstate, /* for evaluation only */ EState currentEState); PState analyzeSgAggregateInitializer(VariableId initDeclVarId, SgAggregateIn itializer* aggregateInitializer,PState pstate, /* for evaluation only */ EState currentEState);
private:
// auxiliary semantic functions
void declareUninitializedStruct(Label label,PState* pstate,AbstractValue str
uctAddress, VariableId memVarId);
AbstractValue createStructDataMemberAddress(AbstractValue structAddress,Vari
ableId varId);
public:
// determines whether lab is a function call label of a function // determines whether lab is a function call label of a function
// call of the form 'x=f(...)' and returns the varible-id of the // call of the form 'x=f(...)' and returns the varible-id of the
// lhs, if a valid pointer is provided // lhs, if a valid pointer is provided
bool isFunctionCallWithAssignment(Label lab,VariableId* varId=0); bool isFunctionCallWithAssignment(Label lab,VariableId* varId=0);
// this function uses the respective function of ExprAnalyzer and // this function uses the respective function of ExprAnalyzer and
// extracts the result from the ExprAnalyzer data structure. // extracts the result from the ExprAnalyzer data structure.
std::list<EState> evaluateFunctionCallArguments(Edge edge, SgFunctionCallExp * funCall, EState estate, bool useConstraints); std::list<EState> evaluateFunctionCallArguments(Edge edge, SgFunctionCallExp * funCall, EState estate, bool useConstraints);
// uses ExprAnalyzer to compute the result. Limits the number of results to one result only. Does not permit state splitting. // uses ExprAnalyzer to compute the result. Limits the number of results to one result only. Does not permit state splitting.
// requires normalized AST // requires normalized AST
skipping to change at line 208 skipping to change at line 219
//SingleEvalResult eval(SgNode* node,EState estate); //SingleEvalResult eval(SgNode* node,EState estate);
//! compute abstract lvalue //! compute abstract lvalue
std::list<SingleEvalResultConstInt> evaluateLExpression(SgNode* node,EState estate); std::list<SingleEvalResultConstInt> evaluateLExpression(SgNode* node,EState estate);
//! Evaluates an expression using AbstractValue and returns a list //! Evaluates an expression using AbstractValue and returns a list
//! of all evaluation-results. There can be multiple results if //! of all evaluation-results. There can be multiple results if
//! one of the variables was bound to top and branching constructs //! one of the variables was bound to top and branching constructs
//! are inside the expression. //! are inside the expression.
std::list<SingleEvalResultConstInt> evaluateExpression(SgNode* node,EState e state, EvalMode mode=MODE_VALUE); std::list<SingleEvalResultConstInt> evaluateExpression(SgNode* node,EState e state, EvalMode mode=MODE_VALUE);
//! uses AbstractValue::getVariableIdMapping() //! uses AbstractValue::getVariableIdMapping()
AbstractValue evaluateExpressionWithEmptyState(SgExpression* expr); AbstractValue evaluateExpressionWithEmptyState(SgExpression* expr);
void setVariableIdMapping(VariableIdMappingExtended* variableIdMapping); void setVariableIdMapping(VariableIdMappingExtended* variableIdMapping);
void setSkipUnknownFunctionCalls(bool skip); void setSkipUnknownFunctionCalls(bool skip);
bool getSkipUnknownFunctionCalls(); bool getSkipUnknownFunctionCalls();
void setSkipArrayAccesses(bool skip); void setSkipArrayAccesses(bool skip);
bool getSkipArrayAccesses(); bool getSkipArrayAccesses();
// obtained from ctOpt // obtained from ctOpt
bool getIgnoreUndefinedDereference(); bool getIgnoreUndefinedDereference();
bool getIgnoreFunctionPointers(); bool getIgnoreFunctionPointers();
skipping to change at line 229 skipping to change at line 241
void setSVCompFunctionSemantics(bool flag); void setSVCompFunctionSemantics(bool flag);
bool getSVCompFunctionSemantics(); bool getSVCompFunctionSemantics();
// deprecated // deprecated
bool stdFunctionSemantics(); bool stdFunctionSemantics();
bool getStdFunctionSemantics(); bool getStdFunctionSemantics();
void setStdFunctionSemantics(bool flag); void setStdFunctionSemantics(bool flag);
bool getPrintDetectedViolations(); bool getPrintDetectedViolations();
void setPrintDetectedViolations(bool flag); void setPrintDetectedViolations(bool flag);
// deprecated (superseded by checkMemoryAccessBounds
bool accessIsWithinArrayBounds(VariableId arrayVarId,int accessIndex);
// supersedes accessIsWithinArrayBounds
enum MemoryAccessBounds checkMemoryAccessBounds(AbstractValue address); enum MemoryAccessBounds checkMemoryAccessBounds(AbstractValue address);
// deprecated
//VariableId resolveToAbsoluteVariableId(AbstractValue abstrValue) const;
AbstractValue computeAbstractAddress(SgVarRefExp* varRefExp);
// record detected errors in programs // record detected errors in programs
ProgramLocationsReport getProgramLocationsReport(enum AnalysisSelector analy sisSelector); ProgramLocationsReport getProgramLocationsReport(enum AnalysisSelector analy sisSelector);
// deprecated (use getProgramLocationsReport instead)
ProgramLocationsReport getViolatingLocations(enum AnalysisSelector analysisS
elector);
// record detected errors in programs // record detected errors in programs
void recordDefinitiveViolatingLocation(enum AnalysisSelector analysisSelecto r, Label lab); void recordDefinitiveViolatingLocation(enum AnalysisSelector analysisSelecto r, Label lab);
void recordPotentialViolatingLocation(enum AnalysisSelector analysisSelector , Label lab); void recordPotentialViolatingLocation(enum AnalysisSelector analysisSelector , Label lab);
std::string analysisSelectorToString(AnalysisSelector sel); std::string analysisSelectorToString(AnalysisSelector sel);
// deprecated // deprecated (still being used here)
void recordDefinitiveNullPointerDereferenceLocation(Label lab); void recordDefinitiveNullPointerDereferenceLocation(Label lab);
void recordPotentialNullPointerDereferenceLocation(Label lab); void recordPotentialNullPointerDereferenceLocation(Label lab);
void recordDefinitiveOutOfBoundsAccessLocation(Label lab); void recordDefinitiveOutOfBoundsAccessLocation(Label lab);
void recordPotentialOutOfBoundsAccessLocation(Label lab); void recordPotentialOutOfBoundsAccessLocation(Label lab);
void recordDefinitiveUninitializedAccessLocation(Label lab); void recordDefinitiveUninitializedAccessLocation(Label lab);
void recordPotentialUninitializedAccessLocation(Label lab); void recordPotentialUninitializedAccessLocation(Label lab);
bool definitiveErrorDetected(); bool definitiveErrorDetected();
bool potentialErrorDetected(); bool potentialErrorDetected();
skipping to change at line 280 skipping to change at line 282
bool isMemberVariable(CodeThorn::VariableId varId); bool isMemberVariable(CodeThorn::VariableId varId);
// checks if value is a null pointer. If it is 0 it records a null pointer v iolation at provided label. // checks if value is a null pointer. If it is 0 it records a null pointer v iolation at provided label.
// returns true if execution may continue, false if execution definitely doe s not continue. // returns true if execution may continue, false if execution definitely doe s not continue.
bool checkAndRecordNullPointer(AbstractValue value, Label label); bool checkAndRecordNullPointer(AbstractValue value, Label label);
enum InterpreterMode getInterpreterMode(); enum InterpreterMode getInterpreterMode();
void setInterpreterMode(enum InterpreterMode); void setInterpreterMode(enum InterpreterMode);
std::string getInterpreterModeFileName(); std::string getInterpreterModeFileName();
void setInterpreterModeFileName(std::string); void setInterpreterModeFileName(std::string);
// reserves memory location and sets as value 'undef' // reserves memory location at address memLoc and sets as value 'undef'
void reserveMemoryLocation(Label lab, PState* pstate, AbstractValue memLoc); void reserveMemoryLocation(Label lab, PState* pstate, AbstractValue memLoc);
// reserves and initializes memory location with newValue // reserves and initializes memory location at address memLoc with newValue
void initializeMemoryLocation(Label lab, PState* pstate, AbstractValue memLo c, AbstractValue newValue); void initializeMemoryLocation(Label lab, PState* pstate, AbstractValue memLo c, AbstractValue newValue);
// handles addresses only
AbstractValue readFromMemoryLocation(Label lab, const PState* pstate, Abstra ctValue memLoc); AbstractValue readFromMemoryLocation(Label lab, const PState* pstate, Abstra ctValue memLoc);
void writeToMemoryLocation(Label lab, PState* pstate, AbstractValue memLoc, // handles only references (models indirection)
AbstractValue newValue);
AbstractValue readFromReferenceMemoryLocation(Label lab, const PState* pstat e, AbstractValue memLoc); AbstractValue readFromReferenceMemoryLocation(Label lab, const PState* pstat e, AbstractValue memLoc);
// handles both addresses and references
AbstractValue readFromAnyMemoryLocation(Label lab, const PState* pstate, Abs
tractValue memLoc);
// handles addresses only
void writeToMemoryLocation(Label lab, PState* pstate, AbstractValue memLoc,
AbstractValue newValue);
// handles only references (models indirection)
void writeToReferenceMemoryLocation(Label lab, PState* pstate, AbstractValue memLoc, AbstractValue newValue); void writeToReferenceMemoryLocation(Label lab, PState* pstate, AbstractValue memLoc, AbstractValue newValue);
// handles both addresses and references
void writeToAnyMemoryLocation(Label lab, PState* pstate, AbstractValue memLo
c, AbstractValue newValue);
// memory must already be reserved (hence, this function is redundant if res erves is used before) // memory must already be reserved (hence, this function is redundant if res erves is used before)
void writeUndefToMemoryLocation(Label lab, PState* pstate, AbstractValue mem Loc); void writeUndefToMemoryLocation(Label lab, PState* pstate, AbstractValue mem Loc);
void writeUndefToMemoryLocation(PState* pstate, AbstractValue memLoc); void writeUndefToMemoryLocation(PState* pstate, AbstractValue memLoc);
// utilify functions // utilify functions
int getMemoryRegionNumElements(CodeThorn::AbstractValue ptrToRegion); AbstractValue getMemoryRegionAbstractElementSize(CodeThorn::AbstractValue re
int getMemoryRegionElementSize(CodeThorn::AbstractValue); gionAddress);
AbstractValue getMemoryRegionAbstractNumElements(CodeThorn::AbstractValue re
gionAddress);
int getMemoryRegionNumElements(CodeThorn::AbstractValue regionAddress);
int getMemoryRegionElementSize(CodeThorn::AbstractValue regionAddress);
// if set to 0 then no listner active. By default it is 0. // if set to 0 then no listner active. By default it is 0.
void setReadWriteListener(ReadWriteListener* listener); void setReadWriteListener(ReadWriteListener* listener);
ReadWriteListener* getReadWriteListener(); ReadWriteListener* getReadWriteListener();
protected: protected:
AbstractValue abstractValueFromSgValueExp(SgValueExp* valueExp, EvalMode mod e); AbstractValue abstractValueFromSgValueExp(SgValueExp* valueExp, EvalMode mod e);
ReadWriteListener* _readWriteListener=nullptr; ReadWriteListener* _readWriteListener=nullptr;
// general evaluation function for abstract value operators // general evaluation function for abstract value operators
 End of changes. 16 change blocks. 
19 lines changed or deleted 36 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)