Provide an attribute class describing an execution stack frame.
More...
Namespaces |
namespace | balst |
Detailed Description
- Outline
-
-
- Purpose:
- Provide an attribute class describing an execution stack frame.
-
- Classes:
-
- See also:
- Component balst_stacktrace
-
- Description:
- This component provides a single, simply-constrained (value-semantic) attribute class,
balst::StackTraceFrame
, that describes a stack frame from the execution stack of a function call. Additional methods are provided to indicate whether a given attribute is considered "unknown".
-
- Attributes:
Name Type Default Constraint
----------------- ----------- ---------- ----------
address const void * 0 none
libraryFileName bsl::string "" none
lineNumber int -1 'lineNumber >= -1'
mangledSymbolName bsl::string "" none
offsetFromSymbol bsl::size_t (size_t)-1 none
sourceFileName bsl::string "" none
symbolName bsl::string "" none
-
address: the return address in the parent (calling) function on return from the child (called) function.
-
libraryFileName: the executable or shared-library file name containing the parent function.
-
lineNumber: the source line number in the parent function corresponding, corresponding to a call to the child function.
-
mangledSymbolName: mangled symbol name of the parent function (in C code, the "mangled" name matches the symbol name.)
-
offsetFromSymbol: offset from the start of the parent function to the call to the child function.
-
sourceFileName: Name of the source file of the parent function.
-
symbolName: unmangled symbol name of the parent function (in C, code symbol name matches the mangled symbol name.)
-
- Unknown Values:
- For each attribute, a particular value is reserved to designate that the attribute value is "unknown". Default constructed objects are created with the designated "unknown" value for each attribute.
-
- Supplementary Methods:
- In addition to the usual setters and getters, the
balst::StackTraceFrame
attribute class provides also provides a suite of non-'static', (boolean-valued) predicate methods, of the form is<attributeName>Known
. Each of these return true
if the object attribute named by the method does not contain the designated "unknown" value for that attribute, and false
otherwise.
-
- Usage:
- In this example, we create two
balst::StackTraceFrame
objects, modify their properties, and compare them. First, we create the objects a
and b
: Then, we verify all values are initialized by the constructor to "unknown" values: Next, we assign a value to the lineNumber
attribute of a
and verify: Next, make the same change to b
and thereby restore it's equality to a
: Next, we update the address
attribute of a
and use the address
accessor method to obtain the new value for the update of b
: Finally, we exercise this sequence of operations for two other attributes, symbolName
and sourceFileName
: