Debugging the Program:
Logical and Semantic Errors



 
  • Select the "Run Program" command from the "Resolve/C++" menu. 
  • Another buffer titled *shell* will be created for your program to run in. The next figure shows the situation after you have expanded this buffer to occupy the entire XEmacs window (e.g., by typing Ctrl-X 1; that's the number one; or by choosing "Un-Split (Keep This)" from the File menu). As you know, you can switch among the three buffers using the "Buffers" menu.

    Now the program will prompt you to enter two integers as follows:

         Please input an integer: 5
         Please input another integer: 10
  • Enter 5 and 10 as shown above. Note that you may "edit" each line of input as you type it, and that everything you type in means nothing until you hit the Enter (or, on some systems, Return) key.
  • Because there is one more error in the program that you have not corrected yet, you will see the message:

        ===================================================
    
        0: main
    
        1: Greatest_Common_Divisor(Integer, Integer)
    
        2: operator%(Integer, Integer)
    
        3: Mod(int, int)
    
        ===================================================
    
        Violated assertion at:
    
        File: /class/sce/rcpp/RESOLVE_Foundation/Integer/Integer.cpp
        Line #: 104
        Operation: Mod
    
        Violated assertion is:
        Integer modulus > 0
    
        ===================================================
    
    
        Process shell iOT instruction
        ===================================================
    
    Even if you have already spotted the error that causes this, do not correct it until you practice using debugging commands!

     
    Previous Table of Contents Continue


    Last modified: Fri Dec 15 16:20:35 EST 2006