From: Anna Zaks
+
+ SymExpr (symbol) + is meant to represent abstract, but named, symbolic value. + Symbolic values can have constraints associated with them. Symbols represent + an actual (immutable) value. We might not know what its specific value is, but + we can associate constraints with that value as we analyze a path. +
+ + MemRegion is similar to a symbol. + It is used to provide a lexicon of how to describe abstract memory. Regions can + layer on top of other regions, providing a layered approach to representing memory. + For example, a struct object on the stack might be represented by a VarRegion, + but a FieldRegion which is a subregion of the VarRegion could + be used to represent the memory associated with a specific field of that object. + So how do we represent symbolic memory regions? That's what SymbolicRegion + is for. It is a MemRegion that has an associated symbol. Since the + symbol is unique and has a unique name; that symbol names the region. +
+ Let's see how the analyzer processes the expressions in the following example: +
+
+ int foo(int x) { + int y = x * 2; + int z = x; + ... + } ++
+Let's look at how x*2 gets evaluated. When x is evaluated,
+we first construct an SVal that represents the lvalue of x, in
+this case it is an SVal that references the MemRegion for x.
+Afterwards, when we do the lvalue-to-rvalue conversion, we get a new SVal,
+which references the value currently bound to x. That value is
+symbolic; it's whatever x was bound to at the start of the function.
+Let's call that symbol $0. Similarly, we evaluate the expression for 2,
+and get an SVal that references the concrete number 2. When
+we evaluate x*2, we take the two SVals of the subexpressions,
+and create a new SVal that represents their multiplication (which in
+this case is a new symbolic expression, which we might call $1). When we
+evaluate the assignment to y, we again compute its lvalue (a MemRegion),
+and then bind the SVal for the RHS (which references the symbolic value $1)
+to the MemRegion in the symbolic store.
+
+The second line is similar. When we evaluate x again, we do the same
+dance, and create an SVal that references the symbol $0. Note, two SVals
+might reference the same underlying values.
+
+
+To summarize, MemRegions are unique names for blocks of memory. Symbols are +unique names for abstract symbolic values. Some MemRegions represents abstract +symbolic chunks of memory, and thus are also based on symbols. SVals are just +references to values, and can reference either MemRegions, Symbols, or concrete +values (e.g., the number 1). +