Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Patch to handle DWARF2 DW_FORM_indirect
@ 2001-11-03  2:01 Keith.Walker
  2001-11-04  8:55 ` Richard Henderson
  2001-11-08 20:39 ` Elena Zannoni
  0 siblings, 2 replies; 14+ messages in thread
From: Keith.Walker @ 2001-11-03  2:01 UTC (permalink / raw)
  To: gdb-patches, binutils

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



Index: bfd/ChangeLog
===================================================================
RCS file: /cvs/src/src/bfd/ChangeLog,v
retrieving revision 1.1156
diff -u -r1.1156 ChangeLog
--- ChangeLog	2001/11/13 03:52:25	1.1156
+++ ChangeLog	2001/11/13 17:23:31
@@ -1,3 +1,9 @@
+2001-11-13  Keith Walker <keith.walker@arm.com>
+
+	* dwarf2.c (read_attribute_value): New Function to handle
+	DW_FORM_indirect
+	(read_attribute): uses read_attribute_value
+
 2001-11-13  John Marshall  <jmarshall@acm.org>
 	    Alan Modra  <amodra@bigpond.net.au>
 


Index: bfd/dwarf2.c
===================================================================
RCS file: /cvs/src/src/bfd/dwarf2.c,v
retrieving revision 1.24
diff -u -r1.24 dwarf2.c
--- dwarf2.c	2001/10/06 10:01:09	1.24
+++ dwarf2.c	2001/11/13 17:23:47
@@ -216,6 +216,9 @@
 static char *read_attribute
   PARAMS ((struct attribute *, struct attr_abbrev *,
 	   struct comp_unit *, char *));
+static char *read_attribute_value
+  PARAMS ((struct attribute *, unsigned,
+	   struct comp_unit *, char *));
 static void add_line_info
   PARAMS ((struct line_info_table *, bfd_vma, char *,
 	   unsigned int, unsigned int, int));
@@ -564,12 +567,12 @@
   return abbrevs;
 }
 
-/* Read an attribute described by an abbreviated attribute.  */
+/* Read an attribute value described by an attribute form.  */
 
 static char *
-read_attribute (attr, abbrev, unit, info_ptr)
+read_attribute_value (attr, form, unit, info_ptr)
      struct attribute   *attr;
-     struct attr_abbrev *abbrev;
+     unsigned form;
      struct comp_unit   *unit;
      char               *info_ptr;
 {
@@ -578,10 +581,9 @@
   struct dwarf_block *blk;
   bfd_size_type amt;
 
-  attr->name = abbrev->name;
-  attr->form = abbrev->form;
+  attr->form = form;
 
-  switch (abbrev->form)
+  switch (form)
     {
     case DW_FORM_addr:
     case DW_FORM_ref_addr:
@@ -676,13 +678,31 @@
       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, unit, info_ptr);
+      break;
+    case DW_FORM_strp:
     default:
       (*_bfd_error_handler) (_("Dwarf Error: Invalid or unhandled FORM
value: %d."),
-			     abbrev->form);
+			     form);
       bfd_set_error (bfd_error_bad_value);
     }
+  return info_ptr;
+}
+
+/* Read an attribute described by an abbreviated attribute.  */
+
+static char *
+read_attribute (attr, abbrev, unit, info_ptr)
+     struct attribute   *attr;
+     struct attr_abbrev *abbrev;
+     struct comp_unit   *unit;
+     char               *info_ptr;
+{
+  attr->name = abbrev->name;
+  info_ptr = read_attribute_value (attr, abbrev->form, unit, info_ptr);
   return info_ptr;
 }
 


Index: binutils/ChangeLog
===================================================================
RCS file: /cvs/src/src/binutils/ChangeLog,v
retrieving revision 1.365
diff -u -r1.365 ChangeLog
--- ChangeLog	2001/11/12 16:17:38	1.365
+++ ChangeLog	2001/11/13 17:23:56
@@ -1,3 +1,8 @@
+2001-11-13  Keith Walker <keith.walker@arm.com>
+	* readelf.c (read_and_display_attr_value): New function to
+	handle DW_FORM_indirect
+	(read_and_display_attr): uses read_and_display_attr_value
+
 2001-11-12  * Steven J. Hill <sjhill@realitydiluted.com>
 
 	* bucomm.c (make_tempname): Use mkstemp in place of mktemp.


Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.131
diff -u -r1.131 readelf.c
--- readelf.c	2001/11/10 00:55:48	1.131
+++ readelf.c	2001/11/13 17:24:04
@@ -231,6 +231,7 @@
 static void               add_abbrev                  PARAMS ((unsigned
long, unsigned long, int));
 static void               add_abbrev_attr             PARAMS ((unsigned
long, unsigned long));
 static unsigned char *    read_and_display_attr       PARAMS ((unsigned
long, unsigned long, unsigned char *, unsigned long, unsigned long));
+static unsigned char *    read_and_display_attr_value PARAMS ((unsigned
long, unsigned long, unsigned char *, unsigned long, unsigned long));
 static unsigned char *    display_block               PARAMS ((unsigned
char *, unsigned long));
 static void               decode_location_expression  PARAMS ((unsigned
char *, unsigned int, unsigned long));
 static void		  request_dump                PARAMS ((unsigned int, int));
@@ -6905,7 +6906,7 @@
 
 
 static unsigned char *
-read_and_display_attr (attribute, form, data, cu_offset, pointer_size)
+read_and_display_attr_value (attribute, form, data, cu_offset, pointer_size)
      unsigned long   attribute;
      unsigned long   form;
      unsigned char * data;
@@ -6916,8 +6917,6 @@
   unsigned char * block_start = NULL;
   int             bytes_read;
 
