1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- As a special exception, if other files instantiate generics from this --
25 -- unit, or you link this unit with other files to produce an executable, --
26 -- this unit does not by itself cause the resulting executable to be --
27 -- covered by the GNU General Public License. This exception does not --
28 -- however invalidate any other reasons why the executable file might be --
29 -- covered by the GNU Public License. --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
34 ------------------------------------------------------------------------------
38 ---------------------------------
39 -- Summary of Debug Flag Usage --
40 ---------------------------------
42 -- Debug flags for compiler (GNAT1 and GNATF)
44 -- da Generate messages tracking semantic analyzer progress
45 -- db Show encoding of type names for debug output
46 -- dc List names of units as they are compiled
47 -- dd Dynamic allocation of tables messages generated
48 -- de List the entity table
49 -- df Full tree/source print (includes withed units)
50 -- dg Print source from tree (generated code only)
51 -- dh Generate listing showing loading of name table hash chains
52 -- di Generate messages for visibility linking/delinking
53 -- dj Suppress "junk null check" for access parameter values
54 -- dk Generate GNATBUG message on abort, even if previous errors
55 -- dl Generate unit load trace messages
56 -- dm Allow VMS features even if not OpenVMS version
57 -- dn Generate messages for node/list allocation
58 -- do Print source from tree (original code only)
59 -- dp Generate messages for parser scope stack push/pops
61 -- dr Generate parser resynchronization messages
62 -- ds Print source from tree (including original and generated stuff)
64 -- du Uncheck categorization pragmas
65 -- dv Output trace of overload resolution
66 -- dw Print trace of semantic scope stack
67 -- dx Force expansion on, even if no code being generated
68 -- dy Print tree of package Standard
69 -- dz Print source of package Standard
71 -- dA All entities included in representation information output
72 -- dB Output debug encoding of type names and variants
74 -- dD Delete elaboration checks in inner level routines
75 -- dE Apply elaboration checks to predefined units
76 -- dF Front end data layout enabled.
77 -- dG Generate input showing file creating info for debug file
78 -- dH Hold (kill) call to gigi
79 -- dI Inhibit internal name numbering in gnatG listing
80 -- dJ Output debugging trace info for JGNAT (Java VM version of GNAT)
81 -- dK Kill all error messages
82 -- dL Output trace information on elaboration checking
84 -- dN Do not generate file/line exception messages
85 -- dO Output immediate error messages
86 -- dP Do not check for controlled objects in preelaborable packages
88 -- dR Bypass check for correct version of s-rpc
89 -- dS Never convert numbers to machine numbers in Sem_Eval
90 -- dT Convert to machine numbers only for constant declarations
91 -- dU Enable garbage collection of unreachable entities
92 -- dV Enable viewing of all symbols in debugger
94 -- dX Enable Frontend ZCX even when it is not supported
98 -- d1 Error msgs have node numbers where possible
99 -- d2 Eliminate error flags in verbose form error messages
100 -- d3 Dump bad node in Comperr on an abort
101 -- d4 Inhibit automatic krunch of predefined library unit files
102 -- d5 Debug output for tree read/write
103 -- d6 Default access unconstrained to thin pointers
104 -- d7 Do not output version & file time stamp in -gnatv or -gnatl mode
105 -- d8 Force opposite endianness in packed stuff
108 -- Debug flags for binder (GNATBIND)
112 -- dc List units as they are chosen
114 -- de Elaboration dependencies including system units
123 -- dn List details of manipulation of Num_Pred values
127 -- dr List additional restrictions that may be specified
130 -- du List units as they are acquired
147 -- Debug flags used in package Make and its clients (e.g. GNATMAKE)
164 -- dp Prints the contents of the Q used by Make.Compile_Sources
165 -- dq Prints source files as they are enqueued and dequeued
171 -- dw Prints the list of units withed by the unit currently explored
186 --------------------------------------------
187 -- Documentation for Compiler Debug Flags --
188 --------------------------------------------
190 -- da Generate messages tracking semantic analyzer progress. A message
191 -- is output showing each node as it gets analyzed, expanded,
192 -- resolved, or evaluated. This option is useful for finding out
193 -- exactly where a bomb during semantic analysis is occurring.
195 -- db In Exp_Dbug, certain type names are encoded to include debugging
196 -- information. This debug switch causes lines to be output showing
197 -- the encodings used.
199 -- dc List names of units as they are compiled. One line of output will
200 -- be generated at the start of compiling each unit (package or
203 -- dd Dynamic allocation of tables messages generated. Each time a
204 -- table is reallocated, a line is output indicating the expansion.
206 -- dD Delete new elaboration checks. This flag causes GNAT to return
207 -- to the 3.13a elaboration semantics, and to suppress the fixing
208 -- of two bugs. The first is in the context of inner routines in
209 -- dynamic elaboration mode, when the subprogram we are in was
210 -- called at elaboration time by a unit that was also compiled with
211 -- dynamic elaboration checks. In this case, if A calls B calls C,
212 -- and all are in different units, we need an elaboration check at
213 -- each call. These nested checks were only put in recently (see
214 -- version 1.80 of Sem_Elab) and we provide this debug flag to
215 -- revert to the previous behavior in case of regressions. The
216 -- other behavior reverted by this flag is the treatment of the
217 -- Elaborate_Body pragma in static elaboration mode. This used to
218 -- be treated as not needing elaboration checking, but in fact in
219 -- general Elaborate_All is still required because of nested calls.
221 -- de List the entity table
223 -- df Full tree/source print (includes withed units). Normally the tree
224 -- output (dt) or recreated source output (dg,do,ds) includes only
225 -- the main unit. If df is set, then the output in either case
226 -- includes all compiled units (see also dg,do,ds,dt). Note that to
227 -- be effective, this swich must be used in combination with one or
228 -- more of dt, dg, do or ds.
230 -- dF Front end data layout enabled. Normally front end data layout
231 -- is only enabled if the target parameter Backend_Layout is False.
232 -- This debugging switch enables it unconditionally.
234 -- dg Print the source recreated from the generated tree. In the case
235 -- where the tree has been rewritten this output includes only the
236 -- generated code, not the original code (see also df,do,ds,dz).
237 -- This flag differs from -gnatG in that the output also includes
238 -- non-source generated null statements, and freeze nodes, which
239 -- are normally omitted in -gnatG mode.
241 -- dG Print trace information showing calls to Create_Debug_Source and
242 -- Write_Debug_Line. Used for debugging -gnatD operation problems.
244 -- dh Generates a table at the end of a compilation showing how the hash
245 -- table chains built by the Namet package are loaded. This is useful
246 -- in ensuring that the hashing algorithm (in Namet.Hash) is working
247 -- effectively with typical sets of program identifiers.
249 -- dH Inhibit call to gigi. This is useful for testing front end data
250 -- layout, and may be useful in other debugging situations where
251 -- you do not want gigi to intefere with the testing.
253 -- di Generate messages for visibility linking/delinking
255 -- dj Suppress "junk null check" for access parameters. This flag permits
256 -- Ada programs to pass null parameters to access parameters, and to
257 -- explicitly check such access values against the null literal.
258 -- Neither of these is valid Ada, but both were allowed in versions of
259 -- GNAT before 3.10, so this switch can ease the transition process.
261 -- dJ Generate debugging trace output for the JGNAT back end. This
262 -- consists of symbolic Java Byte Code sequences for all generated
263 -- classes plus additional information to indicate local variables
266 -- dk Immediate kill on abort. Normally on an abort (i.e. a call to
267 -- Comperr.Compiler_Abort), the GNATBUG message is not given if
268 -- there is a previous error. This debug switch bypasses this test
269 -- and gives the message unconditionally (useful for debugging).
271 -- dK Kill all error messages. This debug flag suppresses the output
272 -- of all error messages. It is used in regression tests where the
273 -- error messages are target dependent and irrelevant.
275 -- dl Generate unit load trace messages. A line of traceback output is
276 -- generated each time a request is made to the library manager to
279 -- dm Some features are permitted only in OpenVMS ports of GNAT (e.g.
280 -- the specification of passing by descriptor). Normally any use
281 -- of these features will be flagged as an error, but this debug
282 -- flag allows acceptance of these features in non OpenVMS ports.
283 -- Of course they may not have any useful effect, and in particular
284 -- attempting to generate code with this flag set may blow up.
285 -- The flag also forces the use of 64-bits for Long_Integer.
287 -- dn Generate messages for node/list allocation. Each time a node or
288 -- list header is allocated, a line of output is generated. Certain
289 -- other basic tree operations also cause a line of output to be
290 -- generated. This option is useful in seeing where the parser is
293 -- dN Do not generate file/line exception messages. Normally we do the
294 -- explicit generation of these messages, but since these can only
295 -- be disabled using pragma Discard_Names, this switch may be useful.
297 -- do Print the source recreated from the generated tree. In the case
298 -- where the tree has been rewritten, this output includes only the
299 -- original code, not the generated code (see also df,dg,ds,dz).
301 -- dp Generate messages for parser scope stack push/pops. A line of
302 -- output by the parser each time the parser scope stack is either
303 -- pushed or popped. Useful in debugging situations where the
304 -- parser scope stack ends up incorrectly synchronized
306 -- dr Generate parser resynchronization messages. Normally the parser
307 -- resynchronizes quietly. With this debug option, two messages
308 -- are generated, one when the parser starts a resynchronization
309 -- skip, and another when it resumes parsing. Useful in debugging
310 -- inadequate error recovery situations.
312 -- ds Print the source recreated from the generated tree. In the case
313 -- where the tree has been rewritten this output includes both the
314 -- generated code and the original code with the generated code
315 -- being enlosed in curly brackets (see also df,do,ds,dz)
317 -- dt Print full tree. The generated tree is output (see also df,dy)
319 -- du Uncheck categorization pragmas. This debug switch causes the
320 -- categorization pragmas (Pure, Preelaborate etc) to be ignored
321 -- so that normal checks are not made (this is particularly useful
322 -- for adding temporary debugging code to units that have pragmas
323 -- that are inconsistent with the debugging code added.
325 -- dw Write semantic scope stack messages. Each time a scope is created
326 -- or removed, a message is output (see the Sem_Ch8.New_Scope and
327 -- Sem_Ch8.Pop_Scope subprograms).
329 -- dx Force expansion on, even if no code being generated. Normally the
330 -- expander is inhibited if no code is generated. This switch forces
331 -- expansion to proceed normally even if the backend is not being
332 -- called. This is particularly useful for debugging purposes when
333 -- using the front-end only version of the compiler (which normally
334 -- would never do any expansion).
336 -- dy Print tree of package Standard. Normally the tree print out does
337 -- not include package Standard, even if the -df switch is set. This
338 -- switch forces output of the internal tree built for Standard.
340 -- dz Print source of package Standard. Normally the source print out
341 -- does not include package Standard, even if the -df switch is set.
342 -- This switch forces output of the source recreated from the internal
343 -- tree built for Standard.
345 -- dA Forces output of representation information, including full
346 -- information for all internal type and object entities, as well
347 -- as all user defined type and object entities.
349 -- dB Output debug encodings for types and variants. See Exp_Dbug for
350 -- exact form of the generated output.
352 -- dE Apply compile time elaboration checking for with relations between
353 -- predefined units. Normally no checks are made (it seems that at
354 -- least on the SGI, such checks run into trouble).
356 -- dI Inhibit internal name numbering in gnatDG listing. For internal
357 -- names of the form <uppercase-letters><digits><suffix>, the output
358 -- will be modified to <uppercase-letters>...<suffix>. This is used
359 -- in the fixed bugs run to minimize system and version dependency
360 -- in filed -gnatDG output.
362 -- dL Output trace information on elaboration checking. This debug
363 -- switch causes output to be generated showing each call or
364 -- instantiation as it is checked, and the progress of the recursive
365 -- trace through calls at elaboration time.
367 -- dO Output immediate error messages. This causes error messages to
368 -- be output as soon as they are generated (disconnecting several
369 -- circuits for improvement of messages, deletion of duplicate
370 -- messages etc). Useful to diagnose compiler bombs caused by
371 -- erroneous handling of error situations
373 -- dP Do not check for controlled objects in preelaborable packages.
374 -- RM 10.2.1(9) forbids the use of library level controlled objects
375 -- in preelaborable packages, but this restriction is a huge pain,
376 -- especially in the predefined library units.
378 -- dR Bypass the check for a proper version of s-rpc being present
379 -- to use the -gnatz? switch. This allows debugging of the use
380 -- of stubs generation without needing to have GLADE (or some
381 -- other PCS installed).
383 -- dS Omit conversion of fpt numbers to exact machine numbers in
384 -- non-static evaluation contexts (see Check_Non_Static_Context).
385 -- This is intended for testing out timing problems with this
386 -- conversion circuit.
388 -- dT Similar to dS, but omits the conversions only in the case where
389 -- the parent is not a constant declaration.
391 -- dU Enable garbage collection of unreachable entities. This enables
392 -- both the reachability analysis and changing the Is_Public and
393 -- Is_Eliminated flags.
395 -- dV Enable viewing of all symbols in debugger. Causes debug information
396 -- to be generated for all symbols, including internal symbols. This
397 -- is enabled by default for -gnatD, but this switch allows this to
398 -- be enabled without generating modified source files. Note that the
399 -- use of -gnatdV ensures in the dwarf/elf case that all symbols that
400 -- are present in the elf tables are also in the dwarf tables (which
401 -- seems to be required by some tools).
403 -- dX Enable frontend ZCX even when it is not supported. Equivalent to
404 -- -gnatZ but without verifying that System.Front_End_ZCX_Support
405 -- is set. This causes the front end to generate suitable tables
406 -- for ZCX handling even when the runtime cannot handle ZCX. This
407 -- is used for testing the front end for correct ZCX operation, and
408 -- in particular is useful for multi-target testing.
410 -- d1 Error msgs have node numbers where possible. Normally error
411 -- messages have only source locations. This option is useful when
412 -- debugging errors caused by expanded code, where the source location
413 -- does not give enough information.
415 -- d2 Suppress output of the error position flags for verbose form error
416 -- messages. The messages are still interspersed in the listing, but
417 -- without any error flags or extra blank lines. Also causes an extra
418 -- <<< to be output at the right margin. This is intended to be the
419 -- easiest format for checking conformance of ACVC B tests.
421 -- d3 Causes Comperr to dump the contents of the node for which an abort
422 -- was detected (normally only the Node_Id of the node is output).
424 -- d4 Inhibits automatic krunching of predefined library unit file names.
425 -- Normally, as described in the spec of package Krunch, such files
426 -- are automatically krunched to 8 characters, with special treatment
427 -- of the prefixes Ada, System, and Interfaces. Setting this debug
428 -- switch disables this special treatment.
430 -- d6 Normally access-to-unconstrained-array types are represented
431 -- using fat (double) pointers. Using this debug flag causes them
432 -- to default to thin. This can be used to test the performance
433 -- implications of using thin pointers, and also to test that the
434 -- compiler functions correctly with this choice.
436 -- d7 Normally a -gnatl or -gnatv listing includes the time stamp
437 -- of the source file. This debug flag suppresses this output,
438 -- and also suppresses the message with the version number.
439 -- This is useful in certain regression tests.
441 -- d8 This forces the packed stuff to generate code assuming the
442 -- opposite endianness from the actual correct value. Useful in
443 -- testing out code generation from the packed routines.
445 ------------------------------------------
446 -- Documentation for Binder Debug Flags --
447 ------------------------------------------
449 -- dc List units as they are chosen. As units are selected for addition to
450 -- the elaboration order, a line of output is generated showing which
451 -- unit has been selected.
453 -- de Similar to the effect of -e (output complete list of elaboration
454 -- dependencies) except that internal units are included in the
457 -- dn List details of manipulation of Num_Pred values during execution of
458 -- the algorithm used to determine a correct order of elaboration. This
459 -- is useful in diagnosing any problems in its behavior.
461 -- dr List restrictions which have not been specified, but could have
462 -- been without causing bind errors.
464 -- du List unit name and file name for each unit as it is read in
466 ------------------------------------------------------------
467 -- Documentation for the Debug Flags used in package Make --
468 ------------------------------------------------------------
470 -- Please note that such flags apply to all of Make clients,
473 -- dp Prints the Q used by routine Make.Compile_Sources every time
474 -- we go around the main compile loop of Make.Compile_Sources
476 -- dq Prints source files as they are enqueued and dequeued in the Q
477 -- used by routine Make.Compile_Sources. Useful to figure out the
478 -- order in which sources are recompiled.
480 -- dw Prints the list of units withed by the unit currently explored
481 -- during the main loop of Make.Compile_Sources.
483 ----------------------
484 -- Get_Debug_Flag_K --
485 ----------------------
487 function Get_Debug_Flag_K
return Boolean is
490 end Get_Debug_Flag_K
;
496 procedure Set_Debug_Flag
(C
: Character; Val
: Boolean := True) is
497 subtype Dig
is Character range '1' .. '9';
498 subtype LLet
is Character range 'a' .. 'z';
499 subtype ULet
is Character range 'A' .. 'Z';
504 when '1' => Debug_Flag_1
:= Val
;
505 when '2' => Debug_Flag_2
:= Val
;
506 when '3' => Debug_Flag_3
:= Val
;
507 when '4' => Debug_Flag_4
:= Val
;
508 when '5' => Debug_Flag_5
:= Val
;
509 when '6' => Debug_Flag_6
:= Val
;
510 when '7' => Debug_Flag_7
:= Val
;
511 when '8' => Debug_Flag_8
:= Val
;
512 when '9' => Debug_Flag_9
:= Val
;
517 when 'A' => Debug_Flag_AA
:= Val
;
518 when 'B' => Debug_Flag_BB
:= Val
;
519 when 'C' => Debug_Flag_CC
:= Val
;
520 when 'D' => Debug_Flag_DD
:= Val
;
521 when 'E' => Debug_Flag_EE
:= Val
;
522 when 'F' => Debug_Flag_FF
:= Val
;
523 when 'G' => Debug_Flag_GG
:= Val
;
524 when 'H' => Debug_Flag_HH
:= Val
;
525 when 'I' => Debug_Flag_II
:= Val
;
526 when 'J' => Debug_Flag_JJ
:= Val
;
527 when 'K' => Debug_Flag_KK
:= Val
;
528 when 'L' => Debug_Flag_LL
:= Val
;
529 when 'M' => Debug_Flag_MM
:= Val
;
530 when 'N' => Debug_Flag_NN
:= Val
;
531 when 'O' => Debug_Flag_OO
:= Val
;
532 when 'P' => Debug_Flag_PP
:= Val
;
533 when 'Q' => Debug_Flag_QQ
:= Val
;
534 when 'R' => Debug_Flag_RR
:= Val
;
535 when 'S' => Debug_Flag_SS
:= Val
;
536 when 'T' => Debug_Flag_TT
:= Val
;
537 when 'U' => Debug_Flag_UU
:= Val
;
538 when 'V' => Debug_Flag_VV
:= Val
;
539 when 'W' => Debug_Flag_WW
:= Val
;
540 when 'X' => Debug_Flag_XX
:= Val
;
541 when 'Y' => Debug_Flag_YY
:= Val
;
542 when 'Z' => Debug_Flag_ZZ
:= Val
;
547 when 'a' => Debug_Flag_A
:= Val
;
548 when 'b' => Debug_Flag_B
:= Val
;
549 when 'c' => Debug_Flag_C
:= Val
;
550 when 'd' => Debug_Flag_D
:= Val
;
551 when 'e' => Debug_Flag_E
:= Val
;
552 when 'f' => Debug_Flag_F
:= Val
;
553 when 'g' => Debug_Flag_G
:= Val
;
554 when 'h' => Debug_Flag_H
:= Val
;
555 when 'i' => Debug_Flag_I
:= Val
;
556 when 'j' => Debug_Flag_J
:= Val
;
557 when 'k' => Debug_Flag_K
:= Val
;
558 when 'l' => Debug_Flag_L
:= Val
;
559 when 'm' => Debug_Flag_M
:= Val
;
560 when 'n' => Debug_Flag_N
:= Val
;
561 when 'o' => Debug_Flag_O
:= Val
;
562 when 'p' => Debug_Flag_P
:= Val
;
563 when 'q' => Debug_Flag_Q
:= Val
;
564 when 'r' => Debug_Flag_R
:= Val
;
565 when 's' => Debug_Flag_S
:= Val
;
566 when 't' => Debug_Flag_T
:= Val
;
567 when 'u' => Debug_Flag_U
:= Val
;
568 when 'v' => Debug_Flag_V
:= Val
;
569 when 'w' => Debug_Flag_W
:= Val
;
570 when 'x' => Debug_Flag_X
:= Val
;
571 when 'y' => Debug_Flag_Y
:= Val
;
572 when 'z' => Debug_Flag_Z
:= Val
;