Heritage Institute of Technology
CSE, 3rd Semester , 2025
Software Tools Lab
CSE2153
Pratyusa Dash
CSE2153 – Software Tools, 3rd Sem, 2025 1
Debugging with Code::Blocks
CSE2153 – Software Tools, 3rd Sem, 2025 2
Debugging with Code::Blocks
• The following are the stepswhich are to be followed step by step
to debug our program but before we start debugging our code,
make sure that our project iscompiled/build.
• At first,add the breakpoint by right clicking the mouse at the line
number where from you want to startdebugging and then
choose the Toggle Break point option. After selecting the break
point, click on Start/Continueoption to startdebugging, when
we click on the Start/Continueoption, then the code will startto
debug as well as the output window appears.
CSE2153 – Software Tools, 3rd Sem, 2025 3
Debugging Steps
A starting point for the debugger
to start debugging can be set
from anywhere we want in the
program segment. Here it has
been set at line no.6 . To set this
toggle breakpoint go to
DEBUGTOGGLE BREAKPOINT.
This puts a red dot on line no.6
CSE2153 – Software Tools, 3rd Sem, 2025 4
Debugging Steps
CSE2153 – Software Tools, 3rd Sem, 2025 5
Debugging Steps
• Click on Debug menu and
from debugging windows
option select watches window.
In watches window you can
see the values of variables.
• Click on the Call stack option
available in the same
debugging windows option to
open the call stack window
where we can see the
functions that are there in our
code inserted in a LIFO(Last in
First out)manner like the
variables that are inserted in a
stack.
CSE2153 – Software Tools, 3rd Sem, 2025 6
Debugging Steps
• On reaching a printf
it prints the
statement and then
in the scanf it takes
the input in the
black screen and
that particular value
inputted by user is
updated in the
watches. Here 5 is
inputted and that
appears in the
watches.
CSE2153 – Software Tools, 3rd Sem, 2025 7
Debugging Steps
• On reaching calc() it enters into the function where sum is
initialized to zero. On entering the loop the control finds a fact()
function.
CSE2153 – Software Tools, 3rd Sem, 2025 8
Debugging Steps
• Here call stack can be seen. From main control passes to calc
and then to fact .
CSE2153 – Software Tools, 3rd Sem, 2025 9
Debugging Steps
• On returning from the fact function sum becomes infinity in the
first loop iteration. This means that some error has happened in
the fact function itself. In that fact function we see that the value
returned by it is always 0 since fact=fact*j will always return 0
because fact has been initialized to 0. Hence error is found and
fact=1 change is made.
CSE2153 – Software Tools, 3rd Sem, 2025 10
Debugging Steps
• Now having done with all these, the debugging starts and you
can just click on either of these options as per your wish of
debugging:
• step into (allows us to move to the next step and if there is
function defined in your code then it goes inside the
function and also executes it step by step or rather line by
line).Shortcut key-> Shift-F7
• step out (does the same work as step into but step out
doesn’t move into the function (if defined in your
code)rather it moves out of the function already executing
the code inside the function). Shortcut key-> Ctrl-F7
• next line (moves to the next line of your code without
traversing the function(if defined)
• in your code). Shortcut key-> F7
CSE2153 – Software Tools, 3rd Sem, 2025 11
Assignment: Debug the following program
#include <stdio.h> int for(n2=0;n2<=n;n2++){
main(){ n1=1/n2;
int n; sum =sum+n1;
float sum=0.0, n1, n2; }
printf("\n Enter the value of printf("\n The sum of series 1/1 +
number: "); 1/2 +.... +l/%d =%f",n,sum);
scanf("%d",&n); return 0;
}
CSE2153 – Software Tools, 3rd Sem, 2025 12
Thank You
CSE2153 – Software Tools, 3rd Sem, 2025 13