Object_Definition   =>
                New_Occurrence_Of (RTE (RE_Finalization_Master), Loc)));
 
+         if Debug_Generated_Code then
+            Set_Debug_Info_Needed (Fin_Mas_Id);
+         end if;
+
          --  Set the associated pool and primitive Finalize_Address of the new
          --  finalization master.
 
 
             Set_Etype (Counter_Id, Counter_Typ);
 
+            if Debug_Generated_Code then
+               Set_Debug_Info_Needed (Counter_Id);
+            end if;
+
             --  The counter and its type are inserted before the source
             --  declarations of N.
 
             --  exactly twice (once on the normal path, and once for
             --  exceptions/abort), so this won't bloat the code too much.
 
-            Set_Is_Inlined  (Fin_Id);
+            Set_Is_Inlined (Fin_Id);
+         end if;
+
+         if Debug_Generated_Code then
+            Set_Debug_Info_Needed (Fin_Id);
          end if;
 
          --  Step 2: Creation of the finalizer specification
 
          Body_Id := Make_Defining_Identifier (Loc, Chars (Fin_Id));
 
+         if Debug_Generated_Code then
+            Set_Debug_Info_Needed (Body_Id);
+         end if;
+
          if For_Package then
             Set_Has_Qualified_Name       (Body_Id);
             Set_Has_Fully_Qualified_Name (Body_Id);
             Set_Finalization_Master     (Ptr_Typ, Fin_Mas_Id);
             Set_Associated_Storage_Pool (Ptr_Typ, Pool_Id);
 
+            if Debug_Generated_Code then
+               Set_Debug_Info_Needed (Pool_Id);
+            end if;
+
             --  Create an explicit free statement. Note that the free uses the
             --  caller's pool expressed as a renaming.
 
           Defining_Identifier => Data.Raised_Id,
           Object_Definition   => New_Occurrence_Of (Standard_Boolean, Loc),
           Expression          => New_Occurrence_Of (Standard_False, Loc)));
+
+      if Debug_Generated_Code then
+         Set_Debug_Info_Needed (Data.Raised_Id);
+      end if;
    end Build_Object_Declarations;
 
    ---------------------------
                  Make_Handled_Sequence_Of_Statements (Loc,
                    Statements => New_List (Init_Loop)));
 
+            if Debug_Generated_Code then
+               Set_Debug_Info_Needed (Counter_Id);
+            end if;
+
          --  Otherwise previous errors or a missing full view may prevent the
          --  proper freezing of the component type. If this is the case, there
          --  is no [Deep_]Initialize primitive to call.
               Expression => Expr),
           Par    => Parent (N))));
 
+      if Debug_Generated_Code then
+         Set_Debug_Info_Needed (Temp);
+      end if;
+
       Rewrite (N, New_Occurrence_Of (Temp, Loc));
       Analyze_And_Resolve (N, Typ);
    end Wrap_Transient_Expression;