Red Hat ENTERPRISE LINUX 3 - DEVELOPER TOOLS GUIDE Guide de l'utilisateur Page 65

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 100
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 64
Running GDB
55
The execution of a stopped program can be resumed in a number of ways. The following are the most
common.
c (continue)
The continue command simply restarts the execution of the program, which will continue to
execute until it encounters a breakpoint, runs into a specified or emergent condition (e.g. an error),
or terminates.
n (next)
Like continue, the next command also restarts execution; however, in addition to the stopping
conditions implicit in the continue command, next will also halt execution at the next sequential
line of code in the current source file.
s (step)
Like next, the step command also halts execution at each sequential line of code in the current
source file. However, if execution is currently stopped at a source line containing a function call,
GDB stops execution after entering the function call (rather than executing it).
fini (finish)
Like the aforementioned commands, the finish command resumes executions, but halts when
execution returns from a function.
Finally, two essential commands:
q (quit)
This terminates the execution.
h (help)
The help command provides access to its extensive internal documentation. The command
takes arguments: help breakpoint (or h br), for example, shows a detailed description
of the breakpoint command. Refer to the help output of each command for more detailed
information.
5.2.2. Running GDB
This section will describe a basic execution of GDB, using the following simple program:
hello.c
#include <stdio.h>
char hello[] = { "Hello, World!" };
int
main()
{
fprintf (stdout, "%s\n", hello);
return (0);
}
The following procedure illustrates the debugging process in its most basic form.
Procedure 5.1. Debugging a 'Hello World' Program
1. Compile hello.c into an executable with the debug flag set, as in:
gcc -g -o hello hello.c
Vue de la page 64
1 2 ... 60 61 62 63 64 65 66 67 68 69 70 ... 99 100

Commentaires sur ces manuels

Pas de commentaire