Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

VGEC 170170107080

PRACTICAL : 2

AIM : Explain GNU Debugger.

 exercise control over these programs and to examine variables when


problems arise.
 GNU debugger which is also called gdb is the most popular debugger for
UNIX systems to debug C and C++ program files.

GNU FEATURES :

 If an error occurs while executing a function then in which line of


program the error has been occurred it is shown by debugger.
 What are the values of program variables at a particular point during
during execution it is also shown.
 It shows result of particular expression in program.

HOW GDB WORKS?

 GDB allows you to run the program at a certain points,then stop and print
out the values of certain variables at the points or step through the
program one line at a time and print out the values of each variables after
executing each line,gdb uses a simple command line interface.
 To let gdb be able to read all that information line by line from the
symbols tables,we need to compile it.

gcc –g o programname programname.c

GDB various commands:

(1) l = shows the code and program statements


(2) r = runs the program until breakpoint or error occurs
(3) n = runs the nth line or next line of program

THE EXAMPLE OF DEBUGGING AND DEBUGGING COMMAND IS


SHOWN BELOW :

1
VGEC 170170107080

Using this command we start GNU Debugging :

Use of “ r “ command :

2
VGEC 170170107080

Use of “ l “ command :

Use of “ n “ command :

You might also like