-  printf ("     %-18s:", get_AT_name (attribute));
-
   switch (form)
     {
     default:
@@ -6962,6 +6961,13 @@
       uvalue = read_leb128 (data, & bytes_read, 0);
       data += bytes_read;
       break;
+
+    case DW_FORM_indirect:
+      form = read_leb128 (data, & bytes_read, 0);
+      data += bytes_read;
+      printf (" %s", get_FORM_name (form));
+      return read_and_display_attr_value (attribute, form, data, cu_offset,
+                                          pointer_size);
     }
 
   switch (form)
@@ -7037,7 +7043,7 @@
       break;
 
     case DW_FORM_indirect:
-      warn (_("Unable to handle FORM: %d"), form);
+      /* handled above */
       break;
 
     default:
@@ -7196,6 +7202,20 @@
       break;
     }
 
+  return data;
+}
+
+static unsigned char *
+read_and_display_attr (attribute, form, data, cu_offset, pointer_size)
+     unsigned long   attribute;
+     unsigned long   form;
+     unsigned char * data;
+     unsigned long   cu_offset;
+     unsigned long   pointer_size;
+{
+  printf ("     %-18s:", get_AT_name (attribute));
+  data = read_and_display_attr_value (attribute, form, data, cu_offset,
+                                      pointer_size);
   printf ("\n");
   return data;
 }


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 <keith.walker@arm.com>
+	* dwarf2read.c (read_attribute_value): New function to handle
+	DW_FORM_indirect
+	(read_attribute): uses read_attribute_value
+
 2001-11-10  Andrew Cagney  <ac131313@redhat.com>
 
 	* 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


^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: Patch to handle DWARF2 DW_FORM_indirect
@ 2001-11-09  9:01 Elena Zannoni
  2001-11-09 11:25 ` Elena Zannoni
  0 siblings, 1 reply; 14+ messages in thread
From: Elena Zannoni @ 2001-11-09  9:01 UTC (permalink / raw)
  To: Keith.Walker; +Cc: gdb-patches, binutils









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 <keith.walker@arm.com>
 > + * dwarf2read.c (read_attribute_value): New function to handle
 > + DW_FORM_indirect
 > + (read_attribute): uses read_attribute_value
 > +
 >  2001-11-10  Andrew Cagney  <ac131313@redhat.com>
 >
 >   * 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




^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: Patch to handle DWARF2 DW_FORM_indirect
@ 2001-11-09  9:05 Elena Zannoni
  0 siblings, 0 replies; 14+ messages in thread
From: Elena Zannoni @ 2001-11-09  9:05 UTC (permalink / raw)
  To: Keith.Walker; +Cc: gdb-patches, binutils









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 <keith.walker@arm.com>
 > + * dwarf2read.c (read_attribute_value): New function to handle
 > + DW_FORM_indirect
 > + (read_attribute): uses read_attribute_value
 > +
 >  2001-11-10  Andrew Cagney  <ac131313@redhat.com>
 >
 >   * 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




^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: Patch to handle DWARF2 DW_FORM_indirect
@ 2001-11-09 10:52 Elena Zannoni
  0 siblings, 0 replies; 14+ messages in thread
From: Elena Zannoni @ 2001-11-09 10:52 UTC (permalink / raw)
  To: Keith.Walker; +Cc: gdb-patches, binutils









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 <keith.walker@arm.com>
 > + * dwarf2read.c (read_attribute_value): New function to handle
 > + DW_FORM_indirect
 > + (read_attribute): uses read_attribute_value
 > +
 >  2001-11-10  Andrew Cagney  <ac131313@redhat.com>
 >
 >   * 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




^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: Patch to handle DWARF2 DW_FORM_indirect
@ 2001-11-09 11:16 Elena Zannoni
  0 siblings, 0 replies; 14+ messages in thread
From: Elena Zannoni @ 2001-11-09 11:16 UTC (permalink / raw)
  To: Keith.Walker; +Cc: gdb-patches, binutils









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 <keith.walker@arm.com>
 > + * dwarf2read.c (read_attribute_value): New function to handle
 > + DW_FORM_indirect
 > + (read_attribute): uses read_attribute_value
 > +
 >  2001-11-10  Andrew Cagney  <ac131313@redhat.com>
 >
 >   * 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




^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: Patch to handle DWARF2 DW_FORM_indirect
@ 2001-11-09 12:45 Elena Zannoni
  2001-11-09  8:58 ` Elena Zannoni
  2001-11-14 12:24 ` Keith.Walker
  0 siblings, 2 replies; 14+ messages in thread
From: Elena Zannoni @ 2001-11-09 12:45 UTC (permalink / raw)
  To: Keith.Walker; +Cc: gdb-patches, binutils





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 <keith.walker@arm.com>
 > + * dwarf2read.c (read_attribute_value): New function to handle
 > + DW_FORM_indirect
 > + (read_attribute): uses read_attribute_value
 > +
 >  2001-11-10  Andrew Cagney  <ac131313@redhat.com>
 >
 >   * 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



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2001-11-27 15:59 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-03  2:01 Patch to handle DWARF2 DW_FORM_indirect Keith.Walker
2001-11-04  8:55 ` Richard Henderson
2001-11-08 20:39 ` Elena Zannoni
2001-11-09  9:01 Elena Zannoni
2001-11-09 11:25 ` Elena Zannoni
2001-11-09  9:05 Elena Zannoni
2001-11-09 10:52 Elena Zannoni
2001-11-09 11:16 Elena Zannoni
2001-11-09 12:45 Elena Zannoni
2001-11-09  8:58 ` Elena Zannoni
2001-11-14 12:24 ` Keith.Walker
2001-11-14 14:25   ` Elena Zannoni
2001-11-27  7:59     ` Elena Zannoni
2001-11-27  4:01   ` Keith.Walker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox