OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / ada / debug.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                                D E B U G                                 --
6 --                                                                          --
7 --                                 B o d y                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-2011, Free Software Foundation, Inc.         --
10 --                                                                          --
11 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
12 -- terms of the  GNU General Public License as published  by the Free Soft- --
13 -- ware  Foundation;  either version 3,  or (at your option) any later ver- --
14 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
17 --                                                                          --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception,   --
20 -- version 3.1, as published by the Free Software Foundation.               --
21 --                                                                          --
22 -- You should have received a copy of the GNU General Public License and    --
23 -- a copy of the GCC Runtime Library Exception along with this program;     --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
25 -- <http://www.gnu.org/licenses/>.                                          --
26 --                                                                          --
27 -- GNAT was originally developed  by the GNAT team at  New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
29 --                                                                          --
30 ------------------------------------------------------------------------------
31
32 package body Debug is
33
34    ---------------------------------
35    -- Summary of Debug Flag Usage --
36    ---------------------------------
37
38    --  Debug flags for compiler (GNAT1)
39
40    --  da   Generate messages tracking semantic analyzer progress
41    --  db   Show encoding of type names for debug output
42    --  dc   List names of units as they are compiled
43    --  dd   Dynamic allocation of tables messages generated
44    --  de   List the entity table
45    --  df   Full tree/source print (includes withed units)
46    --  dg   Print source from tree (generated code only)
47    --  dh   Generate listing showing loading of name table hash chains
48    --  di   Generate messages for visibility linking/delinking
49    --  dj   Suppress "junk null check" for access parameter values
50    --  dk   Generate GNATBUG message on abort, even if previous errors
51    --  dl   Generate unit load trace messages
52    --  dm   Allow VMS features even if not OpenVMS version
53    --  dn   Generate messages for node/list allocation
54    --  do   Print source from tree (original code only)
55    --  dp   Generate messages for parser scope stack push/pops
56    --  dq   No auto-alignment of small records
57    --  dr   Generate parser resynchronization messages
58    --  ds   Print source from tree (including original and generated stuff)
59    --  dt   Print full tree
60    --  du   Uncheck categorization pragmas
61    --  dv   Output trace of overload resolution
62    --  dw   Print trace of semantic scope stack
63    --  dx   Force expansion on, even if no code being generated
64    --  dy   Print tree of package Standard
65    --  dz   Print source of package Standard
66
67    --  dA   All entities included in representation information output
68    --  dB   Output debug encoding of type names and variants
69    --  dC   Output debugging information on check suppression
70    --  dD   Delete elaboration checks in inner level routines
71    --  dE   Apply elaboration checks to predefined units
72    --  dF   Front end data layout enabled
73    --  dG   Generate all warnings including those normally suppressed
74    --  dH   Hold (kill) call to gigi
75    --  dI   Inhibit internal name numbering in gnatG listing
76    --  dJ   Output debugging trace info for JGNAT (Java VM version of GNAT)
77    --  dK   Kill all error messages
78    --  dL   Output trace information on elaboration checking
79    --  dM   Assume all variables are modified (no current values)
80    --  dN   No file name information in exception messages
81    --  dO   Output immediate error messages
82    --  dP   Do not check for controlled objects in preelaborable packages
83    --  dQ   Do not generate runtime check for duplicated external tag
84    --  dR   Bypass check for correct version of s-rpc
85    --  dS   Never convert numbers to machine numbers in Sem_Eval
86    --  dT   Convert to machine numbers only for constant declarations
87    --  dU   Enable garbage collection of unreachable entities
88    --  dV   Enable viewing of all symbols in debugger
89    --  dW   Disable warnings on calls for IN OUT parameters
90    --  dX   Display messages on reads of potentially uninitialized scalars
91    --  dY   Enable configurable run-time mode
92    --  dZ   Generate listing showing the contents of the dispatch tables
93
94    --  d.a  Force Target_Strict_Alignment mode to True
95    --  d.b  Dump backend types
96    --  d.c  Generate inline concatenation, do not call procedure
97    --  d.d  Disable atomic synchronization
98    --  d.e  Enable atomic synchronization
99    --  d.f  Inhibit folding of static expressions
100    --  d.g  Enable conversion of raise into goto
101    --  d.h
102    --  d.i  Ignore Warnings pragmas
103    --  d.j
104    --  d.k
105    --  d.l  Use Ada 95 semantics for limited function returns
106    --  d.m  For -gnatl, print full source only for main unit
107    --  d.n  Print source file names
108    --  d.o  Generate .NET listing of CIL code
109    --  d.p  Enable the .NET CIL verifier
110    --  d.q
111    --  d.r  Enable OK_To_Reorder_Components in non-variant records
112    --  d.s  Disable expansion of slice move, use memmove
113    --  d.t  Disable static allocation of library level dispatch tables
114    --  d.u
115    --  d.v  Enable OK_To_Reorder_Components in variant records
116    --  d.w  Do not check for infinite loops
117    --  d.x  No exception handlers
118    --  d.y
119    --  d.z
120
121    --  d.A  Read/write Aspect_Specifications hash table to tree
122    --  d.B
123    --  d.C  Generate concatenation call, do not generate inline code
124    --  d.D  Strict Alfa mode
125    --  d.E  Force Alfa mode for gnat2why
126    --  d.F  Alfa mode
127    --  d.G  Precondition only mode for gnat2why
128    --  d.H  Standard package only mode for gnat2why
129    --  d.I  SCIL generation mode
130    --  d.J  Disable parallel SCIL generation mode
131    --  d.K  Alfa detection only mode for gnat2why
132    --  d.L  Depend on back end for limited types in conditional expressions
133    --  d.M
134    --  d.N
135    --  d.O  Dump internal SCO tables
136    --  d.P  Previous (non-optimized) handling of length comparisons
137    --  d.Q
138    --  d.R
139    --  d.S  Force Optimize_Alignment (Space)
140    --  d.T  Force Optimize_Alignment (Time)
141    --  d.U
142    --  d.V
143    --  d.W  Print out debugging information for Walk_Library_Items
144    --  d.X  Use Expression_With_Actions
145    --  d.Y  Do not use Expression_With_Actions
146    --  d.Z
147
148    --  d1   Error msgs have node numbers where possible
149    --  d2   Eliminate error flags in verbose form error messages
150    --  d3   Dump bad node in Comperr on an abort
151    --  d4   Inhibit automatic krunch of predefined library unit files
152    --  d5   Debug output for tree read/write
153    --  d6   Default access unconstrained to thin pointers
154    --  d7   Do not output version & file time stamp in -gnatv or -gnatl mode
155    --  d8   Force opposite endianness in packed stuff
156    --  d9
157
158    --  Debug flags for binder (GNATBIND)
159
160    --  da  All links (including internal units) listed if there is a cycle
161    --  db  Output information from Better_Choice
162    --  dc  List units as they are chosen
163    --  dd
164    --  de  Elaboration dependencies including system units
165    --  df
166    --  dg
167    --  dh
168    --  di  Ignore_Errors mode for reading ali files
169    --  dj
170    --  dk
171    --  dl
172    --  dm
173    --  dn  List details of manipulation of Num_Pred values
174    --  do  Use old preference for elaboration order
175    --  dp
176    --  dq
177    --  dr
178    --  ds
179    --  dt
180    --  du  List units as they are acquired
181    --  dv
182    --  dw
183    --  dx  Force binder to read xref information from ali files
184    --  dy
185    --  dz
186
187    --  Debug flags used in package Make and its clients (e.g. GNATMAKE)
188
189    --  da
190    --  db
191    --  dc
192    --  dd
193    --  de
194    --  df  Only output file names, not path names, in log
195    --  dg
196    --  dh  Generate listing showing loading of name table hash chains
197    --  di
198    --  dj
199    --  dk
200    --  dl
201    --  dm  Display the number of maximum simultaneous compilations
202    --  dn  Do not delete temp files created by gnatmake
203    --  do
204    --  dp  Prints the contents of the Q used by Make.Compile_Sources
205    --  dq  Prints source files as they are enqueued and dequeued
206    --  dr
207    --  ds
208    --  dt  Display time stamps when there is a mismatch
209    --  du  List units as their ali files are acquired
210    --  dv
211    --  dw  Prints the list of units withed by the unit currently explored
212    --  dx
213    --  dy
214    --  dz
215
216    --------------------------------------------
217    -- Documentation for Compiler Debug Flags --
218    --------------------------------------------
219
220    --  da   Generate messages tracking semantic analyzer progress. A message
221    --       is output showing each node as it gets analyzed, expanded,
222    --       resolved, or evaluated. This option is useful for finding out
223    --       exactly where a bomb during semantic analysis is occurring.
224
225    --  db   In Exp_Dbug, certain type names are encoded to include debugging
226    --       information. This debug switch causes lines to be output showing
227    --       the encodings used.
228
229    --  dc   List names of units as they are compiled. One line of output will
230    --       be generated at the start of compiling each unit (package or
231    --       subprogram).
232
233    --  dd   Dynamic allocation of tables messages generated. Each time a
234    --       table is reallocated, a line is output indicating the expansion.
235
236    --  de   List the entity table
237
238    --  df   Full tree/source print (includes withed units). Normally the tree
239    --       output (dt) or recreated source output (dg,do,ds) includes only
240    --       the main unit. If df is set, then the output in either case
241    --       includes all compiled units (see also dg,do,ds,dt). Note that to
242    --       be effective, this swich must be used in combination with one or
243    --       more of dt, dg, do or ds.
244
245    --  dg   Print the source recreated from the generated tree. In the case
246    --       where the tree has been rewritten this output includes only the
247    --       generated code, not the original code (see also df,do,ds,dz).
248    --       This flag differs from -gnatG in that the output also includes
249    --       non-source generated null statements, and freeze nodes, which
250    --       are normally omitted in -gnatG mode.
251
252    --  dh   Generates a table at the end of a compilation showing how the hash
253    --       table chains built by the Namet package are loaded. This is useful
254    --       in ensuring that the hashing algorithm (in Namet.Hash) is working
255    --       effectively with typical sets of program identifiers.
256
257    --  di   Generate messages for visibility linking/delinking
258
259    --  dj   Suppress "junk null check" for access parameters. This flag permits
260    --       Ada programs to pass null parameters to access parameters, and to
261    --       explicitly check such access values against the null literal.
262    --       Neither of these is valid Ada, but both were allowed in versions of
263    --       GNAT before 3.10, so this switch can ease the transition process.
264
265    --  dk   Immediate kill on abort. Normally on an abort (i.e. a call to
266    --       Comperr.Compiler_Abort), the GNATBUG message is not given if
267    --       there is a previous error. This debug switch bypasses this test
268    --       and gives the message unconditionally (useful for debugging).
269
270    --  dl   Generate unit load trace messages. A line of traceback output is
271    --       generated each time a request is made to the library manager to
272    --       load a new unit.
273
274    --  dm   Some features are permitted only in OpenVMS ports of GNAT (e.g.
275    --       the specification of passing by descriptor). Normally any use
276    --       of these features will be flagged as an error, but this debug
277    --       flag allows acceptance of these features in non OpenVMS ports.
278    --       Of course they may not have any useful effect, and in particular
279    --       attempting to generate code with this flag set may blow up.
280    --       The flag also forces the use of 64-bits for Long_Integer.
281
282    --  dn   Generate messages for node/list allocation. Each time a node or
283    --       list header is allocated, a line of output is generated. Certain
284    --       other basic tree operations also cause a line of output to be
285    --       generated. This option is useful in seeing where the parser is
286    --       blowing up.
287
288    --  do   Print the source recreated from the generated tree. In the case
289    --       where the tree has been rewritten, this output includes only the
290    --       original code, not the generated code (see also df,dg,ds,dz).
291
292    --  dp   Generate messages for parser scope stack push/pops. A line of
293    --       output by the parser each time the parser scope stack is either
294    --       pushed or popped. Useful in debugging situations where the
295    --       parser scope stack ends up incorrectly synchronized
296
297    --  dq   In layout version 1.38, 2002/01/12, a circuit was implemented
298    --       to give decent default alignment to short records that had no
299    --       specific alignment set. This debug option restores the previous
300    --       behavior of giving such records poor alignments, typically 1.
301    --       This may be useful in dealing with transition.
302
303    --  dr   Generate parser resynchronization messages. Normally the parser
304    --       resynchronizes quietly. With this debug option, two messages
305    --       are generated, one when the parser starts a resynchronization
306    --       skip, and another when it resumes parsing. Useful in debugging
307    --       inadequate error recovery situations.
308
309    --  ds   Print the source recreated from the generated tree. In the case
310    --       where the tree has been rewritten this output includes both the
311    --       generated code and the original code with the generated code
312    --       being enlosed in curly brackets (see also df,do,ds,dz)
313
314    --  dt   Print full tree. The generated tree is output (see also df,dy)
315
316    --  du   Uncheck categorization pragmas. This debug switch causes the
317    --       categorization pragmas (Pure, Preelaborate etc) to be ignored
318    --       so that normal checks are not made (this is particularly useful
319    --       for adding temporary debugging code to units that have pragmas
320    --       that are inconsistent with the debugging code added.
321
322    --  dv   Output trace of overload resolution. Outputs messages for
323    --       overload attempts that involve cascaded errors, or where
324    --       an interepretation is incompatible with the context.
325
326    --  dw   Write semantic scope stack messages. Each time a scope is created
327    --       or removed, a message is output (see the Sem_Ch8.Push_Scope and
328    --       Sem_Ch8.Pop_Scope subprograms).
329
330    --  dx   Force expansion on, even if no code being generated. Normally the
331    --       expander is inhibited if no code is generated. This switch forces
332    --       expansion to proceed normally even if the backend is not being
333    --       called. This is particularly useful for debugging purposes when
334    --       using the front-end only version of the compiler (which normally
335    --       would never do any expansion).
336
337    --  dy   Print tree of package Standard. Normally the tree print out does
338    --       not include package Standard, even if the -df switch is set. This
339    --       switch forces output of the internal tree built for Standard.
340
341    --  dz   Print source of package Standard. Normally the source print out
342    --       does not include package Standard, even if the -df switch is set.
343    --       This switch forces output of the source recreated from the internal
344    --       tree built for Standard. Note that this differs from -gnatS in
345    --       that it prints from the actual tree using the normal Sprint
346    --       circuitry for printing trees.
347
348    --  dA   Forces output of representation information, including full
349    --       information for all internal type and object entities, as well
350    --       as all user defined type and object entities including private
351    --       and incomplete types. This debug switch also automatically sets
352    --       the equivalent of -gnatR3m.
353
354    --  dB   Output debug encodings for types and variants. See Exp_Dbug for
355    --       exact form of the generated output.
356
357    --  dC   Output trace information showing the decisions made during
358    --       check suppression activity in unit Checks.
359
360    --  dD   Delete new elaboration checks. This flag causes GNAT to return
361    --       to the 3.13a elaboration semantics, and to suppress the fixing
362    --       of two bugs. The first is in the context of inner routines in
363    --       dynamic elaboration mode, when the subprogram we are in was
364    --       called at elaboration time by a unit that was also compiled with
365    --       dynamic elaboration checks. In this case, if A calls B calls C,
366    --       and all are in different units, we need an elaboration check at
367    --       each call. These nested checks were only put in recently (see
368    --       version 1.80 of Sem_Elab) and we provide this debug flag to
369    --       revert to the previous behavior in case of regressions. The
370    --       other behavior reverted by this flag is the treatment of the
371    --       Elaborate_Body pragma in static elaboration mode. This used to
372    --       be treated as not needing elaboration checking, but in fact in
373    --       general Elaborate_All is still required because of nested calls.
374
375    --  dE   Apply compile time elaboration checking for with relations between
376    --       predefined units. Normally no checks are made (it seems that at
377    --       least on the SGI, such checks run into trouble).
378
379    --  dF   Front end data layout enabled. Normally front end data layout
380    --       is only enabled if the target parameter Backend_Layout is False.
381    --       This debugging switch enables it unconditionally.
382
383    --  dG   Generate all warnings. Normally Errout suppresses warnings on
384    --       units that are not part of the main extended source, and also
385    --       suppresses warnings on instantiations in the main extended
386    --       source that duplicate warnings already posted on the template.
387    --       This switch stops both kinds of deletion and causes Errout to
388    --       post all warnings sent to it.
389
390    --  dH   Inhibit call to gigi. This is useful for testing front end data
391    --       layout, and may be useful in other debugging situations where
392    --       you do not want gigi to intefere with the testing.
393
394    --  dI   Inhibit internal name numbering in gnatDG listing. Any sequence of
395    --       the form <uppercase-letter><digits><lowercase-letter> appearing in
396    --       a name is replaced by <uppercase-letter>...<lowercase-letter>. This
397    --       is used in the fixed bugs run to minimize system and version
398    --       dependency in filed -gnatD or -gnatG output.
399
400    --  dJ   Generate debugging trace output for the JGNAT back end. This
401    --       consists of symbolic Java Byte Code sequences for all generated
402    --       classes plus additional information to indicate local variables
403    --       and methods.
404
405    --  dK   Kill all error messages. This debug flag suppresses the output
406    --       of all error messages. It is used in regression tests where the
407    --       error messages are target dependent and irrelevant.
408
409    --  dL   Output trace information on elaboration checking. This debug
410    --       switch causes output to be generated showing each call or
411    --       instantiation as it is checked, and the progress of the recursive
412    --       trace through calls at elaboration time.
413
414    --  dM   Assume all variables have been modified, and ignore current value
415    --       indications. This debug flag disconnects the tracking of constant
416    --       values (see Exp_Ch2.Expand_Current_Value).
417
418    --  dN   Do not generate file name information in exception messages
419
420    --  dO   Output immediate error messages. This causes error messages to
421    --       be output as soon as they are generated (disconnecting several
422    --       circuits for improvement of messages, deletion of duplicate
423    --       messages etc). Useful to diagnose compiler bombs caused by
424    --       erroneous handling of error situations
425
426    --  dP   Do not check for controlled objects in preelaborable packages.
427    --       RM 10.2.1(9) forbids the use of library level controlled objects
428    --       in preelaborable packages, but this restriction is a huge pain,
429    --       especially in the predefined library units.
430
431    --  dQ   Eliminate check for duplicate external tags. This check was added
432    --       as per AI 0113, and causes some backward compatibility problems.
433    --       It is never legitimate to have duplicate external tags, so the
434    --       check is certainly valid, but this debug switch can be useful for
435    --       enabling previous behavior of ignoring this problem.
436
437    --  dR   Bypass the check for a proper version of s-rpc being present
438    --       to use the -gnatz? switch. This allows debugging of the use
439    --       of stubs generation without needing to have GLADE (or some
440    --       other PCS  installed).
441
442    --  dS   Omit conversion of fpt numbers to exact machine numbers in
443    --       non-static evaluation contexts (see Check_Non_Static_Context).
444    --       This is intended for testing out timing problems with this
445    --       conversion circuit.
446
447    --  dT   Similar to dS, but omits the conversions only in the case where
448    --       the parent is not a constant declaration.
449
450    --  dU   Enable garbage collection of unreachable entities. This enables
451    --       both the reachability analysis and changing the Is_Public and
452    --       Is_Eliminated flags.
453
454    --  dV   Enable viewing of all symbols in debugger. Causes debug information
455    --       to be generated for all symbols, including internal symbols. This
456    --       is enabled by default for -gnatD, but this switch allows this to
457    --       be enabled without generating modified source files. Note that the
458    --       use of -gnatdV ensures in the dwarf/elf case that all symbols that
459    --       are present in the elf tables are also in the dwarf tables (which
460    --       seems to be required by some tools). Another effect of dV is to
461    --       generate full qualified names, including internal names generated
462    --       for blocks and loops.
463
464    --  dW   Disable warnings when a possibly uninitialized scalar value is
465    --       passed to an IN OUT parameter of a procedure. This usage is a
466    --       quite improper bounded error [erroneous in Ada 83] situation,
467    --       and would normally generate a warning. However, to ease the
468    --       task of transitioning incorrect legacy code, we provide this
469    --       undocumented feature for suppressing these warnings.
470
471    --  dY   Enable configurable run-time mode, just as though the System file
472    --       had Configurable_Run_Time_Mode set to True. This is useful in
473    --       testing high integrity mode.
474
475    --  dZ   Generate listing showing the contents of the dispatch tables. Each
476    --       line has an internally generated number used for references between
477    --       tagged types and primitives. For each primitive the output has the
478    --       following fields:
479    --
480    --         - Letter 'P' or letter 's': The former indicates that this
481    --           primitive will be located in a primary dispatch table. The
482    --           latter indicates that it will be located in a secondary
483    --           dispatch table.
484    --
485    --         - Name of the primitive. In case of predefined Ada primitives
486    --           the text "(predefined)" is added before the name, and these
487    --           acronyms are used: SR (Stream_Read), SW (Stream_Write), SI
488    --           (Stream_Input), SO (Stream_Output), DA (Deep_Adjust), DF
489    --           (Deep_Finalize). In addition Oeq identifies the equality
490    --           operator, and "_assign" the assignment.
491    --
492    --         - If the primitive covers interface types, two extra fields
493    --           referencing other primitives are generated: "Alias" references
494    --           the primitive of the tagged type that covers an interface
495    --           primitive, and "AI_Alias" references the covered interface
496    --           primitive.
497    --
498    --         - The expression "at #xx" indicates the slot of the dispatch
499    --           table occupied by such primitive in its corresponding primary
500    --           or secondary dispatch table.
501    --
502    --         - In case of abstract subprograms the text "is abstract" is
503    --           added at the end of the line.
504
505    --  d.a  Force Target_Strict_Alignment to True, even on targets where it
506    --       would normally be false. Can be used for testing strict alignment
507    --       circuitry in the compiler.
508
509    --  d.b  Dump back end types. During Create_Standard, the back end is
510    --       queried for all available types. This option shows them.
511
512    --  d.c  Generate inline concatenation, instead of calling one of the
513    --       System.Concat_n.Str_Concat_n routines in cases where the latter
514    --       routines would normally be called.
515
516    --  d.d  Disable atomic synchronization for all atomic variable references.
517    --       Pragma Enable_Atomic_Synchronization is ignored.
518
519    --  d.e  Enable atomic synchronization for all atomic variable references.
520    --       Pragma Disable_Atomic_Synchronization is ignored, and also the
521    --       compiler switch -gnated is ignored.
522
523    --  d.f  Suppress folding of static expressions. This of course results
524    --       in seriously non-conforming behavior, but is useful sometimes
525    --       when tracking down handling of complex expressions.
526
527    --  d.g  Enables conversion of a raise statement into a goto when the
528    --       relevant handler is statically determinable. For now we only try
529    --       this if this debug flag is set. Later we will enable this more
530    --       generally by default.
531
532    --  d.i  Ignore all occurrences of pragma Warnings in the sources. This can
533    --       be used in particular to disable Warnings (Off) to check if any of
534    --       these statements are inappropriate.
535
536    --  d.l  Use Ada 95 semantics for limited function returns. This may be
537    --       used to work around the incompatibility introduced by AI-318-2.
538    --       It is useful only in -gnat05 mode.
539
540    --  d.m  When -gnatl is used, the normal output includes full listings of
541    --       all files in the extended main source (body/spec/subunits). If this
542    --       debug switch is used, then the full listing is given only for the
543    --       main source (this corresponds to a previous behavior of -gnatl and
544    --       is used for running the ACATS tests).
545
546    --  d.n  Print source file names as they are loaded. This is useful if the
547    --       compiler has a bug -- these are the files that need to be included
548    --       in a bug report.
549
550    --  d.o  Generate listing showing the IL instructions generated by the .NET
551    --       compiler for each subprogram.
552
553    --  d.p  Enable the .NET CIL verifier. During development the verifier is
554    --       disabled by default and this flag is used to enable it. In the
555    --       future we will reverse this functionality.
556
557    --  d.r  Forces the flag OK_To_Reorder_Components to be set in all record
558    --       base types that have no discriminants.
559
560    --  d.s  Normally the compiler expands slice moves into loops if overlap
561    --       might be possible. This debug flag inhibits that expansion, and
562    --       the back end is expected to use an appropriate routine to handle
563    --       overlap, based on Forward_OK and Backwards_OK flags.
564
565    --  d.t  The compiler has been modified (a fairly extensive modification)
566    --       to generate static dispatch tables for library level tagged types.
567    --       This debug switch disables this modification and reverts to the
568    --       previous dynamic construction of tables. It is there as a possible
569    --       work around if we run into trouble with the new implementation.
570
571    --  d.v  Forces the flag OK_To_Reorder_Components to be set in all record
572    --       base types that have at least one discriminant (v = variant).
573
574    --  d.w  This flag turns off the scanning of loops to detect possible
575    --       infinite loops.
576
577    --  d.A  There seems to be a problem with ASIS if we activate the circuit
578    --       for reading and writing the aspect specification hash table, so
579    --       for now, this is controlled by the debug flag d.A. The hash table
580    --       is only written and read if this flag is set.
581
582    --  d.x  No exception handlers in generated code. This causes exception
583    --       handlers to be eliminated from the generated code. They are still
584    --       fully compiled and analyzed, they just get eliminated from the
585    --       code generation step.
586
587    --  d.C  Generate call to System.Concat_n.Str_Concat_n routines in cases
588    --       where we would normally generate inline concatenation code.
589
590    --  d.D  Strict Alfa mode. Interpret compiler permissions as strictly as
591    --       possible in Alfa mode.
592
593    --  d.E  Force Alfa mode for gnat2why. In this mode, errors are issued for
594    --       all violations of Alfa in user code, and warnings are issued for
595    --       constructs not yet implemented in gnat2why.
596
597    --  d.F  Alfa mode. Generate AST in a form suitable for formal verification,
598    --       as well as additional cross reference information in ALI files to
599    --       compute effects of subprograms.
600
601    --  d.G  Precondition only mode for gnat2why. In this mode, gnat2why will
602    --       only generate Why code that checks for the well-guardedness of
603    --       preconditions.
604
605    --  d.H  Standard package only mode for gnat2why. In this mode, gnat2why
606    --       will only generate Why code for package Standard. Any given input
607    --       file will be ignored.
608
609    --  d.I  Generate SCIL mode. Generate intermediate code for the sake of
610    --       of static analysis tools, and ensure additional tree consistency
611    --       between different compilations of specs.
612
613    --  d.J  Disable parallel SCIL generation. Normally SCIL file generation is
614    --       done in parallel to speed processing. This switch disables this
615    --       behavior.
616
617    --  d.K  Alfa detection only mode for gnat2why. In this mode, gnat2why
618    --       will only generate the .alfa file, but no Why code.
619
620    --  d.L  Normally the front end generates special expansion for conditional
621    --       expressions of a limited type. This debug flag removes this special
622    --       case expansion, leaving it up to the back end to handle conditional
623    --       expressions correctly.
624
625    --  d.O  Dump internal SCO tables. Before outputting the SCO information to
626    --       the ALI file, the internal SCO tables (SCO_Table/SCO_Unit_Table)
627    --       are dumped for debugging purposes.
628
629    --  d.P  Previous non-optimized handling of length comparisons. Setting this
630    --       flag inhibits the effect of Optimize_Length_Comparison in Exp_Ch4.
631    --       This is there in case we find a situation where the optimization
632    --       malfunctions, to provide a work around.
633
634    --  d.S  Force Optimize_Alignment (Space) mode as the default
635
636    --  d.T  Force Optimize_Alignment (Time) mode as the default
637
638    --  d.W  Print out debugging information for Walk_Library_Items, including
639    --       the order in which units are walked. This is primarily for use in
640    --       debugging CodePeer mode.
641
642    --  d.X  By default, the compiler uses an elaborate rewriting framework for
643    --       short-circuited forms where the right hand condition generates
644    --       actions to be inserted. With the gcc backend, we now use the new
645    --       N_Expression_With_Actions node for this expansion, but we still use
646    --       the old method for other backends and in SCIL mode. This debug flag
647    --       forces use of the new N_Expression_With_Actions node in these other
648    --       cases and is intended for transitional use.
649
650    --  d.Y  Prevents the use of the N_Expression_With_Actions node even in the
651    --       case of the gcc back end. Provided as a back up in case the new
652    --       scheme has problems.
653
654    --  d1   Error messages have node numbers where possible. Normally error
655    --       messages have only source locations. This option is useful when
656    --       debugging errors caused by expanded code, where the source location
657    --       does not give enough information.
658
659    --  d2   Suppress output of the error position flags for verbose form error
660    --       messages. The messages are still interspersed in the listing, but
661    --       without any error flags or extra blank lines. Also causes an extra
662    --       <<< to be output at the right margin. This is intended to be the
663    --       easiest format for checking conformance of ACATS B tests. This
664    --       flag also suppresses the additional messages explaining why a
665    --       non-static expression is non-static (see Sem_Eval.Why_Not_Static).
666    --       This avoids having to worry about these messages in ACATS testing.
667
668    --  d3   Causes Comperr to dump the contents of the node for which an abort
669    --       was detected (normally only the Node_Id of the node is output).
670
671    --  d4   Inhibits automatic krunching of predefined library unit file names.
672    --       Normally, as described in the spec of package Krunch, such files
673    --       are automatically krunched to 8 characters, with special treatment
674    --       of the prefixes Ada, System, and Interfaces. Setting this debug
675    --       switch disables this special treatment.
676
677    --  d5   Causes the tree read/write circuit to output detailed information
678    --       tracking the data that is read and written element by element.
679
680    --  d6   Normally access-to-unconstrained-array types are represented
681    --       using fat (double) pointers. Using this debug flag causes them
682    --       to default to thin. This can be used to test the performance
683    --       implications of using thin pointers, and also to test that the
684    --       compiler functions correctly with this choice.
685
686    --  d7   Normally a -gnatl or -gnatv listing includes the time stamp
687    --       of the source file. This debug flag suppresses this output,
688    --       and also suppresses the message with the version number.
689    --       This is useful in certain regression tests.
690
691    --  d8   This forces the packed stuff to generate code assuming the
692    --       opposite endianness from the actual correct value. Useful in
693    --       testing out code generation from the packed routines.
694
695    ------------------------------------------
696    -- Documentation for Binder Debug Flags --
697    ------------------------------------------
698
699    --  da  Normally if there is an elaboration circularity, then in describing
700    --      the cycle, links involving internal units are omitted, since they
701    --      are irrelevant and confusing. This debug flag causes all links to
702    --      be listed, and is useful when diagnosing circularities introduced
703    --      by incorrect changes to the run-time library itself.
704
705    --  db  Output debug information from Better_Choice in Binde, which uses
706    --      various heuristics to determine elaboration order in cases where
707    --      multiple orders are valid.
708
709    --  dc  List units as they are chosen. As units are selected for addition to
710    --      the elaboration order, a line of output is generated showing which
711    --      unit has been selected.
712
713    --  de  Similar to the effect of -e (output complete list of elaboration
714    --      dependencies) except that internal units are included in the
715    --      listing.
716
717    --  di  Normally gnatbind calls Read_Ali with Ignore_Errors set to
718    --      False, since the binder really needs correct version ALI
719    --      files to do its job. This debug flag causes Ignore_Errors
720    --      mode to be set for the binder (and is particularly useful
721    --      for testing ignore errors mode).
722
723    --  dn  List details of manipulation of Num_Pred values during execution of
724    --      the algorithm used to determine a correct order of elaboration. This
725    --      is useful in diagnosing any problems in its behavior.
726
727    --  do  Use old elaboration order preference. The new preference rules
728    --      prefer specs with no bodies to specs with bodies, and between two
729    --      specs with bodies, prefers the one whose body is closer to being
730    --      able to be elaborated. This is a clear improvement, but we provide
731    --      this debug flag in case of regressions.
732
733    --  du  List unit name and file name for each unit as it is read in
734
735    --  dx  Force the binder to read (and then ignore) the xref information
736    --      in ali files (used to check that read circuit is working OK).
737
738    --------------------------------------------
739    -- Documentation for gnatmake Debug Flags --
740    --------------------------------------------
741
742    --  df  Only output file names, not path names, in log
743
744    --  dh  Generate listing showing loading of name table hash chains,
745    --      same as for the compiler.
746
747    --  dm  Issue a message indicating the maximum number of simultaneous
748    --      compilations.
749
750    --  dn  Do not delete temporary files created by gnatmake at the end
751    --      of execution, such as temporary config pragma files, mapping
752    --      files or project path files.
753
754    --  dp  Prints the Q used by routine Make.Compile_Sources every time
755    --      we go around the main compile loop of Make.Compile_Sources
756
757    --  dq  Prints source files as they are enqueued and dequeued in the Q
758    --      used by routine Make.Compile_Sources. Useful to figure out the
759    --      order in which sources are recompiled.
760
761    --  dt  When a time stamp mismatch has been found for an ALI file,
762    --      display the source file name, the time stamp expected and
763    --      the time stamp found.
764
765    --  du  List unit name and file name for each unit as it is read in
766
767    --  dw  Prints the list of units withed by the unit currently explored
768    --      during the main loop of Make.Compile_Sources.
769
770    ---------------------------------------------
771    -- Documentation for gprbuild Debug Flags  --
772    ---------------------------------------------
773
774    --  dn  Do not delete temporary files createed by gprbuild at the end
775    --      of execution, such as temporary config pragma files, mapping
776    --      files or project path files.
777
778    --  dt  When a time stamp mismatch has been found for an ALI file,
779    --      display the source file name, the time stamp expected and
780    --      the time stamp found.
781
782    --------------------
783    -- Set_Debug_Flag --
784    --------------------
785
786    procedure Set_Debug_Flag (C : Character; Val : Boolean := True) is
787       subtype Dig  is Character range '1' .. '9';
788       subtype LLet is Character range 'a' .. 'z';
789       subtype ULet is Character range 'A' .. 'Z';
790
791    begin
792       if C in Dig then
793          case Dig (C) is
794             when '1' => Debug_Flag_1 := Val;
795             when '2' => Debug_Flag_2 := Val;
796             when '3' => Debug_Flag_3 := Val;
797             when '4' => Debug_Flag_4 := Val;
798             when '5' => Debug_Flag_5 := Val;
799             when '6' => Debug_Flag_6 := Val;
800             when '7' => Debug_Flag_7 := Val;
801             when '8' => Debug_Flag_8 := Val;
802             when '9' => Debug_Flag_9 := Val;
803          end case;
804
805       elsif C in ULet then
806          case ULet (C) is
807             when 'A' => Debug_Flag_AA := Val;
808             when 'B' => Debug_Flag_BB := Val;
809             when 'C' => Debug_Flag_CC := Val;
810             when 'D' => Debug_Flag_DD := Val;
811             when 'E' => Debug_Flag_EE := Val;
812             when 'F' => Debug_Flag_FF := Val;
813             when 'G' => Debug_Flag_GG := Val;
814             when 'H' => Debug_Flag_HH := Val;
815             when 'I' => Debug_Flag_II := Val;
816             when 'J' => Debug_Flag_JJ := Val;
817             when 'K' => Debug_Flag_KK := Val;
818             when 'L' => Debug_Flag_LL := Val;
819             when 'M' => Debug_Flag_MM := Val;
820             when 'N' => Debug_Flag_NN := Val;
821             when 'O' => Debug_Flag_OO := Val;
822             when 'P' => Debug_Flag_PP := Val;
823             when 'Q' => Debug_Flag_QQ := Val;
824             when 'R' => Debug_Flag_RR := Val;
825             when 'S' => Debug_Flag_SS := Val;
826             when 'T' => Debug_Flag_TT := Val;
827             when 'U' => Debug_Flag_UU := Val;
828             when 'V' => Debug_Flag_VV := Val;
829             when 'W' => Debug_Flag_WW := Val;
830             when 'X' => Debug_Flag_XX := Val;
831             when 'Y' => Debug_Flag_YY := Val;
832             when 'Z' => Debug_Flag_ZZ := Val;
833          end case;
834
835       else
836          case LLet (C) is
837             when 'a' => Debug_Flag_A := Val;
838             when 'b' => Debug_Flag_B := Val;
839             when 'c' => Debug_Flag_C := Val;
840             when 'd' => Debug_Flag_D := Val;
841             when 'e' => Debug_Flag_E := Val;
842             when 'f' => Debug_Flag_F := Val;
843             when 'g' => Debug_Flag_G := Val;
844             when 'h' => Debug_Flag_H := Val;
845             when 'i' => Debug_Flag_I := Val;
846             when 'j' => Debug_Flag_J := Val;
847             when 'k' => Debug_Flag_K := Val;
848             when 'l' => Debug_Flag_L := Val;
849             when 'm' => Debug_Flag_M := Val;
850             when 'n' => Debug_Flag_N := Val;
851             when 'o' => Debug_Flag_O := Val;
852             when 'p' => Debug_Flag_P := Val;
853             when 'q' => Debug_Flag_Q := Val;
854             when 'r' => Debug_Flag_R := Val;
855             when 's' => Debug_Flag_S := Val;
856             when 't' => Debug_Flag_T := Val;
857             when 'u' => Debug_Flag_U := Val;
858             when 'v' => Debug_Flag_V := Val;
859             when 'w' => Debug_Flag_W := Val;
860             when 'x' => Debug_Flag_X := Val;
861             when 'y' => Debug_Flag_Y := Val;
862             when 'z' => Debug_Flag_Z := Val;
863          end case;
864       end if;
865    end Set_Debug_Flag;
866
867    ---------------------------
868    -- Set_Dotted_Debug_Flag --
869    ---------------------------
870
871    procedure Set_Dotted_Debug_Flag (C : Character; Val : Boolean := True) is
872       subtype Dig  is Character range '1' .. '9';
873       subtype LLet is Character range 'a' .. 'z';
874       subtype ULet is Character range 'A' .. 'Z';
875
876    begin
877       if C in Dig then
878          case Dig (C) is
879             when '1' => Debug_Flag_Dot_1 := Val;
880             when '2' => Debug_Flag_Dot_2 := Val;
881             when '3' => Debug_Flag_Dot_3 := Val;
882             when '4' => Debug_Flag_Dot_4 := Val;
883             when '5' => Debug_Flag_Dot_5 := Val;
884             when '6' => Debug_Flag_Dot_6 := Val;
885             when '7' => Debug_Flag_Dot_7 := Val;
886             when '8' => Debug_Flag_Dot_8 := Val;
887             when '9' => Debug_Flag_Dot_9 := Val;
888          end case;
889
890       elsif C in ULet then
891          case ULet (C) is
892             when 'A' => Debug_Flag_Dot_AA := Val;
893             when 'B' => Debug_Flag_Dot_BB := Val;
894             when 'C' => Debug_Flag_Dot_CC := Val;
895             when 'D' => Debug_Flag_Dot_DD := Val;
896             when 'E' => Debug_Flag_Dot_EE := Val;
897             when 'F' => Debug_Flag_Dot_FF := Val;
898             when 'G' => Debug_Flag_Dot_GG := Val;
899             when 'H' => Debug_Flag_Dot_HH := Val;
900             when 'I' => Debug_Flag_Dot_II := Val;
901             when 'J' => Debug_Flag_Dot_JJ := Val;
902             when 'K' => Debug_Flag_Dot_KK := Val;
903             when 'L' => Debug_Flag_Dot_LL := Val;
904             when 'M' => Debug_Flag_Dot_MM := Val;
905             when 'N' => Debug_Flag_Dot_NN := Val;
906             when 'O' => Debug_Flag_Dot_OO := Val;
907             when 'P' => Debug_Flag_Dot_PP := Val;
908             when 'Q' => Debug_Flag_Dot_QQ := Val;
909             when 'R' => Debug_Flag_Dot_RR := Val;
910             when 'S' => Debug_Flag_Dot_SS := Val;
911             when 'T' => Debug_Flag_Dot_TT := Val;
912             when 'U' => Debug_Flag_Dot_UU := Val;
913             when 'V' => Debug_Flag_Dot_VV := Val;
914             when 'W' => Debug_Flag_Dot_WW := Val;
915             when 'X' => Debug_Flag_Dot_XX := Val;
916             when 'Y' => Debug_Flag_Dot_YY := Val;
917             when 'Z' => Debug_Flag_Dot_ZZ := Val;
918          end case;
919
920       else
921          case LLet (C) is
922             when 'a' => Debug_Flag_Dot_A := Val;
923             when 'b' => Debug_Flag_Dot_B := Val;
924             when 'c' => Debug_Flag_Dot_C := Val;
925             when 'd' => Debug_Flag_Dot_D := Val;
926             when 'e' => Debug_Flag_Dot_E := Val;
927             when 'f' => Debug_Flag_Dot_F := Val;
928             when 'g' => Debug_Flag_Dot_G := Val;
929             when 'h' => Debug_Flag_Dot_H := Val;
930             when 'i' => Debug_Flag_Dot_I := Val;
931             when 'j' => Debug_Flag_Dot_J := Val;
932             when 'k' => Debug_Flag_Dot_K := Val;
933             when 'l' => Debug_Flag_Dot_L := Val;
934             when 'm' => Debug_Flag_Dot_M := Val;
935             when 'n' => Debug_Flag_Dot_N := Val;
936             when 'o' => Debug_Flag_Dot_O := Val;
937             when 'p' => Debug_Flag_Dot_P := Val;
938             when 'q' => Debug_Flag_Dot_Q := Val;
939             when 'r' => Debug_Flag_Dot_R := Val;
940             when 's' => Debug_Flag_Dot_S := Val;
941             when 't' => Debug_Flag_Dot_T := Val;
942             when 'u' => Debug_Flag_Dot_U := Val;
943             when 'v' => Debug_Flag_Dot_V := Val;
944             when 'w' => Debug_Flag_Dot_W := Val;
945             when 'x' => Debug_Flag_Dot_X := Val;
946             when 'y' => Debug_Flag_Dot_Y := Val;
947             when 'z' => Debug_Flag_Dot_Z := Val;
948          end case;
949       end if;
950    end Set_Dotted_Debug_Flag;
951
952 end Debug;