[PATCH] Improve debug info for Ada (3/4)

Eric Botcazou ebotcazou@adacore.com
Mon Feb 12 19:27:00 GMT 2007


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: g116-008-2_fsf.diff
Type: text/x-diff
Size: 1046 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070212/4a713aae/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.adb
Type: text/x-adasrc
Size: 815 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070212/4a713aae/attachment-0001.bin>


More information about the Gcc-patches mailing list