Red Hat ENTERPRISE LINUX 3 - DEVELOPER TOOLS GUIDE Manuale Utente Pagina 19

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 24
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 18
Chapter 3. Developing with Red Hat Enterprise Linux Developer Tools 15
The following output displays:
12 int
13 main (void)
14 {
15 int b;
16
17 a = 3;
18 b = 4;
19
20 printf ("Hello, world!\n");
21
22 foo (b);
23
24 return 0;
25 }
7. To list a specific function code, use the list command with the name of the function to be
display. For example, type:
list foo
The following output displays:
1 #include <stdio.h>
2
3 int a, c;
4
5 static void
6 foo (int b)
7 {
8 c = a + b;
9 printf ("%d + %d = %d\n", a, b, c);
10 }
8. To set a breakpoint at line seven, enter the following input (set a breakpoint at any line by
entering break linenumber, where linenumber is the specific line number to break):
break 8
The following output displays:
Breakpoint 2 at 0xf4: file hello.c, line 8.
9. To resume normal execution of the program until the next breakpoint, type:
continue
The following output displays:
Continuing.
Hello, world!
Breakpoint 2, foo (b=4) at hello.c:8
8 c = a + b;
10. To step to the next instruction and execute it, type:
step
The following output displays:
9 printf ("%d + %d = %d\n", a, b, c);
11. To display the value of c, type:
print c
The following output displays:
$3 = 7
12. To see how you got to where you are, type:
backtrace
The following output displays:
#0 foo (b=4) at hello.c:9
Vedere la pagina 18
1 2 ... 14 15 16 17 18 19 20 21 22 23 24

Commenti su questo manuale

Nessun commento