From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18494 invoked by alias); 22 Feb 2002 04:10:03 -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 18132 invoked from network); 22 Feb 2002 04:09:50 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 22 Feb 2002 04:09:50 -0000 Received: from culebra.cygnus.com (twigboy.cygnus.com [205.180.230.45]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id UAA10014; Thu, 21 Feb 2002 20:09:36 -0800 (PST) Received: (from aldyh@localhost) by culebra.cygnus.com (8.10.2/8.10.2) id g1M4A9J02452; Fri, 22 Feb 2002 15:10:09 +1100 (EST) Date: Thu, 21 Feb 2002 20:10:00 -0000 From: Aldy Hernandez To: gdb@sources.redhat.com, gcc@gcc.gnu.org, rth@redhat.com Cc: Elena Zannoni Subject: rfc: DW_AT_vector Message-ID: <20020222041007.GA2446@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.25i X-SW-Source: 2002-02/txt/msg00260.txt.bz2 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 :). 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];