This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB 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]

Re: rfc: DW_AT_vector


Aldy Hernandez writes:
 > hullo.
 > 
 > it was brought to my attention that the dwarf2 information emitted
 > by gcc for vector types is an array of ints/floats within a structure.
 > 
 > this causes problems for gdb because vectors and structures may have
 > different calling conventions.  for example, in altivec, vectors
 > go in registers and get returned in registers.  this may not necessarily
 > be true for structures on the same platform so gdb is unable to get
 > the correct information.
 > 
 > richard suggested:
 > 
 >   I suppose we could invent either (1) a DW_AT_vector flag to go along
 >   with the current struct-of-array-of representation or (2) a new
 >   DW_TAG_vector_type, which looks cleaner but wouldn't work at all with
 >   older gdb or other debuggers.
 > 
 > i am completely clueless in all this, having never heard of DW_AT_
 > or DW_TAG_ until about 30 minutes ago.  but of course, that doesn't
 > keep me from coming up with a patch which i obviously think is correct. :)
 > 
 > i suggest coming up with a DW_AT_vector flag to go along with the
 > structure business.  this will work with any debugger, and will not
 > break any type of compatibility.  then gdb can be tweaked to look for
 > the right values if a structure has a vector tag as well.
 > 
 > of course, i'm willing to volunteer to code the DW_TAG_vector_type
 > stuff, but only as a last and painful resort :).
 > 

This would work, yes, even though I would personally prefer to have a
new vector type. It represents more closely what these vectors really
are.

Anyway, you'll need to talk to the dwarf2/3 committee as well.


