[PATCH] Tiny 64-bit Dwarf2 glitch

Kevin Buettner kevinb@redhat.com
Tue Jun 25 15:23:00 GMT 2002


On Jun 25,  5:06pm, Jason Eckhardt wrote:

> On Tue, 25 Jun 2002, Jason Eckhardt wrote:
> 
> > On Tue, 25 Jun 2002, Kevin Buettner wrote:
> > >
> > > OTOH, if the first four bytes were 0 (which isn't a useful size), read
> > > the next four bytes as the size of the section and set the offset size
> > > to 8.
> >
> >   On the 64-bit binaries I'm examining, the first four bytes were 0.
> > >
> > > I think the following (untested) patch implements this:
> > >
> >
> >   Testing...
> >
> 
>   Okay, it works on all my 32- and 64-bit binaries. Would you mind
>   committing it?

I'm willing to commit it, but I need approval first.  According to the
MAINTAINERS file, I need approval from Jason Merrill or possibly one
of the "Blanket Write Privs" maintainers.

Here's the patch again, this time with a ChangeLog entry.  (It's much
more compact if the diff is made against dwarf2.c revision 1.30.)

	* dwarf2.c (decode_line_info): Handle older, non-standard, 64-bit
	DWARF2 formats.

Index: dwarf2.c
===================================================================
RCS file: /cvs/src/src/bfd/dwarf2.c,v
retrieving revision 1.31
diff -u -p -r1.31 dwarf2.c
--- dwarf2.c	25 Jun 2002 19:10:00 -0000	1.31
+++ dwarf2.c	25 Jun 2002 22:14:16 -0000
@@ -981,24 +981,20 @@ decode_line_info (unit, stash)
   line_ptr = stash->dwarf_line_buffer + unit->line_offset;
 
   /* Read in the prologue.  */
-  if (unit->addr_size == 4)
-    {
-      lh.total_length = read_4_bytes (abfd, line_ptr);
-      line_ptr += 4;
-      offset_size = 4;
-    }
-  else
+  lh.total_length = read_4_bytes (abfd, line_ptr);
+  line_ptr += 4;
+  offset_size = 4;
+  if (lh.total_length == 0xffffffff)
     {
-      BFD_ASSERT (unit->addr_size == 8);
       lh.total_length = read_8_bytes (abfd, line_ptr);
       line_ptr += 8;
       offset_size = 8;
     }
-
-  if (lh.total_length == 0xffffffff)
+  else if (lh.total_length == 0 && unit->addr_size == 8)
     {
-      lh.total_length = read_8_bytes (abfd, line_ptr);
-      line_ptr += 8;
+      /* Handle (non-standard) 64-bit DWARF2 formats.  */
+      lh.total_length = read_4_bytes (abfd, line_ptr);
+      line_ptr += 4;
       offset_size = 8;
     }
   line_end = line_ptr + lh.total_length;



More information about the Binutils mailing list