Eric Botcazou - [PATCH] Improve debug info for Ada (3/4) (original) (raw)

This is the mail archive of the gcc-patches@gcc.gnu.orgmailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Hi,

When the nested function decomposition pass puts a variable into the FRAME object, it creates a "ghost" one that points to the corresponding field in the FRAME object, for debug info purposes, and eventually attaches it to the binding contour:

/* Make sure all new local variables get inserted into the proper BIND_EXPR. */ if (root->debug_var_chain) declare_vars (root->debug_var_chain, DECL_SAVED_TREE (root->context), true);

Now, for debug info purposes, not only must the VAR_DECL be attached to the BIND_EXPR, but it must also be attached to the associated BLOCK. The problem is that gimplify_body may have created a BLOCK-less BIND_EXPR:

/* If there isn't an outer BIND_EXPR, add one. */ if (TREE_CODE (body) != BIND_EXPR) { tree b = build3 (BIND_EXPR, void_type_node, NULL_TREE, NULL_TREE, NULL_TREE); TREE_SIDE_EFFECTS (b) = 1; append_to_statement_list_force (body, &BIND_EXPR_BODY (b)); body = b; }

and, in this case, the debug info is simply lost:

Breakpoint 1, p.bar (r=(field2 => "ab")) at p.adb:11 11 procedure Bar (R : in out My_Record) (gdb) p ustring No definition of "ustring" in current context.

Bootstrapped/regtested on i586-suse-linux, OK for mainline?

2007-02-12 Eric Botcazou ebotcazou@adacore.com

* gimplify.c (gimplify_body): Attach an empty block to the BIND_EXPR.

:ADDPATCH debug:

-- Eric Botcazou

Index: gimplify.c

--- gimplify.c (revision 121686) +++ gimplify.c (working copy) @@ -6373,11 +6373,21 @@ gimplify_body (tree *body_p, tree fndecl body = t; }

with Ada.Strings.Unbounded;

procedure P is pragma Warnings (Off);

type My_Record is record Field2 : String (1 .. 2); end record; V : aliased My_Record := (Field2 => "ab");

procedure Bar (R : in out My_Record) is -- Array of Controlled types -- For some reason, this must be in a separate context than Parse, or -- test_parse.adb can not execute. type Matrix_Map is array (1 .. 2, 1 .. 1) of Ada.Strings.Unbounded.Unbounded_String; Ustring : Ada.Strings.Unbounded.Unbounded_String := Ada.Strings.Unbounded.To_Unbounded_String ("not_set");

  type Matrix_Map_Instance2 is record
     Map : Matrix_Map := (others => (others => Ustring));
  end record;

begin raise Constraint_Error; end Bar;

begin Bar (V); end P;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]