GDB
What is GDB? 
• A gdb is a program(Executable) that is used to test and debug other programs(Our Executable). 
Uses of gdb:
• Run the program Step by step
• Tracking values of variables
• Debugging while program is running
• Stop debugging when program encounter a breakpoint.
By using gdb we find below things,
• To find which statement or expression causes a error.
• To find the instant values(i.e x = 5) of variables at particular point during execution of program. 
• To find result of program at particular point 
• To fins execution sequence of statements in a program.
If we are debug the program with GDB means we need to build the executable with below command,
Ex, gcc -g sample.c -o output.out.
gcc '-g' option flag
gcc -g generates debug information to be used by GDB debugger. 
Based on the below option executable size was increased. 
| Option | Description | 
|---|---|
| -g0 | No debug information | 
| -g1 | Minimal debug information | 
| -g | Default debug information | 
| -g3 | Maximal debug information | 
List of gdb commands
| Commands | Link | 
|---|---|
| set variable<variable_name>=<value> | This is a link | 
Remaining commands update shortly...
 

0 Comments