5.6. Adding Break Points

When you start debugging a program, you use the run command. This command executes the program until the end of the program or a break point is met. A break point is a place in your source code file where you temporarily want to stop execution of the program being debugged.

Break points in GNU debugger can be placed using the break command. Look at the following list of the source code file sum.c which you already have used:

(gdb) list
1  #include <stdio.h>
2  main ()
3  {
4    int num1, num2, total ;
5
6    printf("Enter first number : ");
7    scanf("%d", &num1);
8    printf("Enter second number : ");
9    scanf("%d", &num2);
10
(gdb)

To place a break point at line number 6 in file sum.c (displayed above), you can use the following ...

Get Linux Development Platform: Configuring, Using, and Maintaining a Complete Programming Environment, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.