An anomaly is denoted by a two character sequence of actions
Example: 'ku' means that the object is killed and then used, where as 'dd' means that the object is defined twice without an intervening usage
Anomaly depends on the application
There are nine possible two letter combinations for 'd', 'k' and 'u'. Some re bugs, some are suspicious and some are okay
dd: Probably harmless, but suspicious. Why define the object twice without an intervening usage?
dk: Probably a bug,. Why define the object without using it?
du: The normal case. The object is defined and then used.
kd: Normal situation. An object is killed and then redefined.
kk: Harmless but probably buggy. Did you want to be sure it was really killed?
ku: A bug. The object does not exist.
ud: Usually not a bug because the language permits reassignment at almost any time.
ul: Normal situation
uu: Normal situation
There are six single letter situations in addition to the two letter situations
We will use a leading dash to mean that nothing of interest (d, k, u) occurs prior to the action noted along the entry-exit path of interest
A trailing dash is used which means that nothing happens after the point of interest to the exit
The possible anomalies are:
-k: Possibly anomalous, because from the entrance to this point on the path, the variable had not been defined. we are killing a variable that does not exist.
-d: Okay. This is just the first definition along this path
-u: Possibly anomalous. Not anomalous if the variable is global and has been previously defined.
k-: Not anomalous. The last thing done on this path was to kill the variable.
d- Possibly anomalous. The variable was defined and not used on this path. But this could be a global definition.
u-: Not anomalous. The variable was used but not killed on this path. Although this sequence is not anomalous, it signals a frequent kind of bug. If d and k mean dynamic storage allocation and return respectively, this could be an instance in which a dynamically allocated object was not returned to the pool after use.
0 comments:
Post a Comment