From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10453 invoked by alias); 22 Nov 2001 07:24:51 -0000 Mailing-List: contact gdb-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 10408 invoked from network); 22 Nov 2001 07:24:48 -0000 Received: from unknown (HELO ali.com.tw) (210.67.80.34) by sourceware.cygnus.com with SMTP; 22 Nov 2001 07:24:48 -0000 Received: (from uucp@localhost) by ali.com.tw (8.9.3/8.9.3) with UUCP id PAA05650 for sources.redhat.com.!gdb-patches; Thu, 22 Nov 2001 15:28:28 +0800 Received: from TWALINS3 (twalins3 [10.198.193.24]) by xi (8.9.3+Sun/8.9.3) with SMTP id PAA09976; Thu, 22 Nov 2001 15:02:58 +0800 (CST) Received: by TWALINS3(Lotus SMTP MTA v4.6.3 (733.2 10-16-1998)) id 48256B0B.00805614 ; Thu, 22 Nov 2001 07:21:46 +0800 X-Lotus-FromDomain: ACER From: Elena Zannoni To: "Keith.Walker" cc: gdb-patches@sources.redhat.com, binutils@sources.redhat.com Message-ID: <48256B0B.00805439.00@TWALINS3> Date: Fri, 09 Nov 2001 12:45:00 -0000 Subject: Re: Patch to handle DWARF2 DW_FORM_indirect Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Content-Disposition: inline X-SW-Source: 2001-11/txt/msg00190.txt.bz2 Keith.Walker writes: > The DWARF2 specification allows the form of attributes to be described > "inline" with DW_FORM_indirect rather than the form being specified in a > separate abbreviation table. The following patch adds support for > DW_FORM_indirect in BFD, binutils and GDB. > > If there are no objections, can this patch be approved and applied by the > GDB and binutils maintainers. > > Keith > Your patch won't apply cleanly to gdb anymore, after Jakub's patch for DW_FORM_strp was committed. One comment: the 'case DW_FORM_indirect:' resulting in an error message of unsupported attribute, is not correct anymore. Could you emit a more pertinent message? Other than that, it's fine. Could you repost an updated patch, just for the record? Thanks Elena > > Index: gdb/ChangeLog > =================================================================== > RCS file: /cvs/src/src/gdb/ChangeLog,v > retrieving revision 1.1758 > diff -u -r1.1758 ChangeLog > --- ChangeLog 2001/11/13 03:10:33 1.1758 > +++ ChangeLog 2001/11/13 17:24:15 > @@ -1,3 +1,8 @@ > +2001-11-13 Keith Walker > + * dwarf2read.c (read_attribute_value): New function to handle > + DW_FORM_indirect > + (read_attribute): uses read_attribute_value > + > 2001-11-10 Andrew Cagney > > * config/i960/tm-nindy960.h (REGISTER_CONVERTIBLE) > > > Index: gdb/dwarf2read.c > =================================================================== > RCS file: /cvs/src/src/gdb/dwarf2read.c,v > retrieving revision 1.34 > diff -u -r1.34 dwarf2read.c > --- dwarf2read.c 2001/11/12 20:36:55 1.34 > +++ dwarf2read.c 2001/11/13 17:24:25 > @@ -593,6 +593,9 @@ > static char *read_attribute (struct attribute *, struct attr_abbrev *, > bfd *, char *, const struct comp_unit_head *); > > +static char *read_attribute_value (struct attribute *, unsigned, > + bfd *, char *, const struct comp_unit_head *); > + > static unsigned int read_1_byte (bfd *, char *); > > static int read_1_signed_byte (bfd *, char *); > @@ -3333,19 +3336,18 @@ > return info_ptr; > } > > -/* Read an attribute described by an abbreviated attribute. */ > +/* Read an attribute value described by an attribute form. */ > > static char * > -read_attribute (struct attribute *attr, struct attr_abbrev *abbrev, > +read_attribute_value (struct attribute *attr, unsigned form, > bfd *abfd, char *info_ptr, > const struct comp_unit_head *cu_header) > { > unsigned int bytes_read; > struct dwarf_block *blk; > > - attr->name = abbrev->name; > - attr->form = abbrev->form; > - switch (abbrev->form) > + attr->form = form; > + switch (form) > { > case DW_FORM_addr: > case DW_FORM_ref_addr: > @@ -3436,15 +3438,30 @@ > DW_UNSND (attr) = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); > info_ptr += bytes_read; > break; > - case DW_FORM_strp: > case DW_FORM_indirect: > + form = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); > + info_ptr += bytes_read; > + info_ptr = read_attribute_value (attr, form, abfd, info_ptr, cu_header); > + break; > + case DW_FORM_strp: > default: > error ("Dwarf Error: Cannot handle %s in DWARF reader.", > - dwarf_form_name (abbrev->form)); > + dwarf_form_name (form)); > } > return info_ptr; > } > > +/* Read an attribute described by an abbreviated attribute. */ > + > +static char * > +read_attribute (struct attribute *attr, struct attr_abbrev *abbrev, > + bfd *abfd, char *info_ptr, > + const struct comp_unit_head *cu_header) > +{ > + attr->name = abbrev->name; > + return read_attribute_value (attr, abbrev->form, abfd, info_ptr, cu_header); > +} > + > /* read dwarf information from a buffer */ > > static unsigned int > @@ -5602,7 +5619,9 @@ > break; > case DW_FORM_strp: /* we do not support separate string > section yet */ > - case DW_FORM_indirect: /* we do not handle indirect yet */ > + case DW_FORM_indirect: /* the reader will have reduced the indirect > + form to the base type so this form > + should not occur */ > default: > fprintf (stderr, "unsupported attribute form: %d.", > die->attrs[i].form); > > > > Keith Walker keith.walker@arm.com Tel:+44 (1628) 427732 > ARM Ltd http://www.arm.com From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10357 invoked by alias); 22 Nov 2001 03:37:51 -0000 Mailing-List: contact gdb-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 10305 invoked from network); 22 Nov 2001 03:37:49 -0000 Received: from unknown (HELO ali.com.tw) (210.67.80.34) by sourceware.cygnus.com with SMTP; 22 Nov 2001 03:37:49 -0000 Received: (from uucp@localhost) by ali.com.tw (8.9.3/8.9.3) with UUCP id LAA29800 for sources.redhat.com.!gdb-patches; Thu, 22 Nov 2001 11:55:18 +0800 Received: from TWALINS3 (twalins3 [10.198.193.24]) by xi (8.9.3+Sun/8.9.3) with SMTP id LAA16475; Thu, 22 Nov 2001 11:34:00 +0800 (CST) Received: by TWALINS3(Lotus SMTP MTA v4.6.3 (733.2 10-16-1998)) id 48256B0B.00805614 ; Thu, 22 Nov 2001 07:21:46 +0800 X-Lotus-FromDomain: ACER From: Elena Zannoni To: "Keith.Walker" cc: gdb-patches@sources.redhat.com, binutils@sources.redhat.com Message-ID: <48256B0B.00805439.00@TWALINS3> Date: Fri, 09 Nov 2001 08:58:00 -0000 Subject: Re: Patch to handle DWARF2 DW_FORM_indirect Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Content-Disposition: inline X-SW-Source: 2001-11/txt/msg00184.txt.bz2 Message-ID: <20011109085800.BcwHEx-6rJ_KzIMMASv9mB3D38ll2dmRQXl2GmQplgA@z> Keith.Walker writes: > The DWARF2 specification allows the form of attributes to be described > "inline" with DW_FORM_indirect rather than the form being specified in a > separate abbreviation table. The following patch adds support for > DW_FORM_indirect in BFD, binutils and GDB. > > If there are no objections, can this patch be approved and applied by the > GDB and binutils maintainers. > > Keith > Your patch won't apply cleanly to gdb anymore, after Jakub's patch for DW_FORM_strp was committed. One comment: the 'case DW_FORM_indirect:' resulting in an error message of unsupported attribute, is not correct anymore. Could you emit a more pertinent message? Other than that, it's fine. Could you repost an updated patch, just for the record? Thanks Elena > > Index: gdb/ChangeLog > =================================================================== > RCS file: /cvs/src/src/gdb/ChangeLog,v > retrieving revision 1.1758 > diff -u -r1.1758 ChangeLog > --- ChangeLog 2001/11/13 03:10:33 1.1758 > +++ ChangeLog 2001/11/13 17:24:15 > @@ -1,3 +1,8 @@ > +2001-11-13 Keith Walker > + * dwarf2read.c (read_attribute_value): New function to handle > + DW_FORM_indirect > + (read_attribute): uses read_attribute_value > + > 2001-11-10 Andrew Cagney > > * config/i960/tm-nindy960.h (REGISTER_CONVERTIBLE) > > > Index: gdb/dwarf2read.c > =================================================================== > RCS file: /cvs/src/src/gdb/dwarf2read.c,v > retrieving revision 1.34 > diff -u -r1.34 dwarf2read.c > --- dwarf2read.c 2001/11/12 20:36:55 1.34 > +++ dwarf2read.c 2001/11/13 17:24:25 > @@ -593,6 +593,9 @@ > static char *read_attribute (struct attribute *, struct attr_abbrev *, > bfd *, char *, const struct comp_unit_head *); > > +static char *read_attribute_value (struct attribute *, unsigned, > + bfd *, char *, const struct comp_unit_head *); > + > static unsigned int read_1_byte (bfd *, char *); > > static int read_1_signed_byte (bfd *, char *); > @@ -3333,19 +3336,18 @@ > return info_ptr; > } > > -/* Read an attribute described by an abbreviated attribute. */ > +/* Read an attribute value described by an attribute form. */ > > static char * > -read_attribute (struct attribute *attr, struct attr_abbrev *abbrev, > +read_attribute_value (struct attribute *attr, unsigned form, > bfd *abfd, char *info_ptr, > const struct comp_unit_head *cu_header) > { > unsigned int bytes_read; > struct dwarf_block *blk; > > - attr->name = abbrev->name; > - attr->form = abbrev->form; > - switch (abbrev->form) > + attr->form = form; > + switch (form) > { > case DW_FORM_addr: > case DW_FORM_ref_addr: > @@ -3436,15 +3438,30 @@ > DW_UNSND (attr) = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); > info_ptr += bytes_read; > break; > - case DW_FORM_strp: > case DW_FORM_indirect: > + form = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); > + info_ptr += bytes_read; > + info_ptr = read_attribute_value (attr, form, abfd, info_ptr, cu_header); > + break; > + case DW_FORM_strp: > default: > error ("Dwarf Error: Cannot handle %s in DWARF reader.", > - dwarf_form_name (abbrev->form)); > + dwarf_form_name (form)); > } > return info_ptr; > } > > +/* Read an attribute described by an abbreviated attribute. */ > + > +static char * > +read_attribute (struct attribute *attr, struct attr_abbrev *abbrev, > + bfd *abfd, char *info_ptr, > + const struct comp_unit_head *cu_header) > +{ > + attr->name = abbrev->name; > + return read_attribute_value (attr, abbrev->form, abfd, info_ptr, cu_header); > +} > + > /* read dwarf information from a buffer */ > > static unsigned int > @@ -5602,7 +5619,9 @@ > break; > case DW_FORM_strp: /* we do not support separate string > section yet */ > - case DW_FORM_indirect: /* we do not handle indirect yet */ > + case DW_FORM_indirect: /* the reader will have reduced the indirect > + form to the base type so this form > + should not occur */ > default: > fprintf (stderr, "unsupported attribute form: %d.", > die->attrs[i].form); > > > > Keith Walker keith.walker@arm.com Tel:+44 (1628) 427732 > ARM Ltd http://www.arm.com