[Ada] Missing debug info for loop entity of an Ada 2012 array iterator loop

Arnaud Charlet charlet@adacore.com
Fri Mar 30 09:19:00 GMT 2012


When the declaration of the loop entity of an Ada-2012-style array iterator
is rewritten as a renaming of the indexed array, debug info was not being
generated for the renaming, preventing display of the entity (gdb generates
a "no definition in current context" message).  The loop entity of such a
renaming is now marked as needing debug info.

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-03-30  Gary Dismukes  <dismukes@adacore.com>

	* exp_ch5.adb (Expand_Iterator_Loop_Over_Array): For the case of a
	loop entity which is rewritten as a renaming
	of the indexed array, explicitly mark the entity as needing
	debug info so that Materialize entity will be set later by
	Debug_Renaming_Declaration when the renaming is expanded.

-------------- next part --------------
Index: exp_ch5.adb
===================================================================
--- exp_ch5.adb	(revision 185995)
+++ exp_ch5.adb	(working copy)
@@ -3303,6 +3303,14 @@
                New_Reference_To (Component_Type (Array_Typ), Loc),
              Name                => Ind_Comp));
 
+         --  Mark the loop variable as needing debug info, so that expansion
+         --  of the renaming will result in Materialize_Entity getting set via
+         --  Debug_Renaming_Declaration. (This setting is needed here because
+         --  the setting in Freeze_Entity comes after the expansion, which is
+         --  too late. ???)
+
+         Set_Debug_Info_Needed (Id);
+
       --  for Index in Array loop
 
       --  This case utilizes the already given iterator name


More information about the Gcc-patches mailing list