HP gnu source-level debugger 5992-4701 Instrukcja Użytkownika Strona 85

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 369
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 84
This use of '::' is very rarely in conflict with the very similar use of the same notation
in C++. GDB also supports use of the C++ scope resolution operator in GDB expressions.
WARNING! Occasionally, a local variable may appear to have the wrong value at
certain points in a function just after entry to a new scope, and just before exit.
You may see this problem when you are stepping by machine instructions. This is
because, on most machines, it takes more than one instruction to set up a stack frame
(including local variable definitions); if you are stepping by machine instructions,
variables may appear to have the wrong values until the stack frame is completely
built. On exit, it usually also takes more than one machine instruction to destroy a stack
frame; after you begin stepping through that group of instructions, local variable
definitions may be gone.
This may also happen when the compiler does significant optimizations. To be sure of
always seeing accurate values, turn o all optimization when compiling.
Another possible effect of compiler optimizations is to optimize unused variables out
of existence, or assign variables to registers (as opposed to memory addresses).
Depending on the support for such cases offered by the debug info format used by the
compiler, GDB might not be able to display values for such local variables. If that
happens, GDB will print a message like this:
No symbol "foo" in current context.
To solve such problems, either recompile without optimizations, or use a different
debug info format, if the compiler supports several such formats. For example, GCC,
the GNU C/C++ compiler usually supports the '-gstabs' option. The '-gstabs'
produces debug information in a format that is superior to formats such as COFF. You
may be able to use DWARF-2 ('-gdwarf-2'), which is also an effective form for debug
info. See “Compiling for debugging” (page 39).
8.3 Artificial arrays
It is often useful to print out several successive objects of the same type in memory; a
section of an array, or an array of dynamically determined size for which only a pointer
exists in the program.
You can do this by referring to a contiguous span of memory as an artificial array, using
the binary operator '@'. The left operand of '@' should be the first element of the desired
array and be an individual object. The right operand should be the desired length of
the array. The result is an array value whose elements are all of the type of the left
argument. The first element is actually the left argument; the second element comes
from bytes of memory immediately following those that hold the first element, and so
on. Here is an example. If a program says
int *array = (int *) malloc (len * sizeof (int));
you can print the contents of array with
8.3 Artificial arrays 85
Przeglądanie stron 84
1 2 ... 80 81 82 83 84 85 86 87 88 89 90 ... 368 369

Komentarze do niniejszej Instrukcji

Brak uwag

HP Cartes mères de serveurs/postes de travail manuels d'utilisation

À partir de C

Cliquez sur un alphabet ci-dessous pour faire défiler la liste complète des modèles commençant par cette lettre

Modèles Type de document
C5J37AWABA
Manuel de l'utilisateur   HP C5J37AWABA User's Manual, 165 pages
C6Z78UT#ABA
Manuel de l'utilisateur   HP C6Z78UT#ABA User's Manual [no] , 227 pages
Compaq 8300
Spécifications   HP Compaq 8300 Specifications, 195 pages
Compaq dc5100
Informations techniques   HP Compaq dc5100 System information, 230 pages
Compaq dc5750 SFF
Manuel de l'utilisateur   HP Compaq dc5750 SFF User manual, 214 pages
Compaq dc5800
Guide de l'utilisateur   HP Compaq dc5800 User guide [en] , 255 pages
Compaq dc7100 DT
Informations techniques   HP Compaq dc7100 DT System information, 290 pages
Compaq dx2250
Manuel de l'utilisateur   HP Compaq dx2250 User's Manual, 162 pages
Compaq Elite 8000 SFF
Spécifications   HP Compaq Elite 8000 SFF Specifications, 284 pages
Compaq Elite 8300 All-in-One
Spécifications   HP Compaq Elite 8300 All-in-One Specifications, 168 pages
Compaq Pro 6300 Series Small Form Factor
Spécifications   HP Compaq Pro 6300 Series Small Form Factor Specifications [en] , 240 pages
Compaq Professional 5000 series
Guide de dépannage   HP Compaq Professional 5000 series Troubleshooting, 74 pages