From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9476 invoked by alias); 22 Feb 2002 05:28:23 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 9269 invoked from network); 22 Feb 2002 05:28:16 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 22 Feb 2002 05:28:16 -0000 Received: from localhost.redhat.com (cse.cygnus.com [205.180.230.236]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id VAA14991; Thu, 21 Feb 2002 21:28:02 -0800 (PST) Received: by localhost.redhat.com (Postfix, from userid 469) id 2D17611403; Fri, 22 Feb 2002 00:27:53 -0500 (EST) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15477.55000.987400.13875@localhost.redhat.com> Date: Thu, 21 Feb 2002 21:28:00 -0000 To: Aldy Hernandez Cc: gdb@sources.redhat.com, gcc@gcc.gnu.org, rth@redhat.com, Elena Zannoni Subject: Re: rfc: DW_AT_vector In-Reply-To: <20020222041007.GA2446@redhat.com> References: <20020222041007.GA2446@redhat.com> X-Mailer: VM 7.00 under Emacs 20.7.1 X-SW-Source: 2002-02/txt/msg00262.txt.bz2 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 > > * 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_"; > } > 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_"; > } > 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];