Elena


 > here is a proof of concept patch for gcc, gdb, binutils, etc.
 > 
 > comments?
 > 
 > 2002-02-22  Aldy Hernandez  <aldyh@redhat.com>
 > 
 > 	* gdb/dwarf2read.c (dwarf_attr_name): Add case for DW_AT_vector.
 > 
 > 	* include/elf/dwarf2.h (dwarf_attribute): Add DW_AT_vector.
 > 
 > 	* binutils/readelf.c (get_AT_name): Add case for DW_AT_vector.
 > 
 > 	* dwarf2.h (dwarf_attribute): Add DW_AT_vector.
 > 
 > 	* dwarf2out.c (gen_struct_or_union_type_die): Add vector tag.
 > 	(dwarf_attr_name): Add case for DW_AT_vector.
 > 
 > Index: gcc/dwarf2out.c
 > ===================================================================
 > RCS file: /cvs/uberbaum/gcc/dwarf2out.c,v
 > retrieving revision 1.353
 > diff -c -p -r1.353 dwarf2out.c
 > *** dwarf2out.c	2002/01/30 00:19:23	1.353
 > --- dwarf2out.c	2002/02/22 03:39:41
 > *************** dwarf_attr_name (attr)
 > *** 4164,4169 ****
 > --- 4164,4171 ----
 >         return "DW_AT_body_begin";
 >       case DW_AT_body_end:
 >         return "DW_AT_body_end";
 > +     case DW_AT_vector:
 > +       return "DW_AT_vector";
 >       case DW_AT_VMS_rtnbeg_pd_address:
 >         return "DW_AT_VMS_rtnbeg_pd_address";
 >   
 > *************** gen_struct_or_union_type_die (type, cont
 > *** 10888,10893 ****
 > --- 10890,10897 ----
 >   	  && ! decl_function_context (TYPE_STUB_DECL (type)))
 >   	VARRAY_PUSH_TREE (incomplete_types, type);
 >       }
 > +   if (TREE_CODE (type) == VECTOR_TYPE)
 > +     add_AT_flag (type_die, DW_AT_vector, 1);
 >   }
 >   
 >   /* Generate a DIE for a subroutine _type_.  */
 > Index: gcc/dwarf2.h
 > ===================================================================
 > RCS file: /cvs/uberbaum/gcc/dwarf2.h,v
 > retrieving revision 1.22
 > diff -c -p -r1.22 dwarf2.h
 > *** dwarf2.h	2002/01/28 23:23:26	1.22
 > --- dwarf2.h	2002/02/22 03:39:41
 > *************** enum dwarf_attribute
 > *** 239,244 ****
 > --- 239,245 ----
 >       DW_AT_src_coords = 0x2104,
 >       DW_AT_body_begin = 0x2105,
 >       DW_AT_body_end   = 0x2106,
 > +     DW_AT_vector     = 0x2107,
 >       /* VMS Extensions.  */
 >       DW_AT_VMS_rtnbeg_pd_address = 0x2201
 >     };
 > Index: gdb/dwarf2read.c
 > ===================================================================
 > RCS file: /cvs/uberbaum/gdb/dwarf2read.c,v
 > retrieving revision 1.48
 > diff -c -p -r1.48 dwarf2read.c
 > *** dwarf2read.c	2002/02/15 22:42:33	1.48
 > --- dwarf2read.c	2002/02/22 03:39:43
 > *************** dwarf_attr_name (register unsigned attr)
 > *** 5161,5166 ****
 > --- 5161,5168 ----
 >         return "DW_AT_body_begin";
 >       case DW_AT_body_end:
 >         return "DW_AT_body_end";
 > +     case DW_AT_vector:
 > +       return "DW_AT_vector";
 >       default:
 >         return "DW_AT_<unknown>";
 >       }
 > Index: binutils/readelf.c
 > ===================================================================
 > RCS file: /cvs/uberbaum/binutils/readelf.c,v
 > retrieving revision 1.151
 > diff -c -p -r1.151 readelf.c
 > *** readelf.c	2002/02/13 18:14:42	1.151
 > --- readelf.c	2002/02/22 03:39:46
 > *************** get_AT_name (attribute)
 > *** 6455,6460 ****
 > --- 6455,6461 ----
 >       case DW_AT_src_coords:           return "DW_AT_src_coords";
 >       case DW_AT_body_begin:           return "DW_AT_body_begin";
 >       case DW_AT_body_end:             return "DW_AT_body_end";
 > +     case DW_AT_vector:               return "DW_AT_vector";
 >       default:
 >         {
 >   	static char buffer [100];
 > Index: gcc/dwarf2out.c
 > ===================================================================
 > RCS file: /cvs/uberbaum/gcc/dwarf2out.c,v
 > retrieving revision 1.353
 > diff -c -p -r1.353 dwarf2out.c
 > *** dwarf2out.c	2002/01/30 00:19:23	1.353
 > --- dwarf2out.c	2002/02/22 03:40:26
 > *************** dwarf_attr_name (attr)
 > *** 4164,4169 ****
 > --- 4164,4171 ----
 >         return "DW_AT_body_begin";
 >       case DW_AT_body_end:
 >         return "DW_AT_body_end";
 > +     case DW_AT_vector:
 > +       return "DW_AT_vector";
 >       case DW_AT_VMS_rtnbeg_pd_address:
 >         return "DW_AT_VMS_rtnbeg_pd_address";
 >   
 > *************** gen_struct_or_union_type_die (type, cont
 > *** 10888,10893 ****
 > --- 10890,10897 ----
 >   	  && ! decl_function_context (TYPE_STUB_DECL (type)))
 >   	VARRAY_PUSH_TREE (incomplete_types, type);
 >       }
 > +   if (TREE_CODE (type) == VECTOR_TYPE)
 > +     add_AT_flag (type_die, DW_AT_vector, 1);
 >   }
 >   
 >   /* Generate a DIE for a subroutine _type_.  */
 > Index: gcc/dwarf2.h
 > ===================================================================
 > RCS file: /cvs/uberbaum/gcc/dwarf2.h,v
 > retrieving revision 1.22
 > diff -c -p -r1.22 dwarf2.h
 > *** dwarf2.h	2002/01/28 23:23:26	1.22
 > --- dwarf2.h	2002/02/22 03:40:27
 > *************** enum dwarf_attribute
 > *** 239,244 ****
 > --- 239,245 ----
 >       DW_AT_src_coords = 0x2104,
 >       DW_AT_body_begin = 0x2105,
 >       DW_AT_body_end   = 0x2106,
 > +     DW_AT_vector     = 0x2107,
 >       /* VMS Extensions.  */
 >       DW_AT_VMS_rtnbeg_pd_address = 0x2201
 >     };
 > Index: gdb/dwarf2read.c
 > ===================================================================
 > RCS file: /cvs/uberbaum/gdb/dwarf2read.c,v
 > retrieving revision 1.48
 > diff -c -p -r1.48 dwarf2read.c
 > *** dwarf2read.c	2002/02/15 22:42:33	1.48
 > --- dwarf2read.c	2002/02/22 03:40:29
 > *************** dwarf_attr_name (register unsigned attr)
 > *** 5161,5166 ****
 > --- 5161,5168 ----
 >         return "DW_AT_body_begin";
 >       case DW_AT_body_end:
 >         return "DW_AT_body_end";
 > +     case DW_AT_vector:
 > +       return "DW_AT_vector";
 >       default:
 >         return "DW_AT_<unknown>";
 >       }
 > Index: include/elf/dwarf2.h
 > ===================================================================
 > RCS file: /cvs/uberbaum/include/elf/dwarf2.h,v
 > retrieving revision 1.8
 > diff -c -p -r1.8 dwarf2.h
 > *** dwarf2.h	2002/01/28 23:26:53	1.8
 > --- dwarf2.h	2002/02/22 03:40:29
 > *************** enum dwarf_attribute
 > *** 328,333 ****
 > --- 328,334 ----
 >       DW_AT_src_coords = 0x2104,
 >       DW_AT_body_begin = 0x2105,
 >       DW_AT_body_end   = 0x2106,
 > +     DW_AT_vector     = 0x2107,
 >       /* VMS Extensions.  */
 >       DW_AT_VMS_rtnbeg_pd_address = 0x2201
 >     };
 > Index: binutils/readelf.c
 > ===================================================================
 > RCS file: /cvs/uberbaum/binutils/readelf.c,v
 > retrieving revision 1.151
 > diff -c -p -r1.151 readelf.c
 > *** readelf.c	2002/02/13 18:14:42	1.151
 > --- readelf.c	2002/02/22 03:40:35
 > *************** get_AT_name (attribute)
 > *** 6455,6460 ****
 > --- 6455,6461 ----
 >       case DW_AT_src_coords:           return "DW_AT_src_coords";
 >       case DW_AT_body_begin:           return "DW_AT_body_begin";
 >       case DW_AT_body_end:             return "DW_AT_body_end";
 > +     case DW_AT_vector:               return "DW_AT_vector";
 >       default:
 >         {
 >   	static char buffer [100];


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