[Analyzing an Instrumented File] [Home]
Site Map

Calculator RPN Analysis Example Calculator

You create a file called R2ANL.LST to tell RECON which traces represent tests that exhibited the feature you are looking for. For example, to do "deterministic" analysis to locate the division operation in RPN, your R2ANL.LST file might look like:

  D
  >>>>>
  100
  C:\DIVIDE.R2T
  Y
  C:\ADD.R2T
  N

Once you have created this file and placed it with the other .LST files, you simply run the R2ANALYZ program with the command:

 
  R2ANALYZ
 

The result is an "annotated listing" of the RPN program. Branches that should be investigated are marked with a ">>>>>" so that they can be easily found by searching in your editor.

For if and while statements, the predicate value associated with the feature is shown as ``T'' or ``F'' or possibly both. For switch statements, the value of the switch expression is given, together with its ASCII character equivalent, if any.

In this case, RECON points us to the switch statement that detects the division operator and to the if statement in the division code that checks for a zero denominator.


        main()
        { int type;
         double op2;
         char s[MAXOP];
         while ((toupper(type = getops(s))) !='Q')
        >>>>> 47 ('/')
            switch (type)
            {
              case NUMBER: push(atof(s));
                break;
              case '+': push(pop() + pop());
                break;
              case '*': push(pop() * pop());
                break;
              case '-': op2 = pop();
                push(pop() - op2);
                break;
              case '/': op2 = pop();
        >>>>> T 
                if (op2 != 0.0)
                  push(pop() / op2);
                else
                  printf("error: zero divisor");
                break;
              case NEWLINE: printf(" %.8g", pop());
                break;
              default:printf(" %s unknown", s);
                break;
            }
         }
         return 0;
        }


[Analyzing an Instrumented File] [Home]
Site Map