www.delorie.com/gnu/docs/gcc/gnat_ug_55.html   search  
Buy the book!

Untitled Document

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2.15 Debugging Control

Activate internal debugging switches. x is a letter or digit, or string of letters or digits, which specifies the type of debugging outputs desired. Normally these are used only for internal development or system debugging purposes. You can find full documentation for these switches in the body of the Debug unit in the compiler source file `debug.adb'.

This switch causes the compiler to generate auxiliary output containing a pseudo-source listing of the generated expanded code. Like most Ada compilers, GNAT works by first transforming the high level Ada code into lower level constructs. For example, tasking operations are transformed into calls to the tasking run-time routines. A unique capability of GNAT is to list this expanded code in a form very close to normal Ada source. This is very useful in understanding the implications of various Ada usage on the efficiency of the generated code. There are many cases in Ada (e.g. the use of controlled types), where simple Ada statements can generate a lot of run-time code. By using `-gnatG' you can identify these cases, and consider whether it may be desirable to modify the coding approach to improve efficiency.

The format of the output is very similar to standard Ada source, and is easily understood by an Ada programmer. The following special syntactic additions correspond to low level features used in the generated code that do not have any exact analogies in pure Ada source form. The following is a partial list of these special constructions. See the specification of package Sprint in file `sprint.ads' for a full list.

new xxx [storage_pool = yyy]
Shows the storage pool being used for an allocator.

at end procedure-name;
Shows the finalization (cleanup) procedure for a scope.

(if expr then expr else expr)
Conditional expression equivalent to the x?y:z construction in C.

A conversion with floating-point truncation instead of rounding.

A conversion that bypasses normal Ada semantic checking. In particular enumeration types and fixed-point types are treated simply as integers.

Combines the above two cases.

x #/ y
x #mod y
x #* y
x #rem y
A division or multiplication of fixed-point values which are treated as integers without any kind of scaling.

free expr [storage_pool = xxx]
Shows the storage pool associated with a free statement.

freeze typename [actions]
Shows the point at which typename is frozen, with possible associated actions to be performed at the freeze point.

reference itype
Reference (and hence definition) to internal type itype.

function-name! (arg, arg, arg)
Intrinsic function call.

labelname : label
Declaration of label labelname.

expr && expr && expr ... && expr
A multiple concatenation (same effect as expr & expr & expr, but handled more efficiently).

Raise the Constraint_Error exception.

A pointer to the result of evaluating expression.

An unchecked conversion of source-expression to target-type.

Used to represent internal real literals (that) have no exact representation in base 2-16 (for example, the result of compile time evaluation of the expression 1.0/27.0).

This switch is used in conjunction with `-gnatG' to cause the expanded source, as described above to be written to files with names `^xxx.dg^XXX_DG^', where `xxx' is the normal file name, for example, if the source file name is `hello.adb', then a file `^hello.adb.dg^HELLO.ADB_DG^' will be written. The debugging information generated by the gcc ^-g^/DEBUG^ switch will refer to the generated `^xxx.dg^XXX_DG^' file. This allows you to do source level debugging using the generated code which is sometimes useful for complex code, for example to find out exactly which part of a complex construction raised an exception. This switch also suppress generation of cross-reference information (see -gnatx).

In the generated debugging information, and also in the case of long external names, the compiler uses a compression mechanism if the name is very long. This compression method uses a checksum, and avoids trouble on some operating systems which have difficulty with very long names. The `-gnatC' switch forces this compression approach to be used on all external names and names in the debugging information tables. This reduces the size of the generated executable, at the expense of making the naming scheme more complex. The compression only affects the qualification of the name. Thus a name in the source:


would normally appear in these tables as:


but if the `-gnatC' switch is used, then the name appears as


Here b7e0c705 is a compressed encoding of the qualification prefix. The GNAT Ada aware version of GDB understands these encoded prefixes, so if this debugger is used, the encoding is largely hidden from the user of the compiler.

This switch controls output from the compiler of a listing showing representation information for declared types and objects. For `-gnatR0', no information is output (equivalent to omitting the `-gnatR' switch). For `-gnatR1' (which is the default, so `-gnatR' with no parameter has the same effect), size and alignment information is listed for declared array and record types. For `-gnatR2', size and alignment information is listed for all expression information for values that are computed at run time for variant records. These symbolic expressions have a mostly obvious format with #n being used to represent the value of the n'th discriminant. See source files `repinfo.ads/adb' in the GNAT sources for full detalis on the format of `-gnatR3' output. If the switch is followed by an s (e.g. `-gnatR2s'), then the output is to a file with the name `^file.rep^file_REP^' where file is the name of the corresponding source file.

Normally the compiler generates full cross-referencing information in the `ALI' file. This information is used by a number of tools, including gnatfind and gnatxref. The -gnatx switch suppresses this information. This saves some space and may slightly speed up compilation, but means that these tools cannot be used.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003