This is the mail archive of the gcc-patches@gcc.gnu.org mailing 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]

[Ada] Small tweak to help GDB to display labels


In the same basket as the previous one.

Tested on i586-suse-linux, applied on the mainline.


2012-01-27  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/gigi.h (create_label_decl): Adjust.
	* gcc-interface/utils.c (create_label_decl): Add GNAT_NODE parameter
	and invoke gnat_pushdecl on it.  Remove obsolete settings.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Label>: Adjust call to
	create_label_decl.
	* gcc-interface/trans.c (gnat_to_gnu) <N_Null): Likewise.  Ignore the
	label for debugging purposes.


-- 
Eric Botcazou
Index: gcc-interface/utils.c
===================================================================
--- gcc-interface/utils.c	(revision 183604)
+++ gcc-interface/utils.c	(working copy)
@@ -6,7 +6,7 @@
  *                                                                          *
  *                          C Implementation File                           *
  *                                                                          *
- *          Copyright (C) 1992-2011, Free Software Foundation, Inc.         *
+ *          Copyright (C) 1992-2012, Free Software Foundation, Inc.         *
  *                                                                          *
  * GNAT is free software;  you can  redistribute it  and/or modify it under *
  * terms of the  GNU General Public License as published  by the Free Soft- *
@@ -1849,17 +1849,19 @@ potential_alignment_gap (tree prev_field
   return true;
 }
 
-/* Return a LABEL_DECL node for LABEL_NAME.  */
+/* Return a LABEL_DECL with LABEL_NAME.  GNAT_NODE is used for the position
+   of the decl.  */
 
 tree
-create_label_decl (tree label_name)
+create_label_decl (tree label_name, Node_Id gnat_node)
 {
-  tree label_decl = build_decl (input_location,
-				LABEL_DECL, label_name, void_type_node);
+  tree label_decl
+    = build_decl (input_location, LABEL_DECL, label_name, void_type_node);
 
-  DECL_CONTEXT (label_decl)     = current_function_decl;
-  DECL_MODE (label_decl)        = VOIDmode;
-  DECL_SOURCE_LOCATION (label_decl) = input_location;
+  DECL_MODE (label_decl) = VOIDmode;
+
+  /* Add this decl to the current binding level.  */
+  gnat_pushdecl (label_decl, gnat_node);
 
   return label_decl;
 }
Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c	(revision 183605)
+++ gcc-interface/decl.c	(working copy)
@@ -4619,7 +4619,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
       break;
 
     case E_Label:
-      gnu_decl = create_label_decl (gnu_entity_name);
+      gnu_decl = create_label_decl (gnu_entity_name, gnat_entity);
       break;
 
     case E_Block:
Index: gcc-interface/gigi.h
===================================================================
--- gcc-interface/gigi.h	(revision 183604)
+++ gcc-interface/gigi.h	(working copy)
@@ -672,8 +672,9 @@ extern tree create_field_decl (tree fiel
 extern tree create_param_decl (tree param_name, tree param_type,
                                bool readonly);
 
-/* Return a LABEL_DECL node for LABEL_NAME.  */
-extern tree create_label_decl (tree label_name);
+/* Return a LABEL_DECL with LABEL_NAME.  GNAT_NODE is used for the position
+   of the decl.  */
+extern tree create_label_decl (tree, Node_Id);
 
 /* Return a FUNCTION_DECL node.  SUBPROG_NAME is the name of the subprogram,
    ASM_NAME is its assembler name, SUBPROG_TYPE is its type (a FUNCTION_TYPE
Index: gcc-interface/trans.c
===================================================================
--- gcc-interface/trans.c	(revision 183604)
+++ gcc-interface/trans.c	(working copy)
@@ -5881,7 +5881,8 @@ gnat_to_gnu (Node_Id gnat_node)
 	 the next statement that the middle-end knows how to preserve.  */
       if (!optimize && Comes_From_Source (gnat_node))
 	{
-	  tree stmt, label = create_label_decl (NULL_TREE);
+	  tree stmt, label = create_label_decl (NULL_TREE, gnat_node);
+	  DECL_IGNORED_P (label) = 1;
 	  start_stmt_group ();
 	  stmt = build1 (GOTO_EXPR, void_type_node, label);
 	  set_expr_location_from_node (stmt, gnat_node);

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