2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / ada / exp_dbug.ads
blobe8738b3aad56504eb39a09b1627459bd7ea8444e
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- E X P _ D B U G --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1996-2003 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 2, 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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
21 -- --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 -- --
25 ------------------------------------------------------------------------------
27 -- Expand routines for generation of special declarations used by the
28 -- debugger. In accordance with the Dwarf 2.2 specification, certain
29 -- type names are encoded to provide information to the debugger.
31 with Types; use Types;
32 with Uintp; use Uintp;
34 package Exp_Dbug is
36 -----------------------------------------------------
37 -- Encoding and Qualification of Names of Entities --
38 -----------------------------------------------------
40 -- This section describes how the names of entities are encoded in
41 -- the generated debugging information.
43 -- An entity in Ada has a name of the form X.Y.Z ... E where X,Y,Z
44 -- are the enclosing scopes (not including Standard at the start).
46 -- The encoding of the name follows this basic qualified naming scheme,
47 -- where the encoding of individual entity names is as described in
48 -- Namet (i.e. in particular names present in the original source are
49 -- folded to all lower case, with upper half and wide characters encoded
50 -- as described in Namet). Upper case letters are used only for entities
51 -- generated by the compiler.
53 -- There are two cases, global entities, and local entities. In more
54 -- formal terms, local entities are those which have a dynamic enclosing
55 -- scope, and global entities are at the library level, except that we
56 -- always consider procedures to be global entities, even if they are
57 -- nested (that's because at the debugger level a procedure name refers
58 -- to the code, and the code is indeed a global entity, including the
59 -- case of nested procedures.) In addition, we also consider all types
60 -- to be global entities, even if they are defined within a procedure.
62 -- The reason for treating all type names as global entities is that
63 -- a number of our type encodings work by having related type names,
64 -- and we need the full qualification to keep this unique.
66 -- For global entities, the encoded name includes all components of the
67 -- fully expanded name (but omitting Standard at the start). For example,
68 -- if a library level child package P.Q has an embedded package R, and
69 -- there is an entity in this embdded package whose name is S, the encoded
70 -- name will include the components p.q.r.s.
72 -- For local entities, the encoded name only includes the components
73 -- up to the enclosing dynamic scope (other than a block). At run time,
74 -- such a dynamic scope is a subprogram, and the debugging formats know
75 -- about local variables of procedures, so it is not necessary to have
76 -- full qualification for such entities. In particular this means that
77 -- direct local variables of a procedure are not qualified.
79 -- As an example of the local name convention, consider a procedure V.W
80 -- with a local variable X, and a nested block Y containing an entity
81 -- Z. The fully qualified names of the entities X and Z are:
83 -- V.W.X
84 -- V.W.Y.Z
86 -- but since V.W is a subprogram, the encoded names will end up
87 -- encoding only
89 -- x
90 -- y.z
92 -- The separating dots are translated into double underscores.
94 -----------------------------
95 -- Handling of Overloading --
96 -----------------------------
98 -- The above scheme is incomplete with respect to overloaded
99 -- subprograms, since overloading can legitimately result in a
100 -- case of two entities with exactly the same fully qualified names.
101 -- To distinguish between entries in a set of overloaded subprograms,
102 -- the encoded names are serialized by adding one of the suffixes:
104 -- $n (dollar sign)
105 -- __nn (two underscores)
107 -- where nn is a serial number (2 for the second overloaded function,
108 -- 2 for the third, etc.). We use $ if this symbol is allowed, and
109 -- double underscore if it is not. In the remaining examples in this
110 -- section, we use a $ sign, but the $ is replaced by __ throughout
111 -- these examples if $ sign is not available. A suffix of $1 is
112 -- always omitted (i.e. no suffix implies the first instance).
114 -- These names are prefixed by the normal full qualification. So
115 -- for example, the third instance of the subprogram qrs in package
116 -- yz would have the name:
118 -- yz__qrs$3
120 -- A more subtle case arises with entities declared within overloaded
121 -- subprograms. If we have two overloaded subprograms, and both declare
122 -- an entity xyz, then the fully expanded name of the two xyz's is the
123 -- same. To distinguish these, we add the same __n suffix at the end of
124 -- the inner entity names.
126 -- In more complex cases, we can have multiple levels of overloading,
127 -- and we must make sure to distinguish which final declarative region
128 -- we are talking about. For this purpose, we use a more complex suffix
129 -- which has the form:
131 -- $nn_nn_nn ...
133 -- where the nn values are the homonym numbers as needed for any of
134 -- the qualifying entities, separated by a single underscore. If all
135 -- the nn values are 1, the suffix is omitted, Otherwise the suffix
136 -- is present (including any values of 1). The following example
137 -- shows how this suffixing works.
139 -- package body Yz is
140 -- procedure Qrs is -- Name is yz__qrs
141 -- procedure Tuv is ... end; -- Name is yz__qrs__tuv
142 -- begin ... end Qrs;
144 -- procedure Qrs (X: Int) is -- Name is yz__qrs$2
145 -- procedure Tuv is ... end; -- Name is yz__qrs__tuv$2_1
146 -- procedure Tuv (X: Int) is -- Name is yz__qrs__tuv$2_2
147 -- begin ... end Tuv;
149 -- procedure Tuv (X: Float) is -- Name is yz__qrs__tuv$2_3
150 -- type m is new float; -- Name is yz__qrs__tuv__m$2_3
151 -- begin ... end Tuv;
152 -- begin ... end Qrs;
153 -- end Yz;
155 --------------------
156 -- Operator Names --
157 --------------------
159 -- The above rules applied to operator names would result in names
160 -- with quotation marks, which are not typically allowed by assemblers
161 -- and linkers, and even if allowed would be odd and hard to deal with.
162 -- To avoid this problem, operator names are encoded as follows:
164 -- Oabs abs
165 -- Oand and
166 -- Omod mod
167 -- Onot not
168 -- Oor or
169 -- Orem rem
170 -- Oxor xor
171 -- Oeq =
172 -- One /=
173 -- Olt <
174 -- Ole <=
175 -- Ogt >
176 -- Oge >=
177 -- Oadd +
178 -- Osubtract -
179 -- Oconcat &
180 -- Omultiply *
181 -- Odivide /
182 -- Oexpon **
184 -- These names are prefixed by the normal full qualification, and
185 -- suffixed by the overloading identification. So for example, the
186 -- second operator "=" defined in package Extra.Messages would
187 -- have the name:
189 -- extra__messages__Oeq__2
191 ----------------------------------
192 -- Resolving Other Name Clashes --
193 ----------------------------------
195 -- It might be thought that the above scheme is complete, but in Ada 95,
196 -- full qualification is insufficient to uniquely identify an entity
197 -- in the program, even if it is not an overloaded subprogram. There
198 -- are two possible confusions:
200 -- a.b
202 -- interpretation 1: entity b in body of package a
203 -- interpretation 2: child procedure b of package a
205 -- a.b.c
207 -- interpretation 1: entity c in child package a.b
208 -- interpretation 2: entity c in nested package b in body of a
210 -- It is perfectly legal in both cases for both interpretations to
211 -- be valid within a single program. This is a bit of a surprise since
212 -- certainly in Ada 83, full qualification was sufficient, but not in
213 -- Ada 95. The result is that the above scheme can result in duplicate
214 -- names. This would not be so bad if the effect were just restricted
215 -- to debugging information, but in fact in both the above cases, it
216 -- is possible for both symbols to be external names, and so we have
217 -- a real problem of name clashes.
219 -- To deal with this situation, we provide two additional encoding
220 -- rules for names
222 -- First: all library subprogram names are preceded by the string
223 -- _ada_ (which causes no duplications, since normal Ada names can
224 -- never start with an underscore. This not only solves the first
225 -- case of duplication, but also solves another pragmatic problem
226 -- which is that otherwise Ada procedures can generate names that
227 -- clash with existing system function names. Most notably, we can
228 -- have clashes in the case of procedure Main with the C main that
229 -- in some systems is always present.
231 -- Second, for the case where nested packages declared in package
232 -- bodies can cause trouble, we add a suffix which shows which
233 -- entities in the list are body-nested packages, i.e. packages
234 -- whose spec is within a package body. The rules are as follows,
235 -- given a list of names in a qualified name name1.name2....
237 -- If none are body-nested package entities, then there is no suffix
239 -- If at least one is a body-nested package entity, then the suffix
240 -- is X followed by a string of b's and n's (b = body-nested package
241 -- entity, n = not a body-nested package).
243 -- There is one element in this string for each entity in the encoded
244 -- expanded name except the first (the rules are such that the first
245 -- entity of the encoded expanded name can never be a body-nested'
246 -- package. Trailing n's are omitted, as is the last b (there must
247 -- be at least one b, or we would not be generating a suffix at all).
249 -- For example, suppose we have
251 -- package x is
252 -- pragma Elaborate_Body;
253 -- m1 : integer; -- #1
254 -- end x;
256 -- package body x is
257 -- package y is m2 : integer; end y; -- #2
258 -- package body y is
259 -- package z is r : integer; end z; -- #3
260 -- end;
261 -- m3 : integer; -- #4
262 -- end x;
264 -- package x.y is
265 -- pragma Elaborate_Body;
266 -- m2 : integer; -- #5
267 -- end x.y;
269 -- package body x.y is
270 -- m3 : integer; -- #6
271 -- procedure j is -- #7
272 -- package k is
273 -- z : integer; -- #8
274 -- end k;
275 -- begin
276 -- null;
277 -- end j;
278 -- end x.y;
280 -- procedure x.m3 is begin null; end; -- #9
282 -- Then the encodings would be:
284 -- #1. x__m1 (no BNPE's in sight)
285 -- #2. x__y__m2X (y is a BNPE)
286 -- #3. x__y__z__rXb (y is a BNPE, so is z)
287 -- #4. x__m3 (no BNPE's in sight)
288 -- #5. x__y__m2 (no BNPE's in sight)
289 -- #6. x__y__m3 (no BNPE's in signt)
290 -- #7. x__y__j (no BNPE's in sight)
291 -- #8. k__z (no BNPE's, only up to procedure)
292 -- #9 _ada_x__m3 (library level subprogram)
294 -- Note that we have instances here of both kind of potential name
295 -- clashes, and the above examples show how the encodings avoid the
296 -- clash as follows:
298 -- Lines #4 and #9 both refer to the entity x.m3, but #9 is a library
299 -- level subprogram, so it is preceded by the string _ada_ which acts
300 -- to distinguish it from the package body entity.
302 -- Lines #2 and #5 both refer to the entity x.y.m2, but the first
303 -- instance is inside the body-nested package y, so there is an X
304 -- suffix to distinguish it from the child library entity.
306 -- Note that enumeration literals never need Xb type suffixes, since
307 -- they are never referenced using global external names.
309 ---------------------
310 -- Interface Names --
311 ---------------------
313 -- Note: if an interface name is present, then the external name
314 -- is taken from the specified interface name. Given the current
315 -- limitations of the gcc backend, this means that the debugging
316 -- name is also set to the interface name, but conceptually, it
317 -- would be possible (and indeed desirable) to have the debugging
318 -- information still use the Ada name as qualified above, so we
319 -- still fully qualify the name in the front end.
321 -------------------------------------
322 -- Encodings Related to Task Types --
323 -------------------------------------
325 -- Each task object defined by a single task declaration is associated
326 -- with a prefix that is used to qualify procedures defined in that
327 -- task. Given
329 -- package body P is
330 -- task body TaskObj is
331 -- procedure F1 is ... end;
332 -- begin
333 -- B;
334 -- end TaskObj;
335 -- end P;
337 -- The name of subprogram TaskObj.F1 is encoded as p__taskobjTK__f1,
338 -- The body, B, is contained in a subprogram whose name is
339 -- p__taskobjTKB.
341 ------------------------------------------
342 -- Encodings Related to Protected Types --
343 ------------------------------------------
345 -- Each protected type has an associated record type, that describes
346 -- the actual layout of the private data. In addition to the private
347 -- components of the type, the Corresponding_Record_Type includes one
348 -- component of type Protection, which is the actual lock structure.
349 -- The run-time size of the protected type is the size of the corres-
350 -- ponding record.
352 -- For a protected type prot, the Corresponding_Record_Type is encoded
353 -- as protV.
355 -- The operations of a protected type are encoded as follows: each
356 -- operation results in two subprograms, a locking one that is called
357 -- from outside of the object, and a non-locking one that is used for
358 -- calls from other operations on the same object. The locking operation
359 -- simply acquires the lock, and then calls the non-locking version.
360 -- The names of all of these have a prefix constructed from the name of
361 -- the type, the string "PT", and a suffix which is P or N, depending on
362 -- whether this is the protected/non-locking version of the operation.
364 -- Operations generated for protected entries follow the same encoding.
365 -- Each entry results in two suprograms: a procedure that holds the
366 -- entry body, and a function that holds the evaluation of the barrier.
367 -- The names of these subprograms include the prefix 'E' or 'B' res-
368 -- pectively. The names also include a numeric suffix to render them
369 -- unique in the presence of overloaded entries.
371 -- Given the declaration:
373 -- protected type Lock is
374 -- function Get return Integer;
375 -- procedure Set (X: Integer);
376 -- entry Update (Val : Integer);
377 -- private
378 -- Value : Integer := 0;
379 -- end Lock;
381 -- the following operations are created:
383 -- lockPT_getN
384 -- lockPT_getP,
386 -- lockPT_setN
387 -- lockPT_setP
389 -- lockPT_update1sE
390 -- lockPT_udpate2sB
392 ----------------------------------------------------
393 -- Conversion between Entities and External Names --
394 ----------------------------------------------------
396 No_Dollar_In_Label : constant Boolean := True;
397 -- True iff the target does not allow dollar signs ("$") in external names
398 -- ??? We want to migrate all platforms to use the same convention.
399 -- As a first step, we force this constant to always be True. This
400 -- constant will eventually be deleted after we have verified that
401 -- the migration does not cause any unforseen adverse impact.
402 -- We chose "__" because it is supported on all platforms, which is
403 -- not the case of "$".
405 procedure Get_External_Name
406 (Entity : Entity_Id;
407 Has_Suffix : Boolean);
408 -- Set Name_Buffer and Name_Len to the external name of entity E.
409 -- The external name is the Interface_Name, if specified, unless
410 -- the entity has an address clause or a suffix.
412 -- If the Interface is not present, or not used, the external name
413 -- is the concatenation of:
415 -- - the string "_ada_", if the entity is a library subprogram,
416 -- - the names of any enclosing scopes, each followed by "__",
417 -- or "X_" if the next entity is a subunit)
418 -- - the name of the entity
419 -- - the string "$" (or "__" if target does not allow "$"), followed
420 -- by homonym suffix, if the entity is an overloaded subprogram
421 -- or is defined within an overloaded subprogram.
423 procedure Get_External_Name_With_Suffix
424 (Entity : Entity_Id;
425 Suffix : String);
426 -- Set Name_Buffer and Name_Len to the external name of entity E.
427 -- If Suffix is the empty string the external name is as above,
428 -- otherwise the external name is the concatenation of:
430 -- - the string "_ada_", if the entity is a library subprogram,
431 -- - the names of any enclosing scopes, each followed by "__",
432 -- or "X_" if the next entity is a subunit)
433 -- - the name of the entity
434 -- - the string "$" (or "__" if target does not allow "$"), followed
435 -- by homonym suffix, if the entity is an overloaded subprogram
436 -- or is defined within an overloaded subprogram.
437 -- - the string "___" followed by Suffix
439 -- If this procedure is called in the ASIS mode, it does nothing. See the
440 -- comments in the body for more details.
442 --------------------------------------------
443 -- Subprograms for Handling Qualification --
444 --------------------------------------------
446 procedure Qualify_Entity_Names (N : Node_Id);
447 -- Given a node N, that represents a block, subprogram body, or package
448 -- body or spec, or protected or task type, sets a fully qualified name
449 -- for the defining entity of given construct, and also sets fully
450 -- qualified names for all enclosed entities of the construct (using
451 -- First_Entity/Next_Entity). Note that the actual modifications of the
452 -- names is postponed till a subsequent call to Qualify_All_Entity_Names.
453 -- Note: this routine does not deal with prepending _ada_ to library
454 -- subprogram names. The reason for this is that we only prepend _ada_
455 -- to the library entity itself, and not to names built from this name.
457 procedure Qualify_All_Entity_Names;
458 -- When Qualify_Entity_Names is called, no actual name changes are made,
459 -- i.e. the actual calls to Qualify_Entity_Name are deferred until a call
460 -- is made to this procedure. The reason for this deferral is that when
461 -- names are changed semantic processing may be affected. By deferring
462 -- the changes till just before gigi is called, we avoid any concerns
463 -- about such effects. Gigi itself does not use the names except for
464 -- output of names for debugging purposes (which is why we are doing
465 -- the name changes in the first place.
467 -- Note: the routines Get_Unqualified_[Decoded]_Name_String in Namet
468 -- are useful to remove qualification from a name qualified by the
469 -- call to Qualify_All_Entity_Names.
471 --------------------------------
472 -- Handling of Numeric Values --
473 --------------------------------
475 -- All numeric values here are encoded as strings of decimal digits.
476 -- Only integer values need to be encoded. A negative value is encoded
477 -- as the corresponding positive value followed by a lower case m for
478 -- minus to indicate that the value is negative (e.g. 2m for -2).
480 -------------------------
481 -- Type Name Encodings --
482 -------------------------
484 -- In the following typ is the name of the type as normally encoded by
485 -- the debugger rules, i.e. a non-qualified name, all in lower case,
486 -- with standard encoding of upper half and wide characters
488 ------------------------
489 -- Encapsulated Types --
490 ------------------------
492 -- In some cases, the compiler encapsulates a type by wrapping it in
493 -- a structure. For example, this is used when a size or alignment
494 -- specification requires a larger type. Consider:
496 -- type y is mod 2 ** 64;
497 -- for y'size use 256;
499 -- In this case the compile generates a structure type y___PAD, which
500 -- has a single field whose name is F. This single field is 64 bits
501 -- long and contains the actual value.
503 -- A similar encapsulation is done for some packed array types,
504 -- in which case the structure type is y___LJM and the field name
505 -- is OBJECT.
507 -- When the debugger sees an object of a type whose name has a
508 -- suffix not otherwise mentioned in this specification, the type
509 -- is a record containing a single field, and the name of that field
510 -- is all upper-case letters, it should look inside to get the value
511 -- of the field, and neither the outer structure name, nor the
512 -- field name should appear when the value is printed.
514 -----------------------
515 -- Fixed-Point Types --
516 -----------------------
518 -- Fixed-point types are encoded using a suffix that indicates the
519 -- delta and small values. The actual type itself is a normal
520 -- integer type.
522 -- typ___XF_nn_dd
523 -- typ___XF_nn_dd_nn_dd
525 -- The first form is used when small = delta. The value of delta (and
526 -- small) is given by the rational nn/dd, where nn and dd are decimal
527 -- integers.
529 -- The second form is used if the small value is different from the
530 -- delta. In this case, the first nn/dd rational value is for delta,
531 -- and the second value is for small.
533 ------------------------------
534 -- VAX Floating-Point Types --
535 ------------------------------
537 -- Vax floating-point types are represented at run time as integer
538 -- types, which are treated specially by the code generator. Their
539 -- type names are encoded with the following suffix:
541 -- typ___XFF
542 -- typ___XFD
543 -- typ___XFG
545 -- representing the Vax F Float, D Float, and G Float types. The
546 -- debugger must treat these specially. In particular, printing
547 -- these values can be achieved using the debug procedures that
548 -- are provided in package System.Vax_Float_Operations:
550 -- procedure Debug_Output_D (Arg : D);
551 -- procedure Debug_Output_F (Arg : F);
552 -- procedure Debug_Output_G (Arg : G);
554 -- These three procedures take a Vax floating-point argument, and
555 -- output a corresponding decimal representation to standard output
556 -- with no terminating line return.
558 --------------------
559 -- Discrete Types --
560 --------------------
562 -- Discrete types are coded with a suffix indicating the range in
563 -- the case where one or both of the bounds are discriminants or
564 -- variable.
566 -- Note: at the current time, we also encode compile time known
567 -- bounds if they do not match the natural machine type bounds,
568 -- but this may be removed in the future, since it is redundant
569 -- for most debugging formats. However, we do not ever need XD
570 -- encoding for enumeration base types, since here it is always
571 -- clear what the bounds are from the total number of enumeration
572 -- literals, and of course we do not need to encode the dummy XR
573 -- types generated for renamings.
575 -- typ___XD
576 -- typ___XDL_lowerbound
577 -- typ___XDU_upperbound
578 -- typ___XDLU_lowerbound__upperbound
580 -- If a discrete type is a natural machine type (i.e. its bounds
581 -- correspond in a natural manner to its size), then it is left
582 -- unencoded. The above encoding forms are used when there is a
583 -- constrained range that does not correspond to the size or that
584 -- has discriminant references or other compile time known bounds.
586 -- The first form is used if both bounds are dynamic, in which case
587 -- two constant objects are present whose names are typ___L and
588 -- typ___U in the same scope as typ, and the values of these constants
589 -- indicate the bounds. As far as the debugger is concerned, these
590 -- are simply variables that can be accessed like any other variables.
591 -- In the enumeration case, these values correspond to the Enum_Rep
592 -- values for the lower and upper bounds.
594 -- The second form is used if the upper bound is dynamic, but the
595 -- lower bound is either constant or depends on a discriminant of
596 -- the record with which the type is associated. The upper bound
597 -- is stored in a constant object of name typ___U as previously
598 -- described, but the lower bound is encoded directly into the
599 -- name as either a decimal integer, or as the discriminant name.
601 -- The third form is similarly used if the lower bound is dynamic,
602 -- but the upper bound is compile time known or a discriminant
603 -- reference, in which case the lower bound is stored in a constant
604 -- object of name typ___L, and the upper bound is encoded directly
605 -- into the name as either a decimal integer, or as the discriminant
606 -- name.
608 -- The fourth form is used if both bounds are discriminant references
609 -- or compile time known values, with the encoding first for the lower
610 -- bound, then for the upper bound, as previously described.
612 -------------------
613 -- Modular Types --
614 -------------------
616 -- A type declared
618 -- type x is mod N;
620 -- Is encoded as a subrange of an unsigned base type with lower bound
621 -- 0 and upper bound N. That is, there is no name encoding. We use
622 -- the standard encodings provided by the debugging format. Thus
623 -- we give these types a non-standard interpretation: the standard
624 -- interpretation of our encoding would not, in general, imply that
625 -- arithmetic on type x was to be performed modulo N (especially not
626 -- when N is not a power of 2).
628 ------------------
629 -- Biased Types --
630 ------------------
632 -- Only discrete types can be biased, and the fact that they are
633 -- biased is indicated by a suffix of the form:
635 -- typ___XB_lowerbound__upperbound
637 -- Here lowerbound and upperbound are decimal integers, with the
638 -- usual (postfix "m") encoding for negative numbers. Biased
639 -- types are only possible where the bounds are compile time
640 -- known, and the values are represented as unsigned offsets
641 -- from the lower bound given. For example:
643 -- type Q is range 10 .. 15;
644 -- for Q'size use 3;
646 -- The size clause will force values of type Q in memory to be
647 -- stored in biased form (e.g. 11 will be represented by the
648 -- bit pattern 001).
650 ----------------------------------------------
651 -- Record Types with Variable-Length Fields --
652 ----------------------------------------------
654 -- The debugging formats do not fully support these types, and indeed
655 -- some formats simply generate no useful information at all for such
656 -- types. In order to provide information for the debugger, gigi creates
657 -- a parallel type in the same scope with one of the names
659 -- type___XVE
660 -- type___XVU
662 -- The former name is used for a record and the latter for the union
663 -- that is made for a variant record (see below) if that record or
664 -- union has a field of variable size or if the record or union itself
665 -- has a variable size. These encodings suffix any other encodings that
666 -- that might be suffixed to the type name.
668 -- The idea here is to provide all the needed information to interpret
669 -- objects of the original type in the form of a "fixed up" type, which
670 -- is representable using the normal debugging information.
672 -- There are three cases to be dealt with. First, some fields may have
673 -- variable positions because they appear after variable-length fields.
674 -- To deal with this, we encode *all* the field bit positions of the
675 -- special ___XV type in a non-standard manner.
677 -- The idea is to encode not the position, but rather information
678 -- that allows computing the position of a field from the position
679 -- of the previous field. The algorithm for computing the actual
680 -- positions of all fields and the length of the record is as
681 -- follows. In this description, let P represent the current
682 -- bit position in the record.
684 -- 1. Initialize P to 0.
686 -- 2. For each field in the record,
688 -- 2a. If an alignment is given (see below), then round P
689 -- up, if needed, to the next multiple of that alignment.
691 -- 2b. If a bit position is given, then increment P by that
692 -- amount (that is, treat it as an offset from the end of the
693 -- preceding record).
695 -- 2c. Assign P as the actual position of the field.
697 -- 2d. Compute the length, L, of the represented field (see below)
698 -- and compute P'=P+L. Unless the field represents a variant part
699 -- (see below and also Variant Record Encoding), set P to P'.
701 -- The alignment, if present, is encoded in the field name of the
702 -- record, which has a suffix:
704 -- fieldname___XVAnn
706 -- where the nn after the XVA indicates the alignment value in storage
707 -- units. This encoding is present only if an alignment is present.
709 -- The size of the record described by an XVE-encoded type (in bits)
710 -- is generally the maximum value attained by P' in step 2d above,
711 -- rounded up according to the record's alignment.
713 -- Second, the variable-length fields themselves are represented by
714 -- replacing the type by a special access type. The designated type
715 -- of this access type is the original variable-length type, and the
716 -- fact that this field has been transformed in this way is signalled
717 -- by encoding the field name as:
719 -- field___XVL
721 -- where field is the original field name. If a field is both
722 -- variable-length and also needs an alignment encoding, then the
723 -- encodings are combined using:
725 -- field___XVLnn
727 -- Note: the reason that we change the type is so that the resulting
728 -- type has no variable-length fields. At least some of the formats
729 -- used for debugging information simply cannot tolerate variable-
730 -- length fields, so the encoded information would get lost.
732 -- Third, in the case of a variant record, the special union
733 -- that contains the variants is replaced by a normal C union.
734 -- In this case, the positions are all zero.
736 -- Discriminants appear before any variable-length fields that depend
737 -- on them, with one exception. In some cases, a discriminant
738 -- governing the choice of a variant clause may appear in the list
739 -- of fields of an XVE type after the entry for the variant clause
740 -- itself (this can happen in the presence of a representation clause
741 -- for the record type in the source program). However, when this
742 -- happens, the discriminant's position may be determined by first
743 -- applying the rules described in this section, ignoring the variant
744 -- clause. As a result, discriminants can always be located
745 -- independently of the variable-length fields that depend on them.
747 -- The size of the ___XVE or ___XVU record or union is set to the
748 -- alignment (in bytes) of the original object so that the debugger
749 -- can calculate the size of the original type.
751 -- As an example of this encoding, consider the declarations:
753 -- type Q is array (1 .. V1) of Float; -- alignment 4
754 -- type R is array (1 .. V2) of Long_Float; -- alignment 8
756 -- type X is record
757 -- A : Character;
758 -- B : Float;
759 -- C : String (1 .. V3);
760 -- D : Float;
761 -- E : Q;
762 -- F : R;
763 -- G : Float;
764 -- end record;
766 -- The encoded type looks like:
768 -- type anonymousQ is access Q;
769 -- type anonymousR is access R;
771 -- type X___XVE is record
772 -- A : Character; -- position contains 0
773 -- B : Float; -- position contains 24
774 -- C___XVL : access String (1 .. V3); -- position contains 0
775 -- D___XVA4 : Float; -- position contains 0
776 -- E___XVL4 : anonymousQ; -- position contains 0
777 -- F___XVL8 : anonymousR; -- position contains 0
778 -- G : Float; -- position contains 0
779 -- end record;
781 -- Any bit sizes recorded for fields other than dynamic fields and
782 -- variants are honored as for ordinary records.
784 -- Notes:
786 -- 1) The B field could also have been encoded by using a position
787 -- of zero, and an alignment of 4, but in such a case, the coding by
788 -- position is preferred (since it takes up less space). We have used
789 -- the (illegal) notation access xxx as field types in the example
790 -- above.
792 -- 2) The E field does not actually need the alignment indication
793 -- but this may not be detected in this case by the conversion
794 -- routines.
796 -- 3) Our conventions do not cover all XVE-encoded records in which
797 -- some, but not all, fields have representation clauses. Such
798 -- records may, therefore, be displayed incorrectly by debuggers.
799 -- This situation is not common.
801 -----------------------
802 -- Base Record Types --
803 -----------------------
805 -- Under certain circumstances, debuggers need two descriptions
806 -- of a record type, one that gives the actual details of the
807 -- base type's structure (as described elsewhere in these
808 -- comments) and one that may be used to obtain information
809 -- about the particular subtype and the size of the objects
810 -- being typed. In such cases the compiler will substitute a
811 -- type whose name is typically compiler-generated and
812 -- irrelevant except as a key for obtaining the actual type.
813 -- Specifically, if this name is x, then we produce a record
814 -- type named x___XVS consisting of one field. The name of
815 -- this field is that of the actual type being encoded, which
816 -- we'll call y (the type of this single field is arbitrary).
817 -- Both x and y may have corresponding ___XVE types.
819 -- The size of the objects typed as x should be obtained from
820 -- the structure of x (and x___XVE, if applicable) as for
821 -- ordinary types unless there is a variable named x___XVZ, which,
822 -- if present, will hold the the size (in bits) of x.
824 -- The type x will either be a subtype of y (see also Subtypes
825 -- of Variant Records, below) or will contain no fields at
826 -- all. The layout, types, and positions of these fields will
827 -- be accurate, if present. (Currently, however, the GDB
828 -- debugger makes no use of x except to determine its size).
830 -- Among other uses, XVS types are sometimes used to encode
831 -- unconstrained types. For example, given
833 -- subtype Int is INTEGER range 0..10;
834 -- type T1 (N: Int := 0) is record
835 -- F1: String (1 .. N);
836 -- end record;
837 -- type AT1 is array (INTEGER range <>) of T1;
839 -- the element type for AT1 might have a type defined as if it had
840 -- been written:
842 -- type at1___C_PAD is record null; end record;
843 -- for at1___C_PAD'Size use 16 * 8;
845 -- and there would also be
847 -- type at1___C_PAD___XVS is record t1: Integer; end record;
848 -- type t1 is ...
850 -- Had the subtype Int been dynamic:
852 -- subtype Int is INTEGER range 0 .. M; -- M a variable
854 -- Then the compiler would also generate a declaration whose effect
855 -- would be
857 -- at1___C_PAD___XVZ: constant Integer := 32 + M * 8 + padding term;
859 -- Not all unconstrained types are so encoded; the XVS
860 -- convention may be unnecessary for unconstrained types of
861 -- fixed size. However, this encoding is always necessary when
862 -- a subcomponent type (array element's type or record field's
863 -- type) is an unconstrained record type some of whose
864 -- components depend on discriminant values.
866 -----------------
867 -- Array Types --
868 -----------------
870 -- Since there is no way for the debugger to obtain the index subtypes
871 -- for an array type, we produce a type that has the name of the
872 -- array type followed by "___XA" and is a record whose field names
873 -- are the names of the types for the bounds. The types of these
874 -- fields is an integer type which is meaningless.
876 -- To conserve space, we do not produce this type unless one of
877 -- the index types is either an enumeration type, has a variable
878 -- upper bound, has a lower bound different from the constant 1,
879 -- is a biased type, or is wider than "sizetype".
881 -- Given the full encoding of these types (see above description for
882 -- the encoding of discrete types), this means that all necessary
883 -- information for addressing arrays is available. In some
884 -- debugging formats, some or all of the bounds information may
885 -- be available redundantly, particularly in the fixed-point case,
886 -- but this information can in any case be ignored by the debugger.
888 ----------------------------
889 -- Note on Implicit Types --
890 ----------------------------
892 -- The compiler creates implicit type names in many situations where
893 -- a type is present semantically, but no specific name is present.
894 -- For example:
896 -- S : Integer range M .. N;
898 -- Here the subtype of S is not integer, but rather an anonymous
899 -- subtype of Integer. Where possible, the compiler generates names
900 -- for such anonymous types that are related to the type from which
901 -- the subtype is obtained as follows:
903 -- T name suffix
905 -- where name is the name from which the subtype is obtained, using
906 -- lower case letters and underscores, and suffix starts with an upper
907 -- case letter. For example, the name for the above declaration of S
908 -- might be:
910 -- TintegerS4b
912 -- If the debugger is asked to give the type of an entity and the type
913 -- has the form T name suffix, it is probably appropriate to just use
914 -- "name" in the response since this is what is meaningful to the
915 -- programmer.
917 -------------------------------------------------
918 -- Subprograms for Handling Encoded Type Names --
919 -------------------------------------------------
921 procedure Get_Encoded_Name (E : Entity_Id);
922 -- If the entity is a typename, store the external name of
923 -- the entity as in Get_External_Name, followed by three underscores
924 -- plus the type encoding in Name_Buffer with the length in Name_Len,
925 -- and an ASCII.NUL character stored following the name.
926 -- Otherwise set Name_Buffer and Name_Len to hold the entity name.
928 --------------
929 -- Renaming --
930 --------------
932 -- Debugging information is generated for exception, object, package,
933 -- and subprogram renaming (generic renamings are not significant, since
934 -- generic templates are not relevant at debugging time).
936 -- Consider a renaming declaration of the form
938 -- x typ renames y;
940 -- There is one case in which no special debugging information is required,
941 -- namely the case of an object renaming where the backend allocates a
942 -- reference for the renamed variable, and the entity x is this reference.
943 -- The debugger can handle this case without any special processing or
944 -- encoding (it won't know it was a renaming, but that does not matter).
946 -- All other cases of renaming generate a dummy type definition for
947 -- an entity whose name is:
949 -- x___XR for an object renaming
950 -- x___XRE for an exception renaming
951 -- x___XRP for a package renaming
953 -- The name is fully qualified in the usual manner, i.e. qualified in
954 -- the same manner as the entity x would be. In the case of a package
955 -- renaming where x is a child unit, the qualification includes the
956 -- name of the parent unit, to disambiguate child units with the same
957 -- simple name and (of necessity) different parents.
959 -- Note: subprogram renamings are not encoded at the present time.
961 -- The type is an enumeration type with a single enumeration literal
962 -- that is an identifier which describes the renamed variable.
964 -- For the simple entity case, where y is an entity name,
965 -- the enumeration is of the form:
967 -- (y___XE)
969 -- i.e. the enumeration type has a single field, whose name
970 -- matches the name y, with the XE suffix. The entity for this
971 -- enumeration literal is fully qualified in the usual manner.
972 -- All subprogram, exception, and package renamings fall into
973 -- this category, as well as simple object renamings.
975 -- For the object renaming case where y is a selected component or an
976 -- indexed component, the literal name is suffixed by additional fields
977 -- that give details of the components. The name starts as above with
978 -- a y___XE entity indicating the outer level variable. Then a series
979 -- of selections and indexing operations can be specified as follows:
981 -- Indexed component
983 -- A series of subscript values appear in sequence, the number
984 -- corresponds to the number of dimensions of the array. The
985 -- subscripts have one of the following two forms:
987 -- XSnnn
989 -- Here nnn is a constant value, encoded as a decimal
990 -- integer (pos value for enumeration type case). Negative
991 -- values have a trailing 'm' as usual.
993 -- XSe
995 -- Here e is the (unqualified) name of a constant entity in
996 -- the same scope as the renaming which contains the subscript
997 -- value.
999 -- Slice
1001 -- For the slice case, we have two entries. The first is for
1002 -- the lower bound of the slice, and has the form
1004 -- XLnnn
1005 -- XLe
1007 -- Specifies the lower bound, using exactly the same encoding
1008 -- as for an XS subscript as described above.
1010 -- Then the upper bound appears in the usual XSnnn/XSe form
1012 -- Selected component
1014 -- For a selected component, we have a single entry
1016 -- XRf
1018 -- Here f is the field name for the selection
1020 -- For an explicit deference (.all), we have a single entry
1022 -- XA
1024 -- As an example, consider the declarations:
1026 -- package p is
1027 -- type q is record
1028 -- m : string (2 .. 5);
1029 -- end record;
1031 -- type r is array (1 .. 10, 1 .. 20) of q;
1033 -- g : r;
1035 -- z : string renames g (1,5).m(2 ..3)
1036 -- end p;
1038 -- The generated type definition would appear as
1040 -- type p__z___XR is
1041 -- (p__g___XEXS1XS5XRmXL2XS3);
1042 -- p__g___XE--------------------outer entity is g
1043 -- XS1-----------------first subscript for g
1044 -- XS5--------------second subscript for g
1045 -- XRm-----------select field m
1046 -- XL2--------lower bound of slice
1047 -- XS3-----upper bound of slice
1049 function Debug_Renaming_Declaration (N : Node_Id) return Node_Id;
1050 -- The argument N is a renaming declaration. The result is a type
1051 -- declaration as described in the above paragraphs. If not special
1052 -- debug declaration, than Empty is returned.
1054 ---------------------------
1055 -- Packed Array Encoding --
1056 ---------------------------
1058 -- For every packed array, two types are created, and both appear in
1059 -- the debugging output.
1061 -- The original declared array type is a perfectly normal array type,
1062 -- and its index bounds indicate the original bounds of the array.
1064 -- The corresponding packed array type, which may be a modular type, or
1065 -- may be an array of bytes type (see Exp_Pakd for full details). This
1066 -- is the type that is actually used in the generated code and for
1067 -- debugging information for all objects of the packed type.
1069 -- The name of the corresponding packed array type is:
1071 -- ttt___XPnnn
1073 -- where
1074 -- ttt is the name of the original declared array
1075 -- nnn is the component size in bits (1-31)
1077 -- When the debugger sees that an object is of a type that is encoded
1078 -- in this manner, it can use the original type to determine the bounds,
1079 -- and the component size to determine the packing details.
1081 -- Packed arrays are represented in tightly packed form, with no extra
1082 -- bits between components. This is true even when the component size
1083 -- is not a factor of the storage unit size, so that as a result it is
1084 -- possible for components to cross storage unit boundaries.
1086 -- The layout in storage is identical, regardless of whether the
1087 -- implementation type is a modular type or an array-of-bytes type.
1088 -- See Exp_Pakd for details of how these implementation types are used,
1089 -- but for the purpose of the debugger, only the starting address of
1090 -- the object in memory is significant.
1092 -- The following example should show clearly how the packing works in
1093 -- the little-endian and big-endian cases:
1095 -- type B is range 0 .. 7;
1096 -- for B'Size use 3;
1098 -- type BA is array (0 .. 5) of B;
1099 -- pragma Pack (BA);
1101 -- BV : constant BA := (1,2,3,4,5,6);
1103 -- Little endian case
1105 -- BV'Address + 2 BV'Address + 1 BV'Address + 0
1106 -- +-----------------+-----------------+-----------------+
1107 -- | 0 0 0 0 0 0 1 1 | 0 1 0 1 1 0 0 0 | 1 1 0 1 0 0 0 1 |
1108 -- +-----------------+-----------------+-----------------+
1109 -- <---------> <-----> <---> <---> <-----> <---> <--->
1110 -- unused bits BV(5) BV(4) BV(3) BV(2) BV(1) BV(0)
1112 -- Big endian case
1114 -- BV'Address + 0 BV'Address + 1 BV'Address + 2
1115 -- +-----------------+-----------------+-----------------+
1116 -- | 0 0 1 0 1 0 0 1 | 1 1 0 0 1 0 1 1 | 1 0 0 0 0 0 0 0 |
1117 -- +-----------------+-----------------+-----------------+
1118 -- <---> <---> <-----> <---> <---> <-----> <--------->
1119 -- BV(0) BV(1) BV(2) BV(3) BV(4) BV(5) unused bits
1121 ------------------------------------------------------
1122 -- Subprograms for Handling Packed Array Type Names --
1123 ------------------------------------------------------
1125 function Make_Packed_Array_Type_Name
1126 (Typ : Entity_Id;
1127 Csize : Uint)
1128 return Name_Id;
1129 -- This function is used in Exp_Pakd to create the name that is encoded
1130 -- as described above. The entity Typ provides the name ttt, and the
1131 -- value Csize is the component size that provides the nnn value.
1133 --------------------------------------
1134 -- Pointers to Unconstrained Arrays --
1135 --------------------------------------
1137 -- There are two kinds of pointers to arrays. The debugger can tell
1138 -- which format is in use by the form of the type of the pointer.
1140 -- Fat Pointers
1142 -- Fat pointers are represented as a struct with two fields. This
1143 -- struct has two distinguished field names:
1145 -- P_ARRAY is a pointer to the array type. The name of this
1146 -- type is the unconstrained type followed by "___XUA". This
1147 -- array will have bounds which are the discriminants, and
1148 -- hence are unparsable, but will give the number of
1149 -- subscripts and the component type.
1151 -- P_BOUNDS is a pointer to a struct, the name of whose type is the
1152 -- unconstrained array name followed by "___XUB" and which has
1153 -- fields of the form
1155 -- LBn (n a decimal integer) lower bound of n'th dimension
1156 -- UBn (n a decimal integer) upper bound of n'th dimension
1158 -- The bounds may be any integral type. In the case of an
1159 -- enumeration type, Enum_Rep values are used.
1161 -- The debugging information will sometimes reference an anonymous
1162 -- fat pointer type. Such types are given the name xxx___XUP, where
1163 -- xxx is the name of the designated type. If the debugger is asked
1164 -- to output such a type name, the appropriate form is "access xxx".
1166 -- Thin Pointers
1168 -- The value of a thin pointer is a pointer to the second field
1169 -- of a structure with two fields. The name of this structure's
1170 -- type is "arr___XUT", where "arr" is the name of the
1171 -- unconstrained array type. Even though it actually points into
1172 -- middle of this structure, the thin pointer's type in debugging
1173 -- information is pointer-to-arr___XUT.
1175 -- The first field of arr___XUT is named BOUNDS, and has a type
1176 -- named arr___XUB, with the structure described for such types
1177 -- in fat pointers, as described above.
1179 -- The second field of arr___XUT is named ARRAY, and contains
1180 -- the actual array. Because this array has a dynamic size,
1181 -- determined by the BOUNDS field that precedes it, all of the
1182 -- information about arr___XUT is encoded in a parallel type named
1183 -- arr___XUT___XVE, with fields BOUNDS and ARRAY___XVL. As for
1184 -- previously described ___XVE types, ARRAY___XVL has
1185 -- a pointer-to-array type. However, the array type in this case
1186 -- is named arr___XUA and only its element type is meaningful,
1187 -- just as described for fat pointers.
1189 --------------------------------------
1190 -- Tagged Types and Type Extensions --
1191 --------------------------------------
1193 -- A type C derived from a tagged type P has a field named "_parent"
1194 -- of type P that contains its inherited fields. The type of this
1195 -- field is usually P (encoded as usual if it has a dynamic size),
1196 -- but may be a more distant ancestor, if P is a null extension of
1197 -- that type.
1199 -- The type tag of a tagged type is a field named _tag, of type void*.
1200 -- If the type is derived from another tagged type, its _tag field is
1201 -- found in its _parent field.
1203 -----------------------------
1204 -- Variant Record Encoding --
1205 -----------------------------
1207 -- The variant part of a variant record is encoded as a single field
1208 -- in the enclosing record, whose name is:
1210 -- discrim___XVN
1212 -- where discrim is the unqualified name of the variant. This field name
1213 -- is built by gigi (not by code in this unit). In the case of an
1214 -- Unchecked_Union record, this discriminant will not appear in the
1215 -- record, and the debugger must proceed accordingly (basically it
1216 -- can treat this case as it would a C union).
1218 -- The type corresponding to this field has a name that is obtained
1219 -- by concatenating the type name with the above string and is similar
1220 -- to a C union, in which each member of the union corresponds to one
1221 -- variant. However, unlike a C union, the size of the type may be
1222 -- variable even if each of the components are fixed size, since it
1223 -- includes a computation of which variant is present. In that case,
1224 -- it will be encoded as above and a type with the suffix "___XVN___XVU"
1225 -- will be present.
1227 -- The name of the union member is encoded to indicate the choices, and
1228 -- is a string given by the following grammar:
1230 -- union_name ::= {choice} | others_choice
1231 -- choice ::= simple_choice | range_choice
1232 -- simple_choice ::= S number
1233 -- range_choice ::= R number T number
1234 -- number ::= {decimal_digit} [m]
1235 -- others_choice ::= O (upper case letter O)
1237 -- The m in a number indicates a negative value. As an example of this
1238 -- encoding scheme, the choice 1 .. 4 | 7 | -10 would be represented by
1240 -- R1T4S7S10m
1242 -- In the case of enumeration values, the values used are the
1243 -- actual representation values in the case where an enumeration type
1244 -- has an enumeration representation spec (i.e. they are values that
1245 -- correspond to the use of the Enum_Rep attribute).
1247 -- The type of the inner record is given by the name of the union
1248 -- type (as above) concatenated with the above string. Since that
1249 -- type may itself be variable-sized, it may also be encoded as above
1250 -- with a new type with a further suffix of "___XVU".
1252 -- As an example, consider:
1254 -- type Var (Disc : Boolean := True) is record
1255 -- M : Integer;
1257 -- case Disc is
1258 -- when True =>
1259 -- R : Integer;
1260 -- S : Integer;
1262 -- when False =>
1263 -- T : Integer;
1264 -- end case;
1265 -- end record;
1267 -- V1 : Var;
1269 -- In this case, the type var is represented as a struct with three
1270 -- fields, the first two are "disc" and "m", representing the values
1271 -- of these record components.
1273 -- The third field is a union of two types, with field names S1 and O.
1274 -- S1 is a struct with fields "r" and "s", and O is a struct with
1275 -- fields "t".
1277 ------------------------------------------------
1278 -- Subprograms for Handling Variant Encodings --
1279 ------------------------------------------------
1281 procedure Get_Variant_Encoding (V : Node_Id);
1282 -- This procedure is called by Gigi with V being the variant node.
1283 -- The corresponding encoding string is returned in Name_Buffer with
1284 -- the length of the string in Name_Len, and an ASCII.NUL character
1285 -- stored following the name.
1287 ---------------------------------
1288 -- Subtypes of Variant Records --
1289 ---------------------------------
1291 -- A subtype of a variant record is represented by a type in which the
1292 -- union field from the base type is replaced by one of the possible
1293 -- values. For example, if we have:
1295 -- type Var (Disc : Boolean := True) is record
1296 -- M : Integer;
1298 -- case Disc is
1299 -- when True =>
1300 -- R : Integer;
1301 -- S : Integer;
1303 -- when False =>
1304 -- T : Integer;
1305 -- end case;
1307 -- end record;
1308 -- V1 : Var;
1309 -- V2 : Var (True);
1310 -- V3 : Var (False);
1312 -- Here V2 for example is represented with a subtype whose name is
1313 -- something like TvarS3b, which is a struct with three fields. The
1314 -- first two fields are "disc" and "m" as for the base type, and
1315 -- the third field is S1, which contains the fields "r" and "s".
1317 -- The debugger should simply ignore structs with names of the form
1318 -- corresponding to variants, and consider the fields inside as
1319 -- belonging to the containing record.
1321 -------------------------------------------
1322 -- Character literals in Character Types --
1323 -------------------------------------------
1325 -- Character types are enumeration types at least one of whose
1326 -- enumeration literals is a character literal. Enumeration literals
1327 -- are usually simply represented using their identifier names. In
1328 -- the case where an enumeration literal is a character literal, the
1329 -- name aencoded as described in the following paragraph.
1331 -- A name QUhh, where each 'h' is a lower-case hexadecimal digit,
1332 -- stands for a character whose Unicode encoding is hh, and
1333 -- QWhhhh likewise stands for a wide character whose encoding
1334 -- is hhhh. The representation values are encoded as for ordinary
1335 -- enumeration literals (and have no necessary relationship to the
1336 -- values encoded in the names).
1338 -- For example, given the type declaration
1340 -- type x is (A, 'C', B);
1342 -- the second enumeration literal would be named QU43 and the
1343 -- value assigned to it would be 1.
1345 ----------------------------
1346 -- Effect of Optimization --
1347 ----------------------------
1349 -- If the program is compiled with optimization on (e.g. -O1 switch
1350 -- specified), then there may be variations in the output from the
1351 -- above specification. In particular, objects may disappear from
1352 -- the output. This includes not only constants and variables that
1353 -- the program declares at the source level, but also the x___L and
1354 -- x___U constants created to describe the lower and upper bounds of
1355 -- subtypes with dynamic bounds. This means for example, that array
1356 -- bounds may disappear if optimization is turned on. The debugger
1357 -- is expected to recognize that these constants are missing and
1358 -- deal as best as it can with the limited information available.
1360 end Exp_Dbug;