better common debug info

Richard Henderson rth@cygnus.com
Sun Mar 14 15:26:00 GMT 1999


On Sun, Mar 14, 1999 at 01:43:03PM -0800, Richard Henderson wrote:
> > !   /* Force this variable to live within the common block.  */
> > !   DECL_RTL (decl) = change_address (DECL_RTL (aggr), TYPE_MODE (member_type),
> > ! 				    plus_constant (XEXP (DECL_RTL (aggr), 0),
> > ! 						   offset));

One other thing, trying this on Alpha instead of x86 -- change_address
does unhealthy things with address validation.  So this should be using
plain old gen_rtx_MEM instead.

It also doesn't seem to work on Alpha when using mdebug.  Not that it
crashes or anything, but you just don't see the variables.  So we're in
no worse state than we were before, really.  Fortunately, dwarf2 _does_
work, so -gdwarf-2 is the workaround there.  And soon I hope that to be
the default anyway.

A revised patch follows.



r~



Index: com.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/f/com.c,v
retrieving revision 1.48
diff -c -p -d -r1.48 com.c
*** com.c	1999/02/15 18:16:33	1.48
--- com.c	1999/03/14 23:21:22
*************** the Free Software Foundation, 59 Temple 
*** 93,98 ****
--- 93,99 ----
  #include "tree.j"
  #include "output.j"  /* Must follow tree.j so TREE_CODE is defined! */
  #include "convert.j"
+ #include "../expr.h"
  #endif	/* FFECOM_targetCURRENT == FFECOM_targetGCC */
  
  #define FFECOM_GCC_INCLUDE 1	/* Enable -I. */
*************** ffecom_concat_list_new_ (ffebld expr, ff
*** 2268,2349 ****
  
  #if FFECOM_targetCURRENT == FFECOM_targetGCC
  static void
! ffecom_debug_kludge_ (tree aggr, char *aggr_type, ffesymbol member,
! 		      tree member_type UNUSED, ffetargetOffset offset)
  {
-   tree value;
    tree decl;
-   int len;
-   char *buff;
-   char space[120];
- #if 0
-   tree type_id;
- 
-   for (type_id = member_type;
-        TREE_CODE (type_id) != IDENTIFIER_NODE;
-        )
-     {
-       switch (TREE_CODE (type_id))
- 	{
- 	case INTEGER_TYPE:
- 	case REAL_TYPE:
- 	  type_id = TYPE_NAME (type_id);
- 	  break;
- 
- 	case ARRAY_TYPE:
- 	case COMPLEX_TYPE:
- 	  type_id = TREE_TYPE (type_id);
- 	  break;
  
- 	default:
- 	  assert ("no IDENTIFIER_NODE for type!" == NULL);
- 	  type_id = error_mark_node;
- 	  break;
- 	}
-     }
- #endif
- 
-   if (ffecom_transform_only_dummies_
-       || !ffe_is_debug_kludge ())
-     return;	/* Can't do this yet, maybe later. */
- 
-   len = 60
-     + strlen (aggr_type)
-     + IDENTIFIER_LENGTH (DECL_NAME (aggr));
- #if 0
-     + IDENTIFIER_LENGTH (type_id);
- #endif
- 
-   if (((size_t) len) >= ARRAY_SIZE (space))
-     buff = malloc_new_ks (malloc_pool_image (), "debug_kludge", len + 1);
-   else
-     buff = &space[0];
- 
-   sprintf (&buff[0], "At (%s) `%s' plus %ld bytes",
- 	   aggr_type,
- 	   IDENTIFIER_POINTER (DECL_NAME (aggr)),
- 	   (long int) offset);
- 
-   value = build_string (len, buff);
-   TREE_TYPE (value)
-     = build_type_variant (build_array_type (char_type_node,
- 					    build_range_type
- 					    (integer_type_node,
- 					     integer_one_node,
- 					     build_int_2 (strlen (buff), 0))),
- 			  1, 0);
    decl = build_decl (VAR_DECL,
  		     ffecom_get_identifier_ (ffesymbol_text (member)),
! 		     TREE_TYPE (value));
!   TREE_CONSTANT (decl) = 1;
!   TREE_STATIC (decl) = 1;
!   DECL_INITIAL (decl) = error_mark_node;
    DECL_IN_SYSTEM_HEADER (decl) = 1;	/* Don't let -Wunused complain. */
-   decl = start_decl (decl, FALSE);
-   finish_decl (decl, value, FALSE);
  
!   if (buff != &space[0])
!     malloc_kill_ks (malloc_pool_image (), buff, len + 1);
  }
  #endif
  
--- 2269,2294 ----
  
  #if FFECOM_targetCURRENT == FFECOM_targetGCC
  static void
! ffecom_debug_kludge_ (tree aggr, char *aggr_type UNUSED, ffesymbol member,
! 		      tree member_type, ffetargetOffset offset)
  {
    tree decl;
  
    decl = build_decl (VAR_DECL,
  		     ffecom_get_identifier_ (ffesymbol_text (member)),
! 		     member_type);
! 
!   DECL_DEFER_OUTPUT (decl) = 1;		/* Don't define in the output file.  */
!   DECL_INITIAL (decl) = NULL_TREE;
    DECL_IN_SYSTEM_HEADER (decl) = 1;	/* Don't let -Wunused complain. */
  
!   /* Force this variable to live within the common block.  */
!   DECL_RTL (decl) = gen_rtx_MEM (TYPE_MODE (member_type),
! 				 plus_constant (XEXP (DECL_RTL (aggr), 0),
! 						offset));
! 				    
!   decl = start_decl (decl, FALSE);
!   finish_decl (decl, NULL_TREE, FALSE);
  }
  #endif
  


More information about the Gcc-patches mailing list