]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/ada/debug.adb
[multiple changes]
[thirdparty/gcc.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-2016, 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
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
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 Use old secondary stack method
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 Minimize the creation of public internal symbols for concatenation
102 -- d.i Ignore Warnings pragmas
103 -- d.j Generate listing of frontend inlined calls
104 -- d.k Kill referenced run-time library unit line numbers
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 Conservative elaboration order for indirect calls
109 -- d.p
110 -- d.q
111 -- d.r Enable OK_To_Reorder_Components in non-variant records
112 -- d.s
113 -- d.t Disable static allocation of library level dispatch tables
114 -- d.u Enable Modify_Tree_For_C (update tree for c)
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 Restore previous support for frontend handling of Inline_Always
120
121 -- d.A Read/write Aspect_Specifications hash table to tree
122 -- d.B Generate a bug box on abort_statement
123 -- d.C Generate concatenation call, do not generate inline code
124 -- d.D Disable errors on use of overriding keyword in Ada 95 mode
125 -- d.E Turn selected errors into warnings
126 -- d.F Debug mode for GNATprove
127 -- d.G Ignore calls through generic formal parameters for elaboration
128 -- d.H GNSA mode for ASIS
129 -- d.I Do not ignore enum representation clauses in CodePeer mode
130 -- d.J Disable parallel SCIL generation mode
131 -- d.K
132 -- d.L Depend on back end for limited types in if and case expressions
133 -- d.M Relaxed RM semantics
134 -- d.N Add node to all entities
135 -- d.O Dump internal SCO tables
136 -- d.P Previous (non-optimized) handling of length comparisons
137 -- d.Q Previous (incomplete) style check for binary operators
138 -- d.R Restrictions in ali files in positional form
139 -- d.S Force Optimize_Alignment (Space)
140 -- d.T Force Optimize_Alignment (Time)
141 -- d.U Ignore indirect calls for static elaboration
142 -- d.V Do not verify validity of SCIL files (CodePeer mode)
143 -- d.W Print out debugging information for Walk_Library_Items
144 -- d.X Old treatment of indexing aspects
145 -- d.Y
146 -- d.Z Do not enable expansion in configurable run-time mode
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 Suppress version/source stamp/compilation time for -gnatv/-gnatl
155 -- d8 Force opposite endianness in packed stuff
156 -- d9 Allow lock free implementation
157
158 -- d.1 Enable unnesting of nested procedures
159 -- d.2 Allow statements in declarative part
160 -- d.3 Output debugging information from Exp_Unst
161 -- d.4 Do not delete generated C file in case of errors
162 -- d.5 Do not generate imported subprogram definitions in C code
163 -- d.6
164 -- d.7
165 -- d.8
166 -- d.9
167
168 -- Debug flags for binder (GNATBIND)
169
170 -- da All links (including internal units) listed if there is a cycle
171 -- db Output information from Better_Choice
172 -- dc List units as they are chosen
173 -- dd
174 -- de Elaboration dependencies including system units
175 -- df
176 -- dg
177 -- dh
178 -- di Ignore_Errors mode for reading ali files
179 -- dj
180 -- dk
181 -- dl
182 -- dm
183 -- dn List details of manipulation of Num_Pred values
184 -- do Use old preference for elaboration order
185 -- dp
186 -- dq
187 -- dr
188 -- ds
189 -- dt
190 -- du List units as they are acquired
191 -- dv
192 -- dw
193 -- dx Force binder to read xref information from ali files
194 -- dy
195 -- dz
196
197 -- Debug flags used in package Make and its clients (e.g. GNATMAKE)
198
199 -- da
200 -- db
201 -- dc
202 -- dd
203 -- de
204 -- df Only output file names, not path names, in log
205 -- dg
206 -- dh Generate listing showing loading of name table hash chains
207 -- di
208 -- dj
209 -- dk
210 -- dl
211 -- dm Display the number of maximum simultaneous compilations
212 -- dn Do not delete temp files created by gnatmake
213 -- do
214 -- dp Prints the contents of the Q used by Make.Compile_Sources
215 -- dq Prints source files as they are enqueued and dequeued
216 -- dr
217 -- ds
218 -- dt Display time stamps when there is a mismatch
219 -- du List units as their ali files are acquired
220 -- dv
221 -- dw Prints the list of units withed by the unit currently explored
222 -- dx
223 -- dy
224 -- dz
225
226 --------------------------------------------
227 -- Documentation for Compiler Debug Flags --
228 --------------------------------------------
229
230 -- da Generate messages tracking semantic analyzer progress. A message
231 -- is output showing each node as it gets analyzed, expanded,
232 -- resolved, or evaluated. This option is useful for finding out
233 -- exactly where a bomb during semantic analysis is occurring.
234
235 -- db In Exp_Dbug, certain type names are encoded to include debugging
236 -- information. This debug switch causes lines to be output showing
237 -- the encodings used.
238
239 -- dc List names of units as they are compiled. One line of output will
240 -- be generated at the start of compiling each unit (package or
241 -- subprogram).
242
243 -- dd Dynamic allocation of tables messages generated. Each time a
244 -- table is reallocated, a line is output indicating the expansion.
245
246 -- de List the entity table
247
248 -- df Full tree/source print (includes withed units). Normally the tree
249 -- output (dt) or recreated source output (dg,do,ds) includes only
250 -- the main unit. If df is set, then the output in either case
251 -- includes all compiled units (see also dg,do,ds,dt). Note that to
252 -- be effective, this switch must be used in combination with one or
253 -- more of dt, dg, do or ds.
254
255 -- dg Print the source recreated from the generated tree. In the case
256 -- where the tree has been rewritten this output includes only the
257 -- generated code, not the original code (see also df,do,ds,dz).
258 -- This flag differs from -gnatG in that the output also includes
259 -- non-source generated null statements, and freeze nodes, which
260 -- are normally omitted in -gnatG mode.
261
262 -- dh Generates a table at the end of a compilation showing how the hash
263 -- table chains built by the Namet package are loaded. This is useful
264 -- in ensuring that the hashing algorithm (in Namet.Hash) is working
265 -- effectively with typical sets of program identifiers.
266
267 -- di Generate messages for visibility linking/delinking
268
269 -- dj Suppress "junk null check" for access parameters. This flag permits
270 -- Ada programs to pass null parameters to access parameters, and to
271 -- explicitly check such access values against the null literal.
272 -- Neither of these is valid Ada, but both were allowed in versions of
273 -- GNAT before 3.10, so this switch can ease the transition process.
274
275 -- dk Immediate kill on abort. Normally on an abort (i.e. a call to
276 -- Comperr.Compiler_Abort), the GNATBUG message is not given if
277 -- there is a previous error. This debug switch bypasses this test
278 -- and gives the message unconditionally (useful for debugging).
279
280 -- dl Generate unit load trace messages. A line of traceback output is
281 -- generated each time a request is made to the library manager to
282 -- load a new unit.
283
284 -- dn Generate messages for node/list allocation. Each time a node or
285 -- list header is allocated, a line of output is generated. Certain
286 -- other basic tree operations also cause a line of output to be
287 -- generated. This option is useful in seeing where the parser is
288 -- blowing up.
289
290 -- do Print the source recreated from the generated tree. In the case
291 -- where the tree has been rewritten, this output includes only the
292 -- original code, not the generated code (see also df,dg,ds,dz).
293
294 -- dp Generate messages for parser scope stack push/pops. A line of
295 -- output by the parser each time the parser scope stack is either
296 -- pushed or popped. Useful in debugging situations where the
297 -- parser scope stack ends up incorrectly synchronized
298
299 -- dq In layout version 1.38, 2002/01/12, a circuit was implemented
300 -- to give decent default alignment to short records that had no
301 -- specific alignment set. This debug option restores the previous
302 -- behavior of giving such records poor alignments, typically 1.
303 -- This may be useful in dealing with transition.
304
305 -- dr Generate parser resynchronization messages. Normally the parser
306 -- resynchronizes quietly. With this debug option, two messages
307 -- are generated, one when the parser starts a resynchronization
308 -- skip, and another when it resumes parsing. Useful in debugging
309 -- inadequate error recovery situations.
310
311 -- ds Print the source recreated from the generated tree. In the case
312 -- where the tree has been rewritten this output includes both the
313 -- generated code and the original code with the generated code
314 -- being enlosed in curly brackets (see also df,do,ds,dz)
315
316 -- dt Print full tree. The generated tree is output (see also df,dy)
317
318 -- du Uncheck categorization pragmas. This debug switch causes the
319 -- elaboration control pragmas (Pure, Preelaborate, etc.) and the
320 -- categorization pragmas (Shared_Passive, Remote_Types, etc.) to be
321 -- ignored, so that normal checks are not made (this is particularly
322 -- useful for adding temporary debugging code to units that have
323 -- pragmas that are inconsistent with the debugging code added).
324
325 -- dv Output trace of overload resolution. Outputs messages for
326 -- overload attempts that involve cascaded errors, or where
327 -- an interpretation is incompatible with the context.
328
329 -- dw Write semantic scope stack messages. Each time a scope is created
330 -- or removed, a message is output (see the Sem_Ch8.Push_Scope and
331 -- Sem_Ch8.Pop_Scope subprograms).
332
333 -- dx Force expansion on, even if no code being generated. Normally the
334 -- expander is inhibited if no code is generated. This switch forces
335 -- expansion to proceed normally even if the backend is not being
336 -- called. This is particularly useful for debugging purposes when
337 -- using the front-end only version of the compiler (which normally
338 -- would never do any expansion).
339
340 -- dy Print tree of package Standard. Normally the tree print out does
341 -- not include package Standard, even if the -df switch is set. This
342 -- switch forces output of the internal tree built for Standard.
343
344 -- dz Print source of package Standard. Normally the source print out
345 -- does not include package Standard, even if the -df switch is set.
346 -- This switch forces output of the source recreated from the internal
347 -- tree built for Standard. Note that this differs from -gnatS in
348 -- that it prints from the actual tree using the normal Sprint
349 -- circuitry for printing trees.
350
351 -- dA Forces output of representation information, including full
352 -- information for all internal type and object entities, as well
353 -- as all user defined type and object entities including private
354 -- and incomplete types. This debug switch also automatically sets
355 -- the equivalent of -gnatR3m.
356
357 -- dB Output debug encodings for types and variants. See Exp_Dbug for
358 -- exact form of the generated output.
359
360 -- dC Output trace information showing the decisions made during
361 -- check suppression activity in unit Checks.
362
363 -- dD Delete new elaboration checks. This flag causes GNAT to return
364 -- to the 3.13a elaboration semantics, and to suppress the fixing
365 -- of two bugs. The first is in the context of inner routines in
366 -- dynamic elaboration mode, when the subprogram we are in was
367 -- called at elaboration time by a unit that was also compiled with
368 -- dynamic elaboration checks. In this case, if A calls B calls C,
369 -- and all are in different units, we need an elaboration check at
370 -- each call. These nested checks were only put in recently (see
371 -- version 1.80 of Sem_Elab) and we provide this debug flag to
372 -- revert to the previous behavior in case of regressions. The
373 -- other behavior reverted by this flag is the treatment of the
374 -- Elaborate_Body pragma in static elaboration mode. This used to
375 -- be treated as not needing elaboration checking, but in fact in
376 -- general Elaborate_All is still required because of nested calls.
377
378 -- dE Apply compile time elaboration checking for with relations between
379 -- predefined units. Normally no checks are made (it seems that at
380 -- least on the SGI, such checks run into trouble).
381
382 -- dF Front end data layout enabled. Normally front end data layout
383 -- is only enabled if the target parameter Backend_Layout is False.
384 -- This debugging switch enables it unconditionally.
385
386 -- dG Generate all warnings. Normally Errout suppresses warnings on
387 -- units that are not part of the main extended source, and also
388 -- suppresses warnings on instantiations in the main extended
389 -- source that duplicate warnings already posted on the template.
390 -- This switch stops both kinds of deletion and causes Errout to
391 -- post all warnings sent to it.
392
393 -- dH Inhibit call to gigi. This is useful for testing front end data
394 -- layout, and may be useful in other debugging situations where
395 -- you do not want gigi to intefere with the testing.
396
397 -- dI Inhibit internal name numbering in gnatDG listing. Any sequence of
398 -- the form <uppercase-letter><digits><lowercase-letter> appearing in
399 -- a name is replaced by <uppercase-letter>...<lowercase-letter>. This
400 -- is used in the fixed bugs run to minimize system and version
401 -- dependency in filed -gnatD or -gnatG output.
402
403 -- dK Kill all error messages. This debug flag suppresses the output
404 -- of all error messages. It is used in regression tests where the
405 -- error messages are target dependent and irrelevant.
406
407 -- dL Output trace information on elaboration checking. This debug
408 -- switch causes output to be generated showing each call or
409 -- instantiation as it is checked, and the progress of the recursive
410 -- trace through calls at elaboration time.
411
412 -- dM Assume all variables have been modified, and ignore current value
413 -- indications. This debug flag disconnects the tracking of constant
414 -- values (see Exp_Ch2.Expand_Current_Value).
415
416 -- dN Do not generate file name information in exception messages
417
418 -- dO Output immediate error messages. This causes error messages to
419 -- be output as soon as they are generated (disconnecting several
420 -- circuits for improvement of messages, deletion of duplicate
421 -- messages etc). Useful to diagnose compiler bombs caused by
422 -- erroneous handling of error situations
423
424 -- dP Do not check for controlled objects in preelaborable packages.
425 -- RM 10.2.1(9) forbids the use of library level controlled objects
426 -- in preelaborable packages, but this restriction is a huge pain,
427 -- especially in the predefined library units.
428
429 -- dQ Use old method for determining what goes on the secondary stack.
430 -- This disables some newer optimizations. The intent is to use this
431 -- temporarily to measure before/after efficiency. ???Remove this
432 -- when we are done (see Sem_Util.Requires_Transient_Scope).
433
434 -- dR Bypass the check for a proper version of s-rpc being present
435 -- to use the -gnatz? switch. This allows debugging of the use
436 -- of stubs generation without needing to have GLADE (or some
437 -- other PCS installed).
438
439 -- dS Omit conversion of fpt numbers to exact machine numbers in
440 -- non-static evaluation contexts (see Check_Non_Static_Context).
441 -- This is intended for testing out timing problems with this
442 -- conversion circuit.
443
444 -- dT Similar to dS, but omits the conversions only in the case where
445 -- the parent is not a constant declaration.
446
447 -- dU Enable garbage collection of unreachable entities. This enables
448 -- both the reachability analysis and changing the Is_Public and
449 -- Is_Eliminated flags.
450
451 -- dV Enable viewing of all symbols in debugger. Causes debug information
452 -- to be generated for all symbols, including internal symbols. This
453 -- is enabled by default for -gnatD, but this switch allows this to
454 -- be enabled without generating modified source files. Note that the
455 -- use of -gnatdV ensures in the dwarf/elf case that all symbols that
456 -- are present in the elf tables are also in the dwarf tables (which
457 -- seems to be required by some tools). Another effect of dV is to
458 -- generate full qualified names, including internal names generated
459 -- for blocks and loops.
460
461 -- dW Disable warnings when a possibly uninitialized scalar value is
462 -- passed to an IN OUT parameter of a procedure. This usage is a
463 -- quite improper bounded error [erroneous in Ada 83] situation,
464 -- and would normally generate a warning. However, to ease the
465 -- task of transitioning incorrect legacy code, we provide this
466 -- undocumented feature for suppressing these warnings.
467
468 -- dY Enable configurable run-time mode, just as though the System file
469 -- had Configurable_Run_Time_Mode set to True. This is useful in
470 -- testing high integrity mode.
471
472 -- dZ Generate listing showing the contents of the dispatch tables. Each
473 -- line has an internally generated number used for references between
474 -- tagged types and primitives. For each primitive the output has the
475 -- following fields:
476 --
477 -- - Letter 'P' or letter 's': The former indicates that this
478 -- primitive will be located in a primary dispatch table. The
479 -- latter indicates that it will be located in a secondary
480 -- dispatch table.
481 --
482 -- - Name of the primitive. In case of predefined Ada primitives
483 -- the text "(predefined)" is added before the name, and these
484 -- acronyms are used: SR (Stream_Read), SW (Stream_Write), SI
485 -- (Stream_Input), SO (Stream_Output), DA (Deep_Adjust), DF
486 -- (Deep_Finalize). In addition Oeq identifies the equality
487 -- operator, and "_assign" the assignment.
488 --
489 -- - If the primitive covers interface types, two extra fields
490 -- referencing other primitives are generated: "Alias" references
491 -- the primitive of the tagged type that covers an interface
492 -- primitive, and "AI_Alias" references the covered interface
493 -- primitive.
494 --
495 -- - The expression "at #xx" indicates the slot of the dispatch
496 -- table occupied by such primitive in its corresponding primary
497 -- or secondary dispatch table.
498 --
499 -- - In case of abstract subprograms the text "is abstract" is
500 -- added at the end of the line.
501
502 -- d.a Force Target_Strict_Alignment to True, even on targets where it
503 -- would normally be false. Can be used for testing strict alignment
504 -- circuitry in the compiler.
505
506 -- d.b Dump back end types. During Create_Standard, the back end is
507 -- queried for all available types. This option shows them.
508
509 -- d.c Generate inline concatenation, instead of calling one of the
510 -- System.Concat_n.Str_Concat_n routines in cases where the latter
511 -- routines would normally be called.
512
513 -- d.d Disable atomic synchronization for all atomic variable references.
514 -- Pragma Enable_Atomic_Synchronization is ignored.
515
516 -- d.e Enable atomic synchronization for all atomic variable references.
517 -- Pragma Disable_Atomic_Synchronization is ignored, and also the
518 -- compiler switch -gnated is ignored.
519
520 -- d.f Suppress folding of static expressions. This of course results
521 -- in seriously non-conforming behavior, but is useful sometimes
522 -- when tracking down handling of complex expressions.
523
524 -- d.g Enables conversion of a raise statement into a goto when the
525 -- relevant handler is statically determinable. For now we only try
526 -- this if this debug flag is set. Later we will enable this more
527 -- generally by default.
528
529 -- d.h Minimize the creation of public internal symbols for concatenation
530 -- by enforcing a secondary stack-like handling of the final result.
531 -- The target of the concatenation is thus constrained in place and
532 -- initialized with the result instead of acting as its alias.
533
534 -- d.i Ignore all occurrences of pragma Warnings in the sources. This can
535 -- be used in particular to disable Warnings (Off) to check if any of
536 -- these statements are inappropriate.
537
538 -- d.k If an error message contains a reference to a location in an
539 -- internal unit, then suppress the line number in this reference.
540
541 -- d.j Generate listing of frontend inlined calls and inline calls passed
542 -- to the backend. This is useful to locate skipped calls that must be
543 -- inlined by the frontend.
544
545 -- d.l Use Ada 95 semantics for limited function returns. This may be
546 -- used to work around the incompatibility introduced by AI-318-2.
547 -- It is useful only in -gnat05 mode.
548
549 -- d.m When -gnatl is used, the normal output includes full listings of
550 -- all files in the extended main source (body/spec/subunits). If this
551 -- debug switch is used, then the full listing is given only for the
552 -- main source (this corresponds to a previous behavior of -gnatl and
553 -- is used for running the ACATS tests).
554
555 -- d.n Print source file names as they are loaded. This is useful if the
556 -- compiler has a bug -- these are the files that need to be included
557 -- in a bug report.
558
559 -- d.o Conservative elaboration order for indirect calls. This causes
560 -- P'Access to be treated as a call in more cases.
561
562 -- d.r Forces the flag OK_To_Reorder_Components to be set in all record
563 -- base types that have no discriminants.
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.u Sets Modify_Tree_For_C mode in which tree is modified to make it
572 -- easier to generate code using a C compiler.
573
574 -- d.v Forces the flag OK_To_Reorder_Components to be set in all record
575 -- base types that have at least one discriminant (v = variant).
576
577 -- d.w This flag turns off the scanning of loops to detect possible
578 -- infinite loops.
579
580 -- d.x No exception handlers in generated code. This causes exception
581 -- handlers to be eliminated from the generated code. They are still
582 -- fully compiled and analyzed, they just get eliminated from the
583 -- code generation step.
584
585 -- d.z Restore previous front-end support for Inline_Always. In default
586 -- mode, for targets that use the GCC back end, Inline_Always is
587 -- handled by the back end. Use of this switch restores the previous
588 -- handling of Inline_Always by the front end on such targets. For the
589 -- targets that do not use the GCC back end, this switch is ignored.
590
591 -- d.A There seems to be a problem with ASIS if we activate the circuit
592 -- for reading and writing the aspect specification hash table, so
593 -- for now, this is controlled by the debug flag d.A. The hash table
594 -- is only written and read if this flag is set.
595
596 -- d.B Generate a bug box when we see an abort_statement, even though
597 -- there is no bug. Useful for testing Comperr.Compiler_Abort: write
598 -- some code containing an abort_statement, and compile it with
599 -- -gnatd.B. There is nothing special about abort_statements; it just
600 -- provides a way to control where the bug box is generated. See "when
601 -- N_Abort_Statement" in package body Expander.
602
603 -- d.C Generate call to System.Concat_n.Str_Concat_n routines in cases
604 -- where we would normally generate inline concatenation code.
605
606 -- d.D For compatibility with some Ada 95 compilers implementing only
607 -- one feature of Ada 2005 (overriding keyword), disable errors on use
608 -- of overriding keyword in Ada 95 mode.
609
610 -- d.E Turn selected errors into warnings. This debug switch causes a
611 -- specific set of error messages into warnings. Setting this switch
612 -- causes Opt.Error_To_Warning to be set to True. The intention is
613 -- that this be used for messages representing upwards incompatible
614 -- changes to Ada 2012 that cause previously correct programs to be
615 -- treated as illegal now. The following cases are affected:
616 --
617 -- Errors relating to overlapping subprogram parameters for cases
618 -- other than IN OUT parameters to functions.
619 --
620 -- Errors relating to the new rules about not defining equality
621 -- too late so that composition of equality can be assured.
622 --
623 -- Errors relating to overriding indicators on protected subprogram
624 -- bodies (not an Ada 2012 incompatibility, but might cause errors
625 -- for existing programs assuming they were legal because GNAT
626 -- formerly allowed them).
627
628 -- d.F Sets GNATprove_Mode to True. This allows debugging the frontend in
629 -- the special mode used by GNATprove.
630
631 -- d.G Previously the compiler ignored calls via generic formal parameters
632 -- when doing the analysis for the static elaboration model. This is
633 -- now fixed, but we provide this debug flag to revert to the previous
634 -- situation of ignoring such calls to aid in transition.
635
636 -- d.H Sets ASIS_GNSA_Mode to True. This signals the front end to suppress
637 -- the call to gigi in ASIS_Mode.
638
639 -- d.I Do not ignore enum representation clauses in CodePeer mode.
640 -- The default of ignoring representation clauses for enumeration
641 -- types in CodePeer is good for the majority of Ada code, but in some
642 -- cases being able to change this default might be useful to remove
643 -- some false positives.
644
645 -- d.J Disable parallel SCIL generation. Normally SCIL file generation is
646 -- done in parallel to speed processing. This switch disables this
647 -- behavior.
648
649 -- d.L Normally the front end generates special expansion for conditional
650 -- expressions of a limited type. This debug flag removes this special
651 -- case expansion, leaving it up to the back end to handle conditional
652 -- expressions correctly.
653
654 -- d.M Relaxed RM semantics. This flag sets Opt.Relaxed_RM_Semantics
655 -- See Opt.Relaxed_RM_Semantics for more details.
656
657 -- d.N Enlarge entities by one node (but don't attempt to use this extra
658 -- node for storage of any flags or fields). This can be used to do
659 -- experiments on the impact of increasing entity sizes.
660
661 -- d.O Dump internal SCO tables. Before outputting the SCO information to
662 -- the ALI file, the internal SCO tables (SCO_Table/SCO_Unit_Table)
663 -- are dumped for debugging purposes.
664
665 -- d.P Previous non-optimized handling of length comparisons. Setting this
666 -- flag inhibits the effect of Optimize_Length_Comparison in Exp_Ch4.
667 -- This is there in case we find a situation where the optimization
668 -- malfunctions, to provide a work around.
669
670 -- d.Q Previous incomplete style checks for binary operators. Style checks
671 -- for token separation rules were incomplete and have been made
672 -- compliant with the documentation. For example, no warning was
673 -- issued for expressions such as 16-One or "A"&"B". Setting this flag
674 -- inhibits these new checks.
675
676 -- d.R As documented in lib-writ.ads, restrictions in the ali file can
677 -- have two forms, positional and named. The named notation is the
678 -- current preferred form, but the use of this debug switch will force
679 -- the use of the obsolescent positional form.
680
681 -- d.S Force Optimize_Alignment (Space) mode as the default
682
683 -- d.T Force Optimize_Alignment (Time) mode as the default
684
685 -- d.U Ignore indirect calls for static elaboration. The static
686 -- elaboration model is conservative, especially regarding indirect
687 -- calls. If you say Proc'Access, it will assume you might call
688 -- Proc. This can cause elaboration cycles at bind time. This flag
689 -- reverts to the behavior of earlier compilers, which ignored
690 -- indirect calls.
691
692 -- d.V Do not verify the validity of SCIL files (CodePeer mode). When
693 -- generating SCIL files for CodePeer, by default we verify that the
694 -- SCIL is well formed before saving it on disk. This switch can be
695 -- used to disable this checking, either to improve speed or to shut
696 -- down a false positive detected during the verification.
697
698 -- d.W Print out debugging information for Walk_Library_Items, including
699 -- the order in which units are walked. This is primarily for use in
700 -- debugging CodePeer mode.
701
702 -- d.X A previous version of GNAT allowed indexing aspects to be redefined
703 -- on derived container types, while the default iterator was
704 -- inherited from the parent type. This nonstandard extension is
705 -- preserved temporarily for use by the modeling project under debug
706 -- flag d.X.
707
708 -- d.Z Normally we always enable expansion in configurable run-time mode
709 -- to make sure we get error messages about unsupported features even
710 -- when compiling in -gnatc mode. But expansion is turned off in this
711 -- case if debug flag -gnatd.Z is used. This is to deal with the case
712 -- where we discover difficulties in this new processing.
713
714 -- d1 Error messages have node numbers where possible. Normally error
715 -- messages have only source locations. This option is useful when
716 -- debugging errors caused by expanded code, where the source location
717 -- does not give enough information.
718
719 -- d2 Suppress output of the error position flags for verbose form error
720 -- messages. The messages are still interspersed in the listing, but
721 -- without any error flags or extra blank lines. Also causes an extra
722 -- <<< to be output at the right margin. This is intended to be the
723 -- easiest format for checking conformance of ACATS B tests. This
724 -- flag also suppresses the additional messages explaining why a
725 -- non-static expression is non-static (see Sem_Eval.Why_Not_Static).
726 -- This avoids having to worry about these messages in ACATS testing.
727
728 -- d3 Causes Comperr to dump the contents of the node for which an abort
729 -- was detected (normally only the Node_Id of the node is output).
730
731 -- d4 Inhibits automatic krunching of predefined library unit file names.
732 -- Normally, as described in the spec of package Krunch, such files
733 -- are automatically krunched to 8 characters, with special treatment
734 -- of the prefixes Ada, System, and Interfaces. Setting this debug
735 -- switch disables this special treatment.
736
737 -- d5 Causes the tree read/write circuit to output detailed information
738 -- tracking the data that is read and written element by element.
739
740 -- d6 Normally access-to-unconstrained-array types are represented
741 -- using fat (double) pointers. Using this debug flag causes them
742 -- to default to thin. This can be used to test the performance
743 -- implications of using thin pointers, and also to test that the
744 -- compiler functions correctly with this choice.
745
746 -- d7 Normally a -gnatl or -gnatv listing includes the time stamp of the
747 -- source file and the time of the compilation. This debug flag can
748 -- be used to suppress this output, and also suppresses the message
749 -- with the version of the compiler. This is useful for regression
750 -- tests which need to have consistent output.
751
752 -- d8 This forces the packed stuff to generate code assuming the
753 -- opposite endianness from the actual correct value. Useful in
754 -- testing out code generation from the packed routines.
755
756 -- d9 This allows lock free implementation for protected objects
757 -- (see Exp_Ch9).
758
759 -- d.1 Sets Opt.Unnest_Subprogram_Mode to enable unnesting of subprograms.
760 -- This special pass does not actually unnest things, but it ensures
761 -- that a nested procedure does not contain any uplevel references.
762 -- See spec of Exp_Unst for full details.
763
764 -- d.2 Allow statements within declarative parts. This is not usually
765 -- allowed, but in some debugging contexts (e.g. testing the circuit
766 -- for unnesting of procedures), it is useful to allow this.
767
768 -- d.3 Output debugging information from Exp_Unst, including the name of
769 -- any unreachable subprograms that get deleted.
770
771 -- d.4 By default in case of an error during C generation, the .c or .h
772 -- file is deleted. This flag keeps the C file.
773
774 -- d.5 By default a subprogram imported generates a subprogram profile.
775 -- This debug flag disables this generation when generating C code,
776 -- assuming a proper #include will be used instead.
777
778 ------------------------------------------
779 -- Documentation for Binder Debug Flags --
780 ------------------------------------------
781
782 -- da Normally if there is an elaboration circularity, then in describing
783 -- the cycle, links involving internal units are omitted, since they
784 -- are irrelevant and confusing. This debug flag causes all links to
785 -- be listed, and is useful when diagnosing circularities introduced
786 -- by incorrect changes to the run-time library itself.
787
788 -- db Output debug information from Better_Choice in Binde, which uses
789 -- various heuristics to determine elaboration order in cases where
790 -- multiple orders are valid.
791
792 -- dc List units as they are chosen. As units are selected for addition to
793 -- the elaboration order, a line of output is generated showing which
794 -- unit has been selected.
795
796 -- de Similar to the effect of -e (output complete list of elaboration
797 -- dependencies) except that internal units are included in the
798 -- listing.
799
800 -- di Normally gnatbind calls Read_Ali with Ignore_Errors set to
801 -- False, since the binder really needs correct version ALI
802 -- files to do its job. This debug flag causes Ignore_Errors
803 -- mode to be set for the binder (and is particularly useful
804 -- for testing ignore errors mode).
805
806 -- dn List details of manipulation of Num_Pred values during execution of
807 -- the algorithm used to determine a correct order of elaboration. This
808 -- is useful in diagnosing any problems in its behavior.
809
810 -- do Use old elaboration order preference. The new preference rules
811 -- prefer specs with no bodies to specs with bodies, and between two
812 -- specs with bodies, prefers the one whose body is closer to being
813 -- able to be elaborated. This is a clear improvement, but we provide
814 -- this debug flag in case of regressions.
815
816 -- du List unit name and file name for each unit as it is read in
817
818 -- dx Force the binder to read (and then ignore) the xref information
819 -- in ali files (used to check that read circuit is working OK).
820
821 --------------------------------------------
822 -- Documentation for gnatmake Debug Flags --
823 --------------------------------------------
824
825 -- df Only output file names, not path names, in log
826
827 -- dh Generate listing showing loading of name table hash chains,
828 -- same as for the compiler.
829
830 -- dm Issue a message indicating the maximum number of simultaneous
831 -- compilations.
832
833 -- dn Do not delete temporary files created by gnatmake at the end
834 -- of execution, such as temporary config pragma files, mapping
835 -- files or project path files. This debug switch is equivalent to
836 -- the standard switch --keep-temp-files. We retain the debug switch
837 -- for back compatibility with past usage.
838
839 -- dp Prints the Q used by routine Make.Compile_Sources every time
840 -- we go around the main compile loop of Make.Compile_Sources
841
842 -- dq Prints source files as they are enqueued and dequeued in the Q
843 -- used by routine Make.Compile_Sources. Useful to figure out the
844 -- order in which sources are recompiled.
845
846 -- dt When a time stamp mismatch has been found for an ALI file,
847 -- display the source file name, the time stamp expected and
848 -- the time stamp found.
849
850 -- du List unit name and file name for each unit as it is read in
851
852 -- dw Prints the list of units withed by the unit currently explored
853 -- during the main loop of Make.Compile_Sources.
854
855 ---------------------------------------------
856 -- Documentation for gprbuild Debug Flags --
857 ---------------------------------------------
858
859 -- dm Display the maximum number of simultaneous compilations.
860
861 -- dn Do not delete temporary files created by gprbuild at the end
862 -- of execution, such as temporary config pragma files, mapping
863 -- files or project path files. This debug switch is equivalent to
864 -- the standard switch --keep-temp-files. We retain the debug switch
865 -- for back compatibility with past usage.
866
867 -- dt When a time stamp mismatch has been found for an ALI file,
868 -- display the source file name, the time stamp expected and
869 -- the time stamp found.
870
871 --------------------
872 -- Set_Debug_Flag --
873 --------------------
874
875 procedure Set_Debug_Flag (C : Character; Val : Boolean := True) is
876 subtype Dig is Character range '1' .. '9';
877 subtype LLet is Character range 'a' .. 'z';
878 subtype ULet is Character range 'A' .. 'Z';
879
880 begin
881 if C in Dig then
882 case Dig (C) is
883 when '1' =>
884 Debug_Flag_1 := Val;
885 when '2' =>
886 Debug_Flag_2 := Val;
887 when '3' =>
888 Debug_Flag_3 := Val;
889 when '4' =>
890 Debug_Flag_4 := Val;
891 when '5' =>
892 Debug_Flag_5 := Val;
893 when '6' =>
894 Debug_Flag_6 := Val;
895 when '7' =>
896 Debug_Flag_7 := Val;
897 when '8' =>
898 Debug_Flag_8 := Val;
899 when '9' =>
900 Debug_Flag_9 := Val;
901 end case;
902
903 elsif C in ULet then
904 case ULet (C) is
905 when 'A' =>
906 Debug_Flag_AA := Val;
907 when 'B' =>
908 Debug_Flag_BB := Val;
909 when 'C' =>
910 Debug_Flag_CC := Val;
911 when 'D' =>
912 Debug_Flag_DD := Val;
913 when 'E' =>
914 Debug_Flag_EE := Val;
915 when 'F' =>
916 Debug_Flag_FF := Val;
917 when 'G' =>
918 Debug_Flag_GG := Val;
919 when 'H' =>
920 Debug_Flag_HH := Val;
921 when 'I' =>
922 Debug_Flag_II := Val;
923 when 'J' =>
924 Debug_Flag_JJ := Val;
925 when 'K' =>
926 Debug_Flag_KK := Val;
927 when 'L' =>
928 Debug_Flag_LL := Val;
929 when 'M' =>
930 Debug_Flag_MM := Val;
931 when 'N' =>
932 Debug_Flag_NN := Val;
933 when 'O' =>
934 Debug_Flag_OO := Val;
935 when 'P' =>
936 Debug_Flag_PP := Val;
937 when 'Q' =>
938 Debug_Flag_QQ := Val;
939 when 'R' =>
940 Debug_Flag_RR := Val;
941 when 'S' =>
942 Debug_Flag_SS := Val;
943 when 'T' =>
944 Debug_Flag_TT := Val;
945 when 'U' =>
946 Debug_Flag_UU := Val;
947 when 'V' =>
948 Debug_Flag_VV := Val;
949 when 'W' =>
950 Debug_Flag_WW := Val;
951 when 'X' =>
952 Debug_Flag_XX := Val;
953 when 'Y' =>
954 Debug_Flag_YY := Val;
955 when 'Z' =>
956 Debug_Flag_ZZ := Val;
957 end case;
958
959 else
960 case LLet (C) is
961 when 'a' =>
962 Debug_Flag_A := Val;
963 when 'b' =>
964 Debug_Flag_B := Val;
965 when 'c' =>
966 Debug_Flag_C := Val;
967 when 'd' =>
968 Debug_Flag_D := Val;
969 when 'e' =>
970 Debug_Flag_E := Val;
971 when 'f' =>
972 Debug_Flag_F := Val;
973 when 'g' =>
974 Debug_Flag_G := Val;
975 when 'h' =>
976 Debug_Flag_H := Val;
977 when 'i' =>
978 Debug_Flag_I := Val;
979 when 'j' =>
980 Debug_Flag_J := Val;
981 when 'k' =>
982 Debug_Flag_K := Val;
983 when 'l' =>
984 Debug_Flag_L := Val;
985 when 'm' =>
986 Debug_Flag_M := Val;
987 when 'n' =>
988 Debug_Flag_N := Val;
989 when 'o' =>
990 Debug_Flag_O := Val;
991 when 'p' =>
992 Debug_Flag_P := Val;
993 when 'q' =>
994 Debug_Flag_Q := Val;
995 when 'r' =>
996 Debug_Flag_R := Val;
997 when 's' =>
998 Debug_Flag_S := Val;
999 when 't' =>
1000 Debug_Flag_T := Val;
1001 when 'u' =>
1002 Debug_Flag_U := Val;
1003 when 'v' =>
1004 Debug_Flag_V := Val;
1005 when 'w' =>
1006 Debug_Flag_W := Val;
1007 when 'x' =>
1008 Debug_Flag_X := Val;
1009 when 'y' =>
1010 Debug_Flag_Y := Val;
1011 when 'z' =>
1012 Debug_Flag_Z := Val;
1013 end case;
1014 end if;
1015 end Set_Debug_Flag;
1016
1017 ---------------------------
1018 -- Set_Dotted_Debug_Flag --
1019 ---------------------------
1020
1021 procedure Set_Dotted_Debug_Flag (C : Character; Val : Boolean := True) is
1022 subtype Dig is Character range '1' .. '9';
1023 subtype LLet is Character range 'a' .. 'z';
1024 subtype ULet is Character range 'A' .. 'Z';
1025
1026 begin
1027 if C in Dig then
1028 case Dig (C) is
1029 when '1' =>
1030 Debug_Flag_Dot_1 := Val;
1031 when '2' =>
1032 Debug_Flag_Dot_2 := Val;
1033 when '3' =>
1034 Debug_Flag_Dot_3 := Val;
1035 when '4' =>
1036 Debug_Flag_Dot_4 := Val;
1037 when '5' =>
1038 Debug_Flag_Dot_5 := Val;
1039 when '6' =>
1040 Debug_Flag_Dot_6 := Val;
1041 when '7' =>
1042 Debug_Flag_Dot_7 := Val;
1043 when '8' =>
1044 Debug_Flag_Dot_8 := Val;
1045 when '9' =>
1046 Debug_Flag_Dot_9 := Val;
1047 end case;
1048
1049 elsif C in ULet then
1050 case ULet (C) is
1051 when 'A' =>
1052 Debug_Flag_Dot_AA := Val;
1053 when 'B' =>
1054 Debug_Flag_Dot_BB := Val;
1055 when 'C' =>
1056 Debug_Flag_Dot_CC := Val;
1057 when 'D' =>
1058 Debug_Flag_Dot_DD := Val;
1059 when 'E' =>
1060 Debug_Flag_Dot_EE := Val;
1061 when 'F' =>
1062 Debug_Flag_Dot_FF := Val;
1063 when 'G' =>
1064 Debug_Flag_Dot_GG := Val;
1065 when 'H' =>
1066 Debug_Flag_Dot_HH := Val;
1067 when 'I' =>
1068 Debug_Flag_Dot_II := Val;
1069 when 'J' =>
1070 Debug_Flag_Dot_JJ := Val;
1071 when 'K' =>
1072 Debug_Flag_Dot_KK := Val;
1073 when 'L' =>
1074 Debug_Flag_Dot_LL := Val;
1075 when 'M' =>
1076 Debug_Flag_Dot_MM := Val;
1077 when 'N' =>
1078 Debug_Flag_Dot_NN := Val;
1079 when 'O' =>
1080 Debug_Flag_Dot_OO := Val;
1081 when 'P' =>
1082 Debug_Flag_Dot_PP := Val;
1083 when 'Q' =>
1084 Debug_Flag_Dot_QQ := Val;
1085 when 'R' =>
1086 Debug_Flag_Dot_RR := Val;
1087 when 'S' =>
1088 Debug_Flag_Dot_SS := Val;
1089 when 'T' =>
1090 Debug_Flag_Dot_TT := Val;
1091 when 'U' =>
1092 Debug_Flag_Dot_UU := Val;
1093 when 'V' =>
1094 Debug_Flag_Dot_VV := Val;
1095 when 'W' =>
1096 Debug_Flag_Dot_WW := Val;
1097 when 'X' =>
1098 Debug_Flag_Dot_XX := Val;
1099 when 'Y' =>
1100 Debug_Flag_Dot_YY := Val;
1101 when 'Z' =>
1102 Debug_Flag_Dot_ZZ := Val;
1103 end case;
1104
1105 else
1106 case LLet (C) is
1107 when 'a' =>
1108 Debug_Flag_Dot_A := Val;
1109 when 'b' =>
1110 Debug_Flag_Dot_B := Val;
1111 when 'c' =>
1112 Debug_Flag_Dot_C := Val;
1113 when 'd' =>
1114 Debug_Flag_Dot_D := Val;
1115 when 'e' =>
1116 Debug_Flag_Dot_E := Val;
1117 when 'f' =>
1118 Debug_Flag_Dot_F := Val;
1119 when 'g' =>
1120 Debug_Flag_Dot_G := Val;
1121 when 'h' =>
1122 Debug_Flag_Dot_H := Val;
1123 when 'i' =>
1124 Debug_Flag_Dot_I := Val;
1125 when 'j' =>
1126 Debug_Flag_Dot_J := Val;
1127 when 'k' =>
1128 Debug_Flag_Dot_K := Val;
1129 when 'l' =>
1130 Debug_Flag_Dot_L := Val;
1131 when 'm' =>
1132 Debug_Flag_Dot_M := Val;
1133 when 'n' =>
1134 Debug_Flag_Dot_N := Val;
1135 when 'o' =>
1136 Debug_Flag_Dot_O := Val;
1137 when 'p' =>
1138 Debug_Flag_Dot_P := Val;
1139 when 'q' =>
1140 Debug_Flag_Dot_Q := Val;
1141 when 'r' =>
1142 Debug_Flag_Dot_R := Val;
1143 when 's' =>
1144 Debug_Flag_Dot_S := Val;
1145 when 't' =>
1146 Debug_Flag_Dot_T := Val;
1147 when 'u' =>
1148 Debug_Flag_Dot_U := Val;
1149 when 'v' =>
1150 Debug_Flag_Dot_V := Val;
1151 when 'w' =>
1152 Debug_Flag_Dot_W := Val;
1153 when 'x' =>
1154 Debug_Flag_Dot_X := Val;
1155 when 'y' =>
1156 Debug_Flag_Dot_Y := Val;
1157 when 'z' =>
1158 Debug_Flag_Dot_Z := Val;
1159 end case;
1160 end if;
1161 end Set_Dotted_Debug_Flag;
1162
1163 end Debug;