Patchwork [Ada] Missing debug info for object of class-wide interface type

login
register
mail settings
Submitter Arnaud Charlet
Date March 19, 2012, 4:29 p.m.
Message ID <20120319162935.GA18016@adacore.com>
Download mbox | patch
Permalink /patch/147575/
State New
Headers show

Comments

Arnaud Charlet - March 19, 2012, 4:29 p.m.
For an object of a class-wide interface type, the object declaration is
rewritten as a renaming with a new entity, and debug info was not being
generated for the renaming, preventing printing of the object's value
in gdb. The entity of the renaming is now marked as needing debug info.

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

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

	* exp_ch3.adb (Expand_N_Object_Declaration): In
	the case of an object of a class-wide interface type, where the
	declaration is rewritten as a renaming, call Set_Debug_Info_Needed
	on the renaming entity so that Materialize_Entity will be
	set. Also, change existing call (for other than interface cases)
	to call Set_Debug_Info_Needed rather than Set_Needs_Debug_Info
	(as specified for that flag).

Patch

Index: exp_ch3.adb
===================================================================
--- exp_ch3.adb	(revision 185520)
+++ exp_ch3.adb	(working copy)
@@ -4820,6 +4820,17 @@ 
                       Subtype_Mark        => New_Occurrence_Of (Typ, Loc),
                       Name => Convert_Tag_To_Interface (Typ, Tag_Comp)));
 
+                  --  If the original entity comes from source, then mark the
+                  --  new entity as needing debug information, even though it's
+                  --  defined by a generated renaming that does not come from
+                  --  source, so that Materialize_Entity will be set on the
+                  --  entity when Debug_Renaming_Declaration is called during
+                  --  analysis.
+
+                  if Comes_From_Source (Def_Id) then
+                     Set_Debug_Info_Needed (Defining_Identifier (N));
+                  end if;
+
                   Analyze (N, Suppress => All_Checks);
 
                   --  Replace internal identifier of rewritten node by the
@@ -5065,7 +5076,7 @@ 
             --  renaming that does not come from source.
 
             if Comes_From_Source (Defining_Identifier (N)) then
-               Set_Needs_Debug_Info (Defining_Identifier (N));
+               Set_Debug_Info_Needed (Defining_Identifier (N));
             end if;
 
             --  Now call the routine to generate debug info for the renaming