Tutorials
ConceptsIn this tutorial you will learn about Debugging - A Important Aspect in Programming, Detection or Finding of the Bug, What the bug or fault is, Where it has occurred, How it is caused, Important Factors to Consider while debugging, Debuggers utilities and functions - Step-By-Step, Breakpoint.
After developing a program the next step is to test the program to find whether the program function and produces output as desired. In real situations the program when run immediately after developed will give errors of different types say syntax errors or logical errors and so on. This is where debugging terminology figures out. Debugging is the step by step process of finding errors or bugs in a program so that the bugs can be removed to make the program function in the way it was desired. There are several tools available to do the above defined debugging process. These tools are called debuggers.
As we have seen debugging process involves the identification of bug in a procedural way the sub events involved in this debugging process are namely:
This is the primary process or activity of a debugging process. For doing this with key attention the output or the value at each stage of the module or program must be checked. If any discrepancy is found then with greater attention that sub portion must be checked to find the values passed to each variables and the output that occurs from each process in that subdivision. One can also add some temporary statements or print or output statements for checking the values of variables. These temporary statements must be removed carefully after the debugging process. In some cases it may be necessary to recreate the bug to identify where it has occurred. Thus the main idea of this step of debugging process is to identify
What the bug or fault is – This can be done by recreation of bugs or by careful checking of values
Where it has occurred – By writing temporary print or output statements or finding the place where value is changed or reasons why data is not in proper format and so on.
How it is caused and so on.
Having done the major process of debugging the next step in debugging is to fix the error or bug.
Bug Fixing or Error Correction: This is also involved in the process of debugging because while we fix an error or bug there is possibility that it may give raise to some other bugs. If it happens again the process mentioned above namely detection, correction takes place. This continues until the system is found to be bug free.
Important Factors to Consider while debugging
Having known a lot about the concept of debugging now let us see how to do this process of debugging in a simplier and efficient way. This is done by the use of debuggers
Debuggers have many utilities and functions in it to name a few are
Step-By-Step – It helps watching the variables or value of the program in each step and therefore thorough analysis can be made easily.
Breakpoint – This is used for pause the program at any time needed. Say for instance if a user wants to check the value written in a file when enter key is pressed then after enter key is pressed if this breakpoint is used then program is paused and the user could check the file.
The above mentioned is only a few of the numerous abilities or functions available while debugging using debugging tools. Whatever may the tool used it is important that one should definitely debug their program or in other words it is vital to follow the debugging step in software development life cycle in order have a quality product.