From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14945 invoked by alias); 27 Nov 2001 12:01:38 -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 14752 invoked from network); 27 Nov 2001 12:01:15 -0000 Received: from unknown (HELO fw-maid.maidenhead.arm.com) (194.201.77.34) by hostedprojects.ges.redhat.com with SMTP; 27 Nov 2001 12:01:15 -0000 Received: by fw-maid.maidenhead.arm.com; id LAA20970; Tue, 27 Nov 2001 11:54:46 GMT Received: from mhsun1.maidenhead.arm.com(192.168.2.10) by fw-maid.maidenhead.arm.com via smap (V5.0) id xma020877; Tue, 27 Nov 01 11:53:53 GMT Received: from mhpc6 (mhpc6 [192.168.2.53]) by mhsun1.maidenhead.arm.com (8.9.3/8.9.3) with SMTP id LAA01919 for ; Tue, 27 Nov 2001 11:59:08 GMT Message-Id: <4.1.20011127115346.00bd8b60@mhsun1.maidenhead.arm.com> X-Sender: kwalker@mhsun1.maidenhead.arm.com X-Mailer: QUALCOMM Windows Eudora Pro Version 4.1 Date: Wed, 14 Nov 2001 12:24:00 -0000 To: gdb-patches@sources.redhat.com From: "Keith.Walker" Subject: Re: Patch to handle DWARF2 DW_FORM_indirect In-Reply-To: <48256B0B.00805439.00@TWALINS3> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-SW-Source: 2001-11/txt/msg00276.txt.bz2 >Your patch won't apply cleanly to gdb anymore, after Jakub's patch for >DW_FORM_strp was committed. Updated to matched the latest file from CVS which has Jakub's patch applied >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? It will now output "unexpected attribute form: DW_FORM_indirect". >Other than that, it's fine. Could you repost an updated patch, just for >the record? Here is the updated patch for gdb: ChangeLog: 2001-11-27 Keith Walker * dwarf2read.c (read_attribute_value): New function to handle DW_FORM_indirect (read_attribute): uses read_attribute_value Index: dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v retrieving revision 1.35 diff -u -r1.35 dwarf2read.c --- dwarf2read.c 2001/11/17 00:08:10 1.35 +++ dwarf2read.c 2001/11/27 11:40:43 @@ -605,6 +605,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 *); @@ -3360,19 +3363,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: @@ -3469,13 +3471,28 @@ info_ptr += bytes_read; break; 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; 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 @@ -5624,8 +5641,12 @@ fprintf (stderr, "flag: TRUE"); else fprintf (stderr, "flag: FALSE"); + break; + case DW_FORM_indirect: + /* the reader will have reduced the indirect form to + the "base form" so this form should not occur */ + fprintf (stderr, "unexpected attribute form: DW_FORM_indirect"); break; - case DW_FORM_indirect: /* we do not handle indirect yet */ 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 From: "Keith.Walker" To: gdb-patches@sources.redhat.com Subject: Re: Patch to handle DWARF2 DW_FORM_indirect Date: Tue, 27 Nov 2001 04:01:00 -0000 Message-ID: <4.1.20011127115346.00bd8b60@mhsun1.maidenhead.arm.com> References: <48256B0B.00805439.00@TWALINS3> X-SW-Source: 2001-11/msg00491.html Message-ID: <20011127040100.s2y5brwhdVBQsAI_ho22Qt_dbwys7UaY8JwKuBbrRP0@z> >Your patch won't apply cleanly to gdb anymore, after Jakub's patch for >DW_FORM_strp was committed. Updated to matched the latest file from CVS which has Jakub's patch applied >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? It will now output "unexpected attribute form: DW_FORM_indirect". >Other than that, it's fine. Could you repost an updated patch, just for >the record? Here is the updated patch for gdb: ChangeLog: 2001-11-27 Keith Walker * dwarf2read.c (read_attribute_value): New function to handle DW_FORM_indirect (read_attribute): uses read_attribute_value Index: dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v retrieving revision 1.35 diff -u -r1.35 dwarf2read.c --- dwarf2read.c 2001/11/17 00:08:10 1.35 +++ dwarf2read.c 2001/11/27 11:40:43 @@ -605,6 +605,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 *); @@ -3360,19 +3363,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: @@ -3469,13 +3471,28 @@ info_ptr += bytes_read; break; 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; 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 @@ -5624,8 +5641,12 @@ fprintf (stderr, "flag: TRUE"); else fprintf (stderr, "flag: FALSE"); + break; + case DW_FORM_indirect: + /* the reader will have reduced the indirect form to + the "base form" so this form should not occur */ + fprintf (stderr, "unexpected attribute form: DW_FORM_indirect"); break; - case DW_FORM_indirect: /* we do not handle indirect yet */ 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