@@ -2943,11 +2943,10 @@
-- used to reference tasks implementing such interface.
-- Materialize_Entity (Flag168)
+-- Present in all entities. Set only for renamed obects which should be
+-- materialized for debugging purposes. This means that a memory location
+-- containing the renamed address should be allocated. This is needed so
+-- that the debugger can find the entity.
-- Mechanism (Uint8) (returned as Mechanism_Type)
-- Present in functions and non-generic formal parameters. Indicates
@@ -1082,7 +1082,8 @@
function Debug_Renaming_Declaration (N : Node_Id) return Node_Id;
-- The argument N is a renaming declaration. The result is a variable
-- declaration as described in the above paragraphs. If N is not a special
- -- debug declaration, then Empty is returned.
+ -- debug declaration, then Empty is returned. This function also takes care
+ -- of setting Materialize_Entity on the renamed entity where required.
-- Packed Array Encoding --
@@ -2875,10 +2875,12 @@
-- Now we construct an array object with appropriate bounds. We mark
-- the target as internal to prevent useless initialization when
- -- Initialize_Scalars is enabled.
+ -- Initialize_Scalars is enabled. Also since this is the actual result
+ -- entity, we make sure we have debug information for the result.
Ent := Make_Temporary (Loc, 'S');
+ Set_Needs_Debug_Info (Ent);
-- If the bound is statically known to be out of range, we do not want
-- to abort, we want a warning and a runtime constraint error. Note that
@@ -34,6 +34,7 @@
with Exp_Ch7; use Exp_Ch7;
with Exp_Ch9; use Exp_Ch9;
with Exp_Ch11; use Exp_Ch11;
+with Exp_Dbug; use Exp_Dbug;
with Exp_Disp; use Exp_Disp;
with Exp_Dist; use Exp_Dist;
with Exp_Smem; use Exp_Smem;
@@ -5215,6 +5216,26 @@
Set_Renamed_Object (Defining_Identifier (N), Expr_Q);
+ -- We do need to deal with debug issues for this renaming
+ -- First, if entity comes from source, then mark it as needing
+ -- debug information, even though it is defined by a generated
+ -- renaming that does not come from source.
+ if Comes_From_Source (Defining_Identifier (N)) then
+ Set_Needs_Debug_Info (Defining_Identifier (N));
+ end if;
+ -- Now call the routine to generate debug info for the renaming
+ Decl : constant Node_Id := Debug_Renaming_Declaration (N);
+ if Present (Decl) then
+ Insert_Action (N, Decl);
+ end if;