Red Hat ENTERPRISE LINUX 3 - DEVELOPER TOOLS GUIDE Uživatelský manuál Strana 12

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 24
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 11
8 Chapter 2. Basic Principles of the Tools
The linker uses a default script that compiles into the linker executable, if you do not supply one via
the -T command line option. Use the --verbose option to display the default linker script. Certain
options (such as -r or -N) affect the default linker script. Linker scripts are written in a superset of
AT&T’s Link Editor Command Language syntax.
For more information, refer to Using ld, the Gnu Linker.
2.8. gcov, the Test Coverage Tool
gcov, the code coverage/basic block profile display tool, enables you to analyze the basic block profile
of your program by recording how often each basic block is executed. This information enables you
to determine the sections of code on critical paths and the code blocks that are not executed at all.
2.9. gdb, the Debugging Tool
GDB, the GNU debugger, has the principal purpose of allowing you to stop your program before it
terminates. If your program terminates, the debugger helps you determine where it failed. To debug a
file named file.c, first compile the file using gcc -g file.c as a command, where -g produces
the debugging information. You then run the debugger. Refer to Section 3.4 Debug the Executable,
for the steps involved in debugging.
Set breakpoints with the breakpoint command.
Navigate through the program with the step command or the next command.
The debugger debugs threads, signals, trace information, and other data in a program. Each time your
program performs a function call, a block of data (the stack frame), which shows the location of the
call, the arguments, and the local variables of the function is generated. The debugger allows you to
examine the stack frame to get your program to work.
For more information, refer to Debugging with GDB.
2.10. make, the GNU Recompiling Tool
make, the GNU recompiling tool, determines automatically which pieces of a large program you need
to recompile and then issues commands to recompile them. make conforms to IEEE Standard 1003.2-
1992 (POSIX.2) and is compatible with any programming language whose compiler can run with
command line input from a shell. make is not limited only to building programs; it can be used for
any task in which some files must update automatically whenever associated files change.
To use make, you must write a file (a makefile) that describes the relationships among files in your
program and provides commands for updating each file. In a program, typically, the executable file is
updated from object files, which are in turn made by compiling source files.
When using make to recompile an executable, the result may change source files in a directory. If you
changed a header file, to be safe, you must recompile each source file that includes that header file.
Each compilation produces an object file corresponding to the source file. If any source file has been
recompiled, all the object files, whether newly made or saved from previous compilations, must be
linked together to produce the new executable.
make uses the makefile database and the last modified files to decide which of the other files needs
updating. For each of those files, make implements the commands recorded in the data base of the
makefile. The makefile has rules which explain how and when to remake certain files that are the
targets of a particular rule. A simple makefile rule has the following form:
target... : dependency... command
Zobrazit stránku 11
1 2 ... 7 8 9 10 11 12 13 14 15 16 17 ... 23 24

Komentáře k této Příručce

Žádné komentáře