Node: Debugging Control, Next: Units to Sources Mapping Files, Previous: Auxiliary Output Control, Up: Switches for gcc
-gnatd
x
Debug
unit in the compiler source
file debug.adb
.
-gnatG
-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]
at end
procedure-name;
(if
expr then
expr else
expr)
x?y:z
construction in C.
target^(
source)
target?(
source)
target?^(
source)
x #/
y
x #mod
y
x #*
y
x #rem
y
free
expr [storage_pool =
xxx]
free
statement.
freeze
typename [
actions]
reference
itype
function-name! (
arg,
arg,
arg)
labelname : label
expr &&
expr &&
expr ... &&
expr
[constraint_error]
Constraint_Error
exception.
expression'reference
target-type!(
source-expression)
[
numerator/
denominator]
-gnatD
-gnatG
to cause the expanded
source, as described above to be written to files with names
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
will be written.
The debugging information generated
by the gcc
-g
switch will refer to the generated
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).
-gnatC
-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:
Very_Long_Package.Very_Long_Inner_Package.Var
would normally appear in these tables as:
very_long_package__very_long_inner_package__var
but if the -gnatC
switch is used, then the name appears as
XCb7e0c705__var
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.
-gnatR[0|1|2|3][s]
-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
where
file is the name of the corresponding source file.
-gnatx
